mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-01-11 15:29:28 -05:00
Shows a message when flashing from serial (#1758)
This commit is contained in:
parent
3943848add
commit
1676702a09
@ -142,6 +142,13 @@ static void cmd_flash(BaseSequentialStream* chp, int argc, char* argv[]) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto evtd = getEventDispatcherInstance();
|
||||||
|
if (!evtd) return;
|
||||||
|
auto top_widget = evtd->getTopWidget();
|
||||||
|
if (!top_widget) return;
|
||||||
|
auto nav = static_cast<ui::SystemView*>(top_widget)->get_navigation_view();
|
||||||
|
if (!nav) return;
|
||||||
|
nav->display_modal("Flashing", "Flashing from serial.\rPlease wait!\nDevice will restart.");
|
||||||
// check file extensions
|
// check file extensions
|
||||||
if (strEndsWith(path.native(), u".ppfw.tar")) {
|
if (strEndsWith(path.native(), u".ppfw.tar")) {
|
||||||
// extract tar
|
// extract tar
|
||||||
@ -153,6 +160,7 @@ static void cmd_flash(BaseSequentialStream* chp, int argc, char* argv[]) {
|
|||||||
});
|
});
|
||||||
if (res.empty()) {
|
if (res.empty()) {
|
||||||
chprintf(chp, "error bad TAR file.\r\n");
|
chprintf(chp, "error bad TAR file.\r\n");
|
||||||
|
nav->pop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
path = res; // it will contain the last bin file in tar
|
path = res; // it will contain the last bin file in tar
|
||||||
@ -160,8 +168,10 @@ static void cmd_flash(BaseSequentialStream* chp, int argc, char* argv[]) {
|
|||||||
// nothing to do for this case yet.
|
// nothing to do for this case yet.
|
||||||
} else {
|
} else {
|
||||||
chprintf(chp, "error only .bin or .ppfw.tar files canbe flashed.\r\n");
|
chprintf(chp, "error only .bin or .ppfw.tar files canbe flashed.\r\n");
|
||||||
|
nav->pop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
chprintf(chp, "Flashing: ");
|
chprintf(chp, "Flashing: ");
|
||||||
chprintf(chp, path.string().c_str());
|
chprintf(chp, path.string().c_str());
|
||||||
chprintf(chp, "\r\n");
|
chprintf(chp, "\r\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user