5 |
5 |
6 #include "config.h" |
6 #include "config.h" |
7 |
7 |
8 static const char *TAG = "iotbalkon"; |
8 static const char *TAG = "iotbalkon"; |
9 |
9 |
10 #define State_Init 0 |
10 /* |
11 #define State_Connect 1 |
11 * Main State table. |
12 #define State_Working 2 |
12 */ |
13 #define State_WorkDone 3 |
13 typedef enum { |
14 #define State_Stop 4 |
14 State_Init = 0, |
15 #define State_Wait 5 |
15 State_Connect, |
16 #define State_Measure 6 |
16 State_Working, |
17 #define State_GoSleep 7 |
17 State_WorkDone, |
|
18 State_Stop, |
|
19 State_Wait, |
|
20 State_Measure, |
|
21 State_GoSleep |
|
22 } Main_State; |
18 |
23 |
19 |
24 |
20 static TaskHandle_t xTaskBMP280 = NULL; |
25 static TaskHandle_t xTaskBMP280 = NULL; |
21 static TaskHandle_t xTaskINA219 = NULL; |
26 static TaskHandle_t xTaskINA219 = NULL; |
22 static TaskHandle_t xTaskAPDS9930 = NULL; |
27 static TaskHandle_t xTaskAPDS9930 = NULL; |
231 vTaskDelay(10 / portTICK_PERIOD_MS); |
236 vTaskDelay(10 / portTICK_PERIOD_MS); |
232 } |
237 } |
233 |
238 |
234 if (xSemaphoreTake(xSemaphoreINA219, 25) == pdTRUE) { |
239 if (xSemaphoreTake(xSemaphoreINA219, 25) == pdTRUE) { |
235 |
240 |
236 s_Volts[loopno] = ina219_state->Solar.volts + (ina219_state->Solar.shunt / 1000); |
241 s_Volts[loopno] = ina219_state->Solar.volts + ina219_state->Solar.shunt; |
237 s_Current[loopno] = ina219_state->Solar.current; |
242 s_Current[loopno] = ina219_state->Solar.current; |
238 b_Volts[loopno] = ina219_state->Battery.volts + (ina219_state->Battery.shunt / 1000); |
243 b_Volts[loopno] = ina219_state->Battery.volts + ina219_state->Battery.shunt; |
239 b_Current[loopno] = ina219_state->Battery.current; |
244 b_Current[loopno] = ina219_state->Battery.current; |
240 m_Valid[loopno] = ina219_state->valid; |
245 m_Valid[loopno] = ina219_state->valid; |
241 xSemaphoreGive(xSemaphoreINA219); |
246 xSemaphoreGive(xSemaphoreINA219); |
242 |
247 |
243 /* |
248 /* |