oled v1
This commit is contained in:
@@ -12,20 +12,26 @@
|
||||
#include "ygg_bmp280.h"
|
||||
#include "ygg_http_req.h"
|
||||
#include "ygg_state.h"
|
||||
#include "ygg_sh1106.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
|
||||
static const char *TAG = "thermo_sensor";
|
||||
static lv_display_t *sh_display = NULL;
|
||||
static lv_obj_t *label = NULL;
|
||||
bmp280_t dev_bmp_280;
|
||||
|
||||
void main_loop(void *pvParameters) {
|
||||
// Wait 1s, to avoid corrupted first sensor readout
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
while (1) {
|
||||
lv_timer_handler();
|
||||
ygg_bmp280_read_sensor(&dev_bmp_280);
|
||||
ygg_send_sensor_readouts(BASE_URL,
|
||||
SENSOR_NAME,
|
||||
CURR_READOUT);
|
||||
vTaskDelay(pdMS_TO_TICKS(10000));
|
||||
ygg_set_display_label(sh_display, label, "ANOTHER");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +63,12 @@ void app_main()
|
||||
httpd_register_uri_handler(server, &ygg_hum_uri);
|
||||
|
||||
ESP_ERROR_CHECK(i2cdev_init());
|
||||
|
||||
sh_display = ygg_sh1106_init();
|
||||
lv_obj_t *scr = lv_display_get_screen_active(sh_display);
|
||||
label = lv_label_create(scr);
|
||||
ygg_set_display_label(sh_display, label, "FIRST");
|
||||
|
||||
ygg_bmp280_init(&dev_bmp_280);
|
||||
xTaskCreatePinnedToCore(main_loop, "bmp280_test", configMINIMAL_STACK_SIZE * 8, NULL, 5, NULL, APP_CPU_NUM);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user