MCPcopy Create free account
hub / github.com/SmingHub/Sming / upgradeCallback

Function upgradeCallback

samples/Basic_Ota/app/application.cpp:32–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32void upgradeCallback(Ota::Network::HttpUpgrader&, bool result)
33{
34 Serial.println(_F("In callback..."));
35 if(result == true) {
36 // success
37 ota.end();
38
39 auto part = ota.getNextBootPartition();
40 // set to boot new rom and then reboot
41 Serial << _F("Firmware updated, rebooting to ") << part.name() << _F(" @ ...") << endl;
42 ota.setBootPartition(part);
43 System.restart();
44 } else {
45 ota.abort();
46 // fail
47 Serial.println(_F("Firmware update failed!"));
48 }
49}
50
51void doUpgrade()
52{

Callers 1

onProtocolUpgradeMethod · 0.85

Calls 7

printlnMethod · 0.80
endMethod · 0.45
getNextBootPartitionMethod · 0.45
nameMethod · 0.45
setBootPartitionMethod · 0.45
restartMethod · 0.45
abortMethod · 0.45

Tested by

no test coverage detected