DHT22 is not working how I want it to
Need to keep debugging it... think of a different way to approach it maybe
This commit is contained in:
@@ -70,6 +70,7 @@ void read_from_dht22() {
|
||||
portDISABLE_INTERRUPTS();
|
||||
int ret = dht22_read();
|
||||
portENABLE_INTERRUPTS();
|
||||
ESP_LOGE(TAG, "dht_ret: %i", ret);
|
||||
if (ret != DHT22_OK) {
|
||||
dht22_handle_error(ret);
|
||||
} else {
|
||||
@@ -79,8 +80,8 @@ void read_from_dht22() {
|
||||
if (has_ntp_time_obtained_once()) {
|
||||
// I _think_ I only want to be doing that rolling average and saving
|
||||
// if/when we've got an actual time to do that with. I think that'd
|
||||
// avoid some weird bugs (time changing from 1970 -> current time within
|
||||
// a 10 min period)
|
||||
// avoid some weird bugs (e.g. time changing from 1970 -> current time within
|
||||
// a 10 min period or just saving data saying it's from the 70s)
|
||||
|
||||
if (num_samples_last_ten_mins == 0) {
|
||||
ten_minute_rolling_average.rh = latest_datapoint.rh;
|
||||
@@ -100,7 +101,7 @@ void read_from_dht22() {
|
||||
// samples per 10 minutes than can be stored in a uint32 - I'll
|
||||
// calculate what that is and perhaps raise a compile error if too high.
|
||||
if (num_samples_last_ten_mins >=
|
||||
(CONFIG_DHT22_PERIOD_POLL * 1000 * 60 * 10)) {
|
||||
((uint32_t) CONFIG_DHT22_PERIOD_POLL * 1000 * 60 * 10)) {
|
||||
num_samples_last_ten_mins = 0;
|
||||
|
||||
time_t epoch;
|
||||
@@ -158,5 +159,5 @@ void app_main(void) {
|
||||
|
||||
#endif /* CONFIG_PMS5003_ENABLED */
|
||||
|
||||
start_wifi();
|
||||
//start_wifi();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user