some tuning for openthread loops
authorjweigele <jweigele@local>
Wed, 13 Sep 2023 21:37:25 +0000 (14:37 -0700)
committerjweigele <jweigele@local>
Wed, 13 Sep 2023 21:37:25 +0000 (14:37 -0700)
aqi/main/Kconfig
aqi/main/aqi.c
aqi/main/aqi.h

index 6bd4b2b50977a8d31cfe1cfff1ed7b1259eebda0..4047a949582e215d26dc08eeb5750be42b5f862c 100644 (file)
@@ -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
index 77c9116c6422748add88598c4946937aa327ca8c..e8c3fc190821ec170c9a001f29ea78debc3f9d67 100644 (file)
@@ -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);
index 2cbb319970ce4e2c806c1898b4f6daa1107091d7..33b21028f1b4b30c7a18902a06022d8b6f744989 100644 (file)
@@ -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()              \
     {                                                      \