Use arch_restart to restart ESP
This commit is contained in:
@@ -241,49 +241,27 @@ script:
|
|||||||
ESP_LOGD(TAG, "Disable BLE");
|
ESP_LOGD(TAG, "Disable BLE");
|
||||||
#ifdef USE_BLUETOOTH_PROXY
|
#ifdef USE_BLUETOOTH_PROXY
|
||||||
ESP_LOGD(TAG, " Bluetooth proxy: %s", ble_proxy->has_active() ? "Active" : "Passive");
|
ESP_LOGD(TAG, " Bluetooth proxy: %s", ble_proxy->has_active() ? "Active" : "Passive");
|
||||||
while (ble_proxy->has_active() and
|
|
||||||
ble_proxy->get_bluetooth_connections_limit() != ble_proxy->get_bluetooth_connections_free()) {
|
|
||||||
ESP_LOGD(TAG, " BT proxy connections: %i of %i",
|
|
||||||
int(ble_proxy->get_bluetooth_connections_limit() - ble_proxy->get_bluetooth_connections_free()),
|
|
||||||
int(ble_proxy->get_bluetooth_connections_limit()));
|
|
||||||
if (ble_proxy->has_active()) {
|
if (ble_proxy->has_active()) {
|
||||||
ESP_LOGD(TAG, " BT proxy set passive mode...");
|
ESP_LOGD(TAG, " BT proxy set passive mode...");
|
||||||
ble_proxy->set_active(false);
|
ble_proxy->set_active(false);
|
||||||
}
|
|
||||||
#ifdef ARDUINO
|
|
||||||
delay(1000);
|
delay(1000);
|
||||||
#elif defined(USE_ESP_IDF)
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
|
||||||
#endif
|
|
||||||
App.feed_wdt();
|
App.feed_wdt();
|
||||||
}
|
}
|
||||||
#endif // USE_BLUETOOTH_PROXY
|
#endif // USE_BLUETOOTH_PROXY
|
||||||
ESP_LOGD(TAG, " Stopping BLE Tracker scan...");
|
ESP_LOGD(TAG, " Stopping BLE Tracker scan...");
|
||||||
ble_tracker->stop_scan();
|
ble_tracker->stop_scan();
|
||||||
#ifdef ARDUINO
|
|
||||||
delay(1000);
|
delay(1000);
|
||||||
#elif defined(USE_ESP_IDF)
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
|
||||||
#endif
|
|
||||||
App.feed_wdt();
|
App.feed_wdt();
|
||||||
ESP_LOGD(TAG, " Disabling BLE Tracker scan...");
|
ESP_LOGD(TAG, " Disabling BLE Tracker scan...");
|
||||||
ble_tracker->set_scan_active(false);
|
ble_tracker->set_scan_active(false);
|
||||||
#ifdef ARDUINO
|
|
||||||
delay(1000);
|
delay(1000);
|
||||||
#elif defined(USE_ESP_IDF)
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
|
||||||
#endif
|
|
||||||
App.feed_wdt();
|
App.feed_wdt();
|
||||||
if (ble_tracker->get_parent() != nullptr) {
|
if (ble_tracker->get_parent() != nullptr) {
|
||||||
ESP_LOGD(TAG, " Disabling BLE...");
|
ESP_LOGD(TAG, " Disabling BLE...");
|
||||||
ble_tracker->get_parent()->disable();
|
ble_tracker->get_parent()->disable();
|
||||||
}
|
|
||||||
#ifdef ARDUINO
|
|
||||||
delay(1000);
|
delay(1000);
|
||||||
#elif defined(USE_ESP_IDF)
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
|
||||||
#endif
|
|
||||||
App.feed_wdt();
|
App.feed_wdt();
|
||||||
|
}
|
||||||
ble_tracker->dump_config();
|
ble_tracker->dump_config();
|
||||||
#endif // USE_ESP32_BLE_CLIENT
|
#endif // USE_ESP32_BLE_CLIENT
|
||||||
|
|
||||||
@@ -370,7 +348,7 @@ script:
|
|||||||
- switch.turn_off: screen_power
|
- switch.turn_off: screen_power
|
||||||
- delay: 2s
|
- delay: 2s
|
||||||
# Restart ESPHome
|
# Restart ESPHome
|
||||||
- lambda: App.safe_reboot();
|
- lambda: arch_restart();
|
||||||
|
|
||||||
### This code should never run
|
### This code should never run
|
||||||
- delay: 2s
|
- delay: 2s
|
||||||
@@ -445,7 +423,7 @@ script:
|
|||||||
- delay: 5s
|
- delay: 5s
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
ESP_LOGI("addon_upload_tft.script.upload_tft_attempt", "Restarting ESPHome");
|
ESP_LOGI("addon_upload_tft.script.upload_tft_attempt", "Restarting ESPHome");
|
||||||
App.safe_reboot();
|
arch_restart();
|
||||||
|
|
||||||
select:
|
select:
|
||||||
- id: tft_file_model
|
- id: tft_file_model
|
||||||
|
|||||||
@@ -984,7 +984,7 @@ display:
|
|||||||
switch (component_id) {
|
switch (component_id) {
|
||||||
case 4: // Reboot button
|
case 4: // Reboot button
|
||||||
if (!touch_event) { // Release
|
if (!touch_event) { // Release
|
||||||
App.safe_reboot();
|
arch_restart();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -993,7 +993,7 @@ display:
|
|||||||
switch (component_id) {
|
switch (component_id) {
|
||||||
case 9: // Reboot button
|
case 9: // Reboot button
|
||||||
if (!touch_event) { // Release
|
if (!touch_event) { // Release
|
||||||
App.safe_reboot();
|
arch_restart();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user