Skip to content

Commit

Permalink
write firmware version and hardware platform to Flash memory
Browse files Browse the repository at this point in the history
  • Loading branch information
caveman99 committed Sep 16, 2024
1 parent f37276d commit b334330
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/platform/esp32/main-esp32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,24 @@ void esp32Setup()
uint32_t rebootCounter = preferences.getUInt("rebootCounter", 0);
rebootCounter++;
preferences.putUInt("rebootCounter", rebootCounter);
// store firmware version and hwrevision for access from OTA firmware
String fwrev = preferences.getString("firmwareVersion", "");
if (fwrev.compareTo(optstr(APP_VERSION)) != 0)
preferences.putString("firmwareVersion", optstr(APP_VERSION));
uint8_t hwven = preferences.getUInt("hwVendor", 0);
if (hwven != HW_VENDOR)
preferences.putUInt("hwVendor", HW_VENDOR);
preferences.end();
LOG_DEBUG("Number of Device Reboots: %d\n", rebootCounter);
#if !MESHTASTIC_EXCLUDE_BLUETOOTH
String BLEOTA = BleOta::getOtaAppVersion();
if (BLEOTA.isEmpty()) {
LOG_DEBUG("No OTA firmware available\n");
LOG_INFO("No OTA firmware available\n");
} else {
LOG_DEBUG("OTA firmware version %s\n", BLEOTA.c_str());
LOG_INFO("OTA firmware version %s\n", BLEOTA.c_str());
}
#else
LOG_DEBUG("No OTA firmware available\n");
LOG_INFO("No OTA firmware available\n");
#endif

// enableModemSleep();
Expand Down

0 comments on commit b334330

Please sign in to comment.