From: jweigele Date: Wed, 13 Sep 2023 21:37:25 +0000 (-0700) Subject: some tuning for openthread loops X-Git-Url: http://git.hexthepla.net/?a=commitdiff_plain;h=f79e139f30abab524741ce5463b0b308b054d6e3;p=esp32projects some tuning for openthread loops --- diff --git a/aqi/main/Kconfig b/aqi/main/Kconfig index 6bd4b2b..4047a94 100644 --- a/aqi/main/Kconfig +++ b/aqi/main/Kconfig @@ -11,6 +11,11 @@ config LIGHT_SLEEP_ENABLED help Not very well tested yet +config UART_ENABLED + bool "Actually fetch and report the AQI over UART" + default y + help + Gets passed and used later for includes config ZIG_ENABLED bool "Are we using zigbee pairing and reporting" default n diff --git a/aqi/main/aqi.c b/aqi/main/aqi.c index 77c9116..e8c3fc1 100644 --- a/aqi/main/aqi.c +++ b/aqi/main/aqi.c @@ -235,8 +235,14 @@ static void ot_task_worker(void *aContext) create_config_network(esp_openthread_get_instance()); - // Run the main loop - esp_openthread_launch_mainloop(); + while (true) { + // Run the main loop + esp_err_t err = esp_openthread_launch_mainloop(); + ESP_LOGE(TAG, "Error somewhere in openthread loop %s.", esp_err_to_name(err)); + vTaskDelay( pdMS_TO_TICKS(10000) ); + + } + // Clean up esp_netif_destroy(openthread_netif); diff --git a/aqi/main/aqi.h b/aqi/main/aqi.h index 2cbb319..33b2102 100644 --- a/aqi/main/aqi.h +++ b/aqi/main/aqi.h @@ -27,7 +27,9 @@ #include "openthread/thread.h" -# define CONFIG_OPENTHREAD_NETWORK_POLLPERIOD_TIME 3000 +#define CONFIG_OPENTHREAD_NETWORK_POLLPERIOD_TIME 3000 +// okay this isn't really defined here, you need to find it in the openthread source :( +#define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL 60000 // 60 seconds = 1 minute #define ESP_OPENTHREAD_DEFAULT_RADIO_CONFIG() \ { \