working code, not sure about quality
This commit is contained in:
25
main/main.c
25
main/main.c
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <esp_http_server.h>
|
#include <esp_http_server.h>
|
||||||
#include "bme280.h"
|
#include "bme280.h"
|
||||||
|
#include "dht22.h"
|
||||||
|
|
||||||
static const char *TAG = "BME280";
|
static const char *TAG = "BME280";
|
||||||
|
|
||||||
@@ -34,6 +35,27 @@ int8_t bme280_readout();
|
|||||||
int8_t lastReadoutStatus = 1;
|
int8_t lastReadoutStatus = 1;
|
||||||
extern struct bme280_dev bme280; // from bme280_sup.c
|
extern struct bme280_dev bme280; // from bme280_sup.c
|
||||||
|
|
||||||
|
void DHT_task(void *pvParameter)
|
||||||
|
{
|
||||||
|
setDHTgpio( 32 );
|
||||||
|
printf( "Starting DHT Task\n\n");
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
|
||||||
|
printf("=== Reading DHT ===\n" );
|
||||||
|
int ret = readDHT();
|
||||||
|
|
||||||
|
errorHandler(ret);
|
||||||
|
|
||||||
|
printf( "Hum %.1f\n", getHumidity() );
|
||||||
|
printf( "Tmp %.1f\n", getTemperature() );
|
||||||
|
|
||||||
|
// -- wait at least 2 sec before reading again ------------
|
||||||
|
// The interval of whole process must be beyond 2 seconds !!
|
||||||
|
vTaskDelay( 3000 / portTICK_RATE_MS );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void app_main(void)
|
void app_main(void)
|
||||||
{
|
{
|
||||||
static httpd_handle_t server = NULL;
|
static httpd_handle_t server = NULL;
|
||||||
@@ -69,6 +91,9 @@ void app_main(void)
|
|||||||
/* lastReadoutStatus = bme280_readout(); */
|
/* lastReadoutStatus = bme280_readout(); */
|
||||||
/* vTaskDelay(1600/portTICK_PERIOD_MS); */
|
/* vTaskDelay(1600/portTICK_PERIOD_MS); */
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
|
vTaskDelay( 1000 / portTICK_RATE_MS );
|
||||||
|
xTaskCreate( &DHT_task, "DHT_task", 2048, NULL, 5, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bme280_data comp_data;
|
struct bme280_data comp_data;
|
||||||
|
|||||||
Reference in New Issue
Block a user