Better fix

This commit is contained in:
3djc
2021-01-25 16:05:04 +01:00
parent 289508e949
commit 0cf87da402
3 changed files with 11 additions and 32 deletions
+3 -30
View File
@@ -124,41 +124,14 @@ class FlashDialog: public FullScreenDialog
};
template <class T>
class MultiFlashDialog: public FullScreenDialog
class MultiFlashDialog: public FlashDialog<T>
{
public:
explicit MultiFlashDialog(ModuleIndex module, MultiModuleType type):
FullScreenDialog(WARNING_TYPE_INFO, "Flash device"),
device(module),
type(type),
progress(this, {LCD_W / 2 - 50, LCD_H / 2, 100, 15})
FlashDialog<T>(module)
{
device.setType(type);
}
void deleteLater(bool detach = true, bool trash = true) override
{
if (_deleted)
return;
progress.deleteLater(true, false);
FullScreenDialog::deleteLater(detach, trash);
}
void flash(const char * filename)
{
device.flashFirmware(filename, type, [=](const char * title, const char * message, int count, int total) -> void {
setMessage(message);
progress.setValue(total > 0 ? count * 100 / total : 0);
MainWindow::instance()->run(false);
});
deleteLater();
}
protected:
T device;
MultiModuleType type;
Progress progress;
};
void RadioSdManagerPage::build(FormWindow * window)