1
0
Weather_ESP/main/main.c

40 lines
930 B
C

#include "display.h"
#include "sensors.h"
#include "wifi.h"
#include "server.h"
#include "clock.h"
#include <esp_log.h>
void app_main(void)
{
int32_t temp = -12;
uint32_t pressure = 0;
uint32_t humidity = 0;
int32_t temp2 = 0;
uint32_t pressure2 = 0;
uint32_t humidity2 = 0;
time_str_t time;
init_sensors();
init_display();
init_wifi_sta();
init_server();
init_clock();
/* Draw the whole screen one time */
get_time(&time);
read_sensor(&temp, &pressure, &humidity);
read_sensor2(&temp2, &pressure2, &humidity2);
display_data(temp, pressure, humidity, temp2, pressure2, humidity2, time);
while (1) {
get_time(&time);
read_sensor(&temp, &pressure, &humidity);
read_sensor2(&temp2, &pressure2, &humidity2);
server_set_values(temp, pressure, humidity, temp2, pressure2, humidity2);
update_data(temp, pressure, humidity, temp2, pressure2, humidity2, time);
vTaskDelay(500 / portTICK_PERIOD_MS);
}
}