kopia lustrzana https://github.com/lora-aprs/LoRa_APRS_iGate
Added watchdog timer
Allows to automatically reboot the device if crashed.pull/218/head
rodzic
d984dadb5d
commit
1547d5b8b1
|
@ -6,6 +6,7 @@
|
|||
#include <TaskManager.h>
|
||||
#include <logger.h>
|
||||
#include <power_management.h>
|
||||
#include <esp_task_wdt.h>
|
||||
|
||||
#include "TaskAprsIs.h"
|
||||
#include "TaskBeacon.h"
|
||||
|
@ -48,6 +49,8 @@ RouterTask routerTask(fromModem, toModem, toAprsIs, toMQTT);
|
|||
BeaconTask beaconTask(toModem, toAprsIs);
|
||||
|
||||
void setup() {
|
||||
esp_task_wdt_init(10, true);
|
||||
esp_task_wdt_add(NULL);
|
||||
Serial.begin(115200);
|
||||
LoRaSystem.getLogger().setSerial(&Serial);
|
||||
setWiFiLogger(&LoRaSystem.getLogger());
|
||||
|
@ -137,6 +140,7 @@ void setup() {
|
|||
}
|
||||
}
|
||||
|
||||
esp_task_wdt_reset();
|
||||
LoRaSystem.getTaskManager().setup(LoRaSystem);
|
||||
|
||||
LoRaSystem.getDisplay().showSpashScreen("LoRa APRS iGate", VERSION);
|
||||
|
@ -166,6 +170,7 @@ void setup() {
|
|||
volatile bool syslogSet = false;
|
||||
|
||||
void loop() {
|
||||
esp_task_wdt_reset();
|
||||
LoRaSystem.getTaskManager().loop(LoRaSystem);
|
||||
if (LoRaSystem.isWifiOrEthConnected() && LoRaSystem.getUserConfig()->syslog.active && !syslogSet) {
|
||||
LoRaSystem.getLogger().setSyslogServer(LoRaSystem.getUserConfig()->syslog.server, LoRaSystem.getUserConfig()->syslog.port, LoRaSystem.getUserConfig()->callsign);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <logger.h>
|
||||
#include <esp_task_wdt.h>
|
||||
|
||||
#include "Task.h"
|
||||
#include "TaskOTA.h"
|
||||
|
@ -37,6 +38,9 @@ bool OTATask::setup(System &system) {
|
|||
error_str = "End Failed";
|
||||
}
|
||||
system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, getName(), "Error[%d]: %s", error, error_str.c_str());
|
||||
})
|
||||
.onProgress([&](unsigned int received, unsigned int total_size){
|
||||
esp_task_wdt_reset();
|
||||
});
|
||||
if (system.getUserConfig()->network.hostname.overwrite) {
|
||||
_ota.setHostname(system.getUserConfig()->network.hostname.name.c_str());
|
||||
|
|
Ładowanie…
Reference in New Issue