call LMIC_shutdown before ESP.restart
This commit is contained in:
1 parent
ebfc16219b
commit
6d1d358a56
3 files changed
+11
-6
No files matched your search
+2
-2
@@ -15,7 +15,7 @@ void doHousekeeping() {
|
||||
|
||||
// check if update mode trigger switch was set
|
||||
if (cfg.runmode == 1)
|
||||
ESP.restart();
|
||||
do_reset();
|
||||
|
||||
// task storage debugging //
|
||||
ESP_LOGD(TAG, "Wifiloop %d bytes left",
|
||||
@@ -60,7 +60,7 @@ void doHousekeeping() {
|
||||
get_salt(); // get new salt for salting hashes
|
||||
|
||||
if (esp_get_minimum_free_heap_size() <= MEM_LOW) // check again
|
||||
esp_restart(); // memory leak, reset device
|
||||
do_reset(); // memory leak, reset device
|
||||
}
|
||||
} // doHousekeeping()
|
||||
|
||||
|
||||
+8
-4
@@ -5,15 +5,19 @@
|
||||
// Local logging tag
|
||||
static const char TAG[] = "main";
|
||||
|
||||
// helper function
|
||||
void do_reset() {
|
||||
ESP_LOGI(TAG, "Remote command: restart device");
|
||||
LMIC_shutdown();
|
||||
esp_restart();
|
||||
}
|
||||
|
||||
// set of functions that can be triggered by remote commands
|
||||
void set_reset(uint8_t val[]) {
|
||||
switch (val[0]) {
|
||||
case 0: // restart device
|
||||
ESP_LOGI(TAG, "Remote command: restart device");
|
||||
sprintf(display_line6, "Reset pending");
|
||||
vTaskDelay(10000 / portTICK_PERIOD_MS); // wait for LMIC to confirm LoRa
|
||||
// downlink to server
|
||||
esp_restart();
|
||||
do_reset();
|
||||
break;
|
||||
case 1: // reset MAC counter
|
||||
ESP_LOGI(TAG, "Remote command: reset MAC counter");
|
||||
|
||||
Reference in new issue
Block a user