Multi-image OTA support on small flash devices
parent
904253dca4
commit
3abe49fb0e
|
@ -129,6 +129,7 @@ void SpejsNode::onConnected() {
|
||||||
notify("$mac", WifiStation.getMAC());
|
notify("$mac", WifiStation.getMAC());
|
||||||
notify("$fw/name", "spejsiot");
|
notify("$fw/name", "spejsiot");
|
||||||
notify("$fw/version", BUILD_ID);
|
notify("$fw/version", BUILD_ID);
|
||||||
|
notify("$fw/slot", String(currentSlot));
|
||||||
|
|
||||||
// HTTP initialization
|
// HTTP initialization
|
||||||
http.listen(80);
|
http.listen(80);
|
||||||
|
|
|
@ -11,7 +11,12 @@ EndpointResult ImplementationEndpoint::onValue(String property, String value) {
|
||||||
void ImplementationEndpoint::startOTA() {
|
void ImplementationEndpoint::startOTA() {
|
||||||
uint8_t slot;
|
uint8_t slot;
|
||||||
rboot_config bootconf;
|
rboot_config bootconf;
|
||||||
|
|
||||||
|
#ifdef RBOOT_TWO_ROMS
|
||||||
|
String romURL = OTA_URL + parent->deviceID + (parent->currentSlot ? "/rom1.bin" : "/rom0.bin");
|
||||||
|
#else
|
||||||
String romURL = OTA_URL + parent->deviceID + "/rom0.bin";
|
String romURL = OTA_URL + parent->deviceID + "/rom0.bin";
|
||||||
|
#endif
|
||||||
String spiffsURL = OTA_URL + parent->deviceID + "/spiff_rom.bin";
|
String spiffsURL = OTA_URL + parent->deviceID + "/spiff_rom.bin";
|
||||||
|
|
||||||
Serial.println("Updating...");
|
Serial.println("Updating...");
|
||||||
|
@ -22,10 +27,7 @@ void ImplementationEndpoint::startOTA() {
|
||||||
|
|
||||||
bootconf = rboot_get_config();
|
bootconf = rboot_get_config();
|
||||||
|
|
||||||
if (parent->currentSlot == 0)
|
slot = !parent->currentSlot;
|
||||||
slot = 1;
|
|
||||||
else
|
|
||||||
slot = 0;
|
|
||||||
|
|
||||||
Serial.printf("Updating to rom %d.\r\n", slot);
|
Serial.printf("Updating to rom %d.\r\n", slot);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue