Main thread using FreeRTOS notifications, added missing commands for firmware update

This commit is contained in:
Jan Käberich 2020-08-31 17:57:24 +02:00
parent 07ba714f1f
commit 8c33ae523a
11 changed files with 209 additions and 134 deletions

View file

@ -62,7 +62,7 @@ void FirmwareUpdateDialog::on_bStart_clicked()
}
state = State::ErasingFLASH;
addStatus("Erasing device memory...");
// TODO issue write command
dev.SendCommandWithoutPayload(Protocol::PacketType::ClearFlash);
timer.start(10000);
}
@ -105,7 +105,7 @@ void FirmwareUpdateDialog::receivedAck()
// complete file transferred
addStatus("Triggering device update...");
state = State::TriggeringUpdate;
// TODO trigger update
dev.SendCommandWithoutPayload(Protocol::PacketType::PerformFirmwareUpdate);
timer.start(5000);
}
sendNextFirmwareChunk();
@ -113,7 +113,7 @@ void FirmwareUpdateDialog::receivedAck()
break;
case State::TriggeringUpdate:
addStatus("Rebooting device...");
// TODO listen for detected device
// TODO delete current device and listen for reconnect
state = State::Idle;
break;
}
@ -124,4 +124,5 @@ void FirmwareUpdateDialog::sendNextFirmwareChunk()
Protocol::FirmwarePacket fw;
fw.address = transferredBytes;
file->read((char*) &fw.data, Protocol::FirmwareChunkSize);
dev.SendFirmwareChunk(fw);
}