Task management still not working
The DHT task (or whatever is called later) isn't actually re-entering (I think that's the right term?)
This commit is contained in:
15
main/main.c
15
main/main.c
@@ -7,13 +7,14 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
//#include "freertos/projdefs.h"
|
||||
#include "freertos/projdefs.h"
|
||||
#include "freertos/projdefs.h"
|
||||
#include "freertos/task.h"
|
||||
#include "dht22.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_wifi.h"
|
||||
#include "portmacro.h"
|
||||
#include "nvs_flash.h"
|
||||
|
||||
static const char *TAG = "YASPAM";
|
||||
|
||||
@@ -49,6 +50,7 @@ void save_measurements() {
|
||||
pdFALSE,
|
||||
pdFALSE,
|
||||
portMAX_DELAY);
|
||||
|
||||
if (bits & SENSOR_DHT22_BIT) {
|
||||
deci_percent rh = dht22_relative_humidity();
|
||||
deci_degrees_c temp = dht22_temperature();
|
||||
@@ -57,6 +59,7 @@ void save_measurements() {
|
||||
ESP_LOGI(TAG, "Saved DHT data");
|
||||
xEventGroupClearBitsFromISR(s_monitor_event_group, SENSOR_DHT22_BIT);
|
||||
}
|
||||
|
||||
if (bits & SENSOR_PMS5003_BIT) {
|
||||
ESP_LOGI(TAG, "Saved PMS data");
|
||||
// TODO
|
||||
@@ -93,12 +96,20 @@ void read_from_dht22() {
|
||||
if (xResult) {
|
||||
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(3000)); // TODO: make this a config check
|
||||
ESP_LOGI(TAG, "Hello");
|
||||
vTaskDelay(pdMS_TO_TICKS(500)); // TODO: make this a config check
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void app_main(void) {
|
||||
esp_err_t ret = nvs_flash_init();
|
||||
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
||||
ESP_ERROR_CHECK(nvs_flash_erase());
|
||||
ret = nvs_flash_init();
|
||||
}
|
||||
ESP_ERROR_CHECK(ret);
|
||||
|
||||
s_monitor_event_group = xEventGroupCreate();
|
||||
|
||||
xTaskCreate(read_from_dht22,
|
||||
|
||||
Reference in New Issue
Block a user