mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-27 01:56:14 +01:00
feat: emergency stop and power off during OTA
This commit is contained in:
parent
60616bb395
commit
c0becf9f78
|
@ -163,6 +163,16 @@ void loop()
|
||||||
// Initialise OTA if not already done
|
// Initialise OTA if not already done
|
||||||
if (!otaInitialised) {
|
if (!otaInitialised) {
|
||||||
ArduinoOTA.setHostname(WIFI_HOSTNAME);
|
ArduinoOTA.setHostname(WIFI_HOSTNAME);
|
||||||
|
// Prevent locos from moving during OTA
|
||||||
|
ArduinoOTA.onStart([]() {
|
||||||
|
// Emergency stop all locos
|
||||||
|
DCC::setThrottle(0,1,1);
|
||||||
|
// Disable tracks power
|
||||||
|
TrackManager::setMainPower(POWERMODE::OFF);
|
||||||
|
TrackManager::setProgPower(POWERMODE::OFF);
|
||||||
|
// Broadcast power status
|
||||||
|
CommandDistributor::broadcastPower();
|
||||||
|
});
|
||||||
// Set OTA password if defined
|
// Set OTA password if defined
|
||||||
#ifdef OTA_AUTH
|
#ifdef OTA_AUTH
|
||||||
ArduinoOTA.setPassword(OTA_AUTH);
|
ArduinoOTA.setPassword(OTA_AUTH);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user