Skip to content

Commit

Permalink
Add command Restart 2 to halt system
Browse files Browse the repository at this point in the history
Add command ``Restart 2`` to halt system. Needs hardware reset or power cycle to restart (#9046)
  • Loading branch information
arendst committed Aug 10, 2020
1 parent 94fb939 commit f268697
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 4 deletions.
2 changes: 2 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
- Fix ESP32 PWM range
- Add Zigbee better support for IKEA Motion Sensor
- Add ESP32 Analog input support for GPIO32 to GPIO39
- Add Zigbee options to ``ZbSend`` ``Config`` and ``ReadCondig``
- Add command ``Restart 2`` to halt system. Needs hardware reset or power cycle to restart (#9046)
3 changes: 2 additions & 1 deletion tasmota/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
- Fix ESP32 PWM range
- Add Zigbee better support for IKEA Motion Sensor
- Add ESP32 Analog input support for GPIO32 to GPIO39
- Add Zigbee add options to ``ZbSend`` ``Config`` and ``ReadCondig``
- Add Zigbee options to ``ZbSend`` ``Config`` and ``ReadCondig``
- Add command ``Restart 2`` to halt system. Needs hardware reset or power cycle to restart (#9046)

### 8.4.0 20200730

Expand Down
3 changes: 2 additions & 1 deletion tasmota/i18n.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
#define D_JSON_GAS "Gas"
#define D_JSON_GATEWAY "Gateway"
#define D_JSON_GROUPS "Groups"
#define D_JSON_HALTING "Halting"
#define D_JSON_HEAPSIZE "Heap"
#define D_JSON_HIGH "High"
#define D_JSON_HOST_NOT_FOUND "Host not found"
Expand Down Expand Up @@ -286,7 +287,7 @@
#define D_CMND_INTERLOCK "Interlock"
#define D_CMND_TELEPERIOD "TelePeriod"
#define D_CMND_RESTART "Restart"
#define D_JSON_ONE_TO_RESTART "1 to restart"
#define D_JSON_ONE_TO_RESTART "1 to restart, 2 to halt"
#define D_CMND_RESET "Reset"
#define D_JSON_RESET_AND_RESTARTING "Reset and Restarting"
#define D_JSON_ONE_TO_RESET "1 to reset"
Expand Down
5 changes: 5 additions & 0 deletions tasmota/support_command.ino
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,11 @@ void CmndRestart(void)
restart_flag = 2;
ResponseCmndChar(D_JSON_RESTARTING);
break;
case 2:
restart_flag = 2;
restart_halt = true;
ResponseCmndChar(D_JSON_HALTING);
break;
case -1:
CmndCrash(); // force a crash
break;
Expand Down
2 changes: 1 addition & 1 deletion tasmota/support_tasmota.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ void Every250mSeconds(void)
}
restart_flag--;
if (restart_flag <= 0) {
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_RESTARTING));
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION "%s"), (restart_halt) ? "Halted" : D_RESTARTING);
EspRestart();
}
}
Expand Down
13 changes: 12 additions & 1 deletion tasmota/support_wifi.ino
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,18 @@ void EspRestart(void)
ResetPwm();
WifiShutdown(true);
CrashDumpClear(); // Clear the stack dump in RTC
ESP_Restart();

if (restart_halt) {
while (1) {
OsWatchLoop(); // Feed OsWatch timer to prevent restart
SetLedLink(1); // Wifi led on
delay(200); // Satisfy SDK
SetLedLink(0); // Wifi led off
delay(800); // Satisfy SDK
}
} else {
ESP_Restart();
}
}

//
Expand Down
1 change: 1 addition & 0 deletions tasmota/tasmota.ino
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ bool soft_spi_flg = false; // Software SPI configured
bool ntp_force_sync = false; // Force NTP sync
bool is_8285 = false; // Hardware device ESP8266EX (0) or ESP8285 (1)
bool skip_light_fade; // Temporarily skip light fading
bool restart_halt = false; // Do not restart but stay in wait loop
myio my_module; // Active copy of Module GPIOs (17 x 8 bits)
gpio_flag my_module_flag; // Active copy of Template GPIO flags
StateBitfield global_state; // Global states (currently Wifi and Mqtt) (8 bits)
Expand Down

0 comments on commit f268697

Please sign in to comment.