diff options
author | Manuel Coenen <manuel@duet3d.com> | 2021-02-15 14:43:30 +0300 |
---|---|---|
committer | Manuel Coenen <manuel@duet3d.com> | 2021-02-15 14:43:30 +0300 |
commit | a0ad84462bc8dbe98204ade0e2f65cdb2a0fdd32 (patch) | |
tree | 801566bf51de732b12335d61acf077706c1701b2 /src/Comms/PanelDueUpdater.cpp | |
parent | a6c1e6f32ed60ae51a1abf2a66abf47343ba4ce2 (diff) |
Add M997 P parameter to specify firmware binary to use
Diffstat (limited to 'src/Comms/PanelDueUpdater.cpp')
-rw-r--r-- | src/Comms/PanelDueUpdater.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Comms/PanelDueUpdater.cpp b/src/Comms/PanelDueUpdater.cpp index 5789501b..353f2458 100644 --- a/src/Comms/PanelDueUpdater.cpp +++ b/src/Comms/PanelDueUpdater.cpp @@ -108,6 +108,7 @@ PanelDueUpdater::PanelDueUpdater() noexcept , offset(0) , erasedAndResetAt(0) , state(FlashState::idle) + , filename(nullptr) { } @@ -120,13 +121,14 @@ PanelDueUpdater::~PanelDueUpdater() noexcept delete flasher; } -void PanelDueUpdater::Start(const uint32_t serialChan) noexcept +void PanelDueUpdater::Start(const StringRef& filenameRef, const uint32_t serialChan) noexcept { if (state != FlashState::idle) { return; } serialChannel = serialChan; + filename = filenameRef.IsEmpty() ? PANEL_DUE_FIRMWARE_FILE : filenameRef.c_str(); state = FlashState::eraseAndReset; } @@ -204,7 +206,7 @@ void PanelDueUpdater::Spin() noexcept case FlashState::bossaWrite: { - bool done = flasher->write(firmwareFilename, offset); + bool done = flasher->write(filename, FIRMWARE_DIRECTORY, offset); if (done) { offset = 0; // Reset it for verification @@ -218,7 +220,7 @@ void PanelDueUpdater::Spin() noexcept { uint32_t pageErrors; uint32_t totalErrors; - bool done = flasher->verify(firmwareFilename, pageErrors, totalErrors, offset); + bool done = flasher->verify(filename, FIRMWARE_DIRECTORY, pageErrors, totalErrors, offset); if (done && pageErrors == 0) { state = FlashState::bossaWriteOptions; @@ -283,6 +285,9 @@ void PanelDueUpdater::Spin() noexcept offset = 0; erasedAndResetAt = 0; + + filename = nullptr; + state = FlashState::idle; } break; |