The reading doesn't work with WiFi enabled
Just get timing errors
This commit is contained in:
17
main/main.c
17
main/main.c
@@ -65,21 +65,18 @@ uint32_t num_samples_last_ten_mins = 0;
|
||||
void read_from_dht22() {
|
||||
// From datasheet:
|
||||
// Don't start within 1 second of powering on
|
||||
// vTaskDelay(pdMS_TO_TICKS(2000)); FIXME - still doesn't actually fix the problem though
|
||||
// FIXME - still doesn't actually fix the problem though
|
||||
//vTaskDelay(pdMS_TO_TICKS(20000));
|
||||
|
||||
while (run_dht) {
|
||||
// Data reading is based on time, so need to block interrups etc
|
||||
// I _think_ these are freeRTOS task interrupts - I wonder if
|
||||
// I need to also block ESP interrupts? Should I even do that?
|
||||
portDISABLE_INTERRUPTS();
|
||||
int ret = dht22_read();
|
||||
portENABLE_INTERRUPTS();
|
||||
if (ret != DHT22_OK) {
|
||||
dht22_handle_error(ret);
|
||||
} else {
|
||||
|
||||
latest_datapoint.temp = dht22_temperature();
|
||||
latest_datapoint.rh = dht22_relative_humidity();
|
||||
ESP_LOGW(TAG, "%f & %f", latest_datapoint.temp / 10.0, latest_datapoint.rh / 10.0 );
|
||||
ESP_LOGW(TAG, "temperature: %f & relative humidity: %f",
|
||||
latest_datapoint.temp / 10.0, latest_datapoint.rh / 10.0 );
|
||||
|
||||
if (has_ntp_time_obtained_once()) {
|
||||
// I _think_ I only want to be doing that rolling average and saving
|
||||
@@ -146,7 +143,7 @@ void app_main(void) {
|
||||
|
||||
#ifdef CONFIG_DHT22_ENABLED
|
||||
xTaskCreate(read_from_dht22, "DHT22",
|
||||
8 * 1024, // honestly I have _no_ idea
|
||||
4 * 1024, // honestly I have _no_ idea
|
||||
NULL,
|
||||
5, // no idea either
|
||||
&dht22_handle);
|
||||
@@ -162,6 +159,6 @@ void app_main(void) {
|
||||
&pms5003_handle);
|
||||
|
||||
#endif /* CONFIG_PMS5003_ENABLED */
|
||||
start_wifi();
|
||||
|
||||
//start_wifi();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user