Different stack trace now...
This commit is contained in:
22
main/main.c
22
main/main.c
@@ -8,6 +8,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
//#include "freertos/projdefs.h"
|
//#include "freertos/projdefs.h"
|
||||||
|
#include "freertos/projdefs.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "dht22.h"
|
#include "dht22.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
@@ -54,33 +55,44 @@ void save_measurements() {
|
|||||||
// TODO - think about how to actually store this somewhere (for pushing and/or pulling)
|
// TODO - think about how to actually store this somewhere (for pushing and/or pulling)
|
||||||
// and what sort of structures I could use
|
// and what sort of structures I could use
|
||||||
ESP_LOGI(TAG, "Saved DHT data");
|
ESP_LOGI(TAG, "Saved DHT data");
|
||||||
xEventGroupClearBits(s_monitor_event_group, SENSOR_DHT22_BIT);
|
xEventGroupClearBitsFromISR(s_monitor_event_group, SENSOR_DHT22_BIT);
|
||||||
}
|
}
|
||||||
if (bits & SENSOR_PMS5003_BIT) {
|
if (bits & SENSOR_PMS5003_BIT) {
|
||||||
ESP_LOGI(TAG, "Saved PMS data");
|
ESP_LOGI(TAG, "Saved PMS data");
|
||||||
// TODO
|
// TODO
|
||||||
xEventGroupClearBits(s_monitor_event_group, SENSOR_PMS5003_BIT);
|
xEventGroupClearBitsFromISR(s_monitor_event_group, SENSOR_PMS5003_BIT);
|
||||||
}
|
}
|
||||||
|
vTaskDelay(pdMS_TO_TICKS(100));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_from_pms5003() {
|
void read_from_pms5003() {
|
||||||
|
BaseType_t xHigherPriorityTaskWoken, xResult;
|
||||||
|
xHigherPriorityTaskWoken = pdFALSE;
|
||||||
while (run_pms5003) {
|
while (run_pms5003) {
|
||||||
// TODO - actually collect some data
|
// TODO - actually collect some data
|
||||||
ESP_LOGI(TAG, "Got PMS5003 data! Setting PMS bit now!");
|
ESP_LOGI(TAG, "Got PMS5003 data! Setting PMS bit now!");
|
||||||
xEventGroupSetBitsFromISR(s_monitor_event_group, SENSOR_PMS5003_BIT);
|
xResult = xEventGroupSetBitsFromISR(s_monitor_event_group, SENSOR_PMS5003_BIT, &xHigherPriorityTaskWoken);
|
||||||
vTaskDelay(pdMS_TO_TICKS(100)); // TODO: make this a config check
|
if (xResult) {
|
||||||
|
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
|
||||||
|
}
|
||||||
|
vTaskDelay(pdMS_TO_TICKS(1000)); // TODO: make this a config check
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_from_dht22() {
|
void read_from_dht22() {
|
||||||
|
BaseType_t xHigherPriorityTaskWoken, xResult;
|
||||||
|
xHigherPriorityTaskWoken = pdFALSE;
|
||||||
while (run_dht) {
|
while (run_dht) {
|
||||||
// Data reading is based on time, so need to block interrups etc
|
// Data reading is based on time, so need to block interrups etc
|
||||||
portDISABLE_INTERRUPTS();
|
portDISABLE_INTERRUPTS();
|
||||||
int ret = dht22_read();
|
int ret = dht22_read();
|
||||||
portENABLE_INTERRUPTS();
|
portENABLE_INTERRUPTS();
|
||||||
ESP_LOGI(TAG, "Got DHT22 data! Setting DHT bit now!");
|
ESP_LOGI(TAG, "Got DHT22 data! Setting DHT bit now!");
|
||||||
xEventGroupSetBitsFromISR(s_monitor_event_group, SENSOR_DHT22_BIT);
|
xResult = xEventGroupSetBitsFromISR(s_monitor_event_group, SENSOR_DHT22_BIT, &xHigherPriorityTaskWoken);
|
||||||
|
if (xResult) {
|
||||||
|
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
|
||||||
|
}
|
||||||
vTaskDelay(pdMS_TO_TICKS(3000)); // TODO: make this a config check
|
vTaskDelay(pdMS_TO_TICKS(3000)); // TODO: make this a config check
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user