| 30 | } |
| 31 | |
| 32 | void 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 | |
| 51 | void doUpgrade() |
| 52 | { |
no test coverage detected