MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / UpdateFirmware

Method UpdateFirmware

src/Platform/RepRap.cpp:2725–2745  ·  view source on GitHub ↗

Update the firmware. Prerequisites should be checked before calling this.

Source from the content-addressed store, hash-verified

2723
2724// Update the firmware. Prerequisites should be checked before calling this.
2725void RepRap::UpdateFirmware(c_string iapFilename, c_string iapParam) noexcept
2726{
2727 FileStore *_ecv_null iapFile = platform->OpenFile(FIRMWARE_DIRECTORY, iapFilename, OpenMode::read);
2728 if (iapFile == nullptr)
2729 {
2730 iapFile = platform->OpenFile(DEFAULT_SYS_DIR, iapFilename, OpenMode::read);
2731 if (iapFile == nullptr)
2732 {
2733 // This should not happen because we already checked that the file exists, so use a simplified error message
2734 platform->Message(FirmwareUpdateMessage, "Missing IAP");
2735 return;
2736 }
2737 }
2738
2739 PrepareToLoadIap();
2740
2741 // Use RAM-based IAP
2742 iapFile->Read(reinterpret_cast<char *_ecv_array>(IAP_IMAGE_START), iapFile->Length());
2743 iapFile->Close();
2744 StartIap(iapParam);
2745}
2746
2747#endif
2748

Callers 1

RunStateMachineMethod · 0.80

Calls 5

MessageMethod · 0.80
OpenFileMethod · 0.45
ReadMethod · 0.45
LengthMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected