custom fonts and further UI reworks
This commit is contained in:
@@ -174,28 +174,37 @@ static void sensor_task(void *arg)
|
||||
{
|
||||
float temp = 0, humidity = 0;
|
||||
rtcTimeStruct_t rtc_time = {};
|
||||
int sensor_divider = 0;
|
||||
|
||||
for (;;) {
|
||||
/* Read SHTC3 */
|
||||
s_shtc3->Shtc3_Wakeup();
|
||||
vTaskDelay(pdMS_TO_TICKS(20));
|
||||
s_shtc3->Shtc3_ReadTempHumi(&temp, &humidity);
|
||||
s_shtc3->Shtc3_Sleep();
|
||||
|
||||
/* Read RTC */
|
||||
/* Read RTC every second */
|
||||
Rtc_GetTime(&rtc_time);
|
||||
|
||||
/* Read battery */
|
||||
uint8_t batt = Adc_GetBatteryLevel();
|
||||
/* Read SHTC3 + battery every 5 seconds */
|
||||
if (sensor_divider == 0) {
|
||||
s_shtc3->Shtc3_Wakeup();
|
||||
vTaskDelay(pdMS_TO_TICKS(20));
|
||||
s_shtc3->Shtc3_ReadTempHumi(&temp, &humidity);
|
||||
s_shtc3->Shtc3_Sleep();
|
||||
|
||||
/* Update UI under LVGL lock */
|
||||
uint8_t batt = Adc_GetBatteryLevel();
|
||||
|
||||
if (Lvgl_lock(100)) {
|
||||
dashboard_ui_update_local(temp, humidity, batt);
|
||||
Lvgl_unlock();
|
||||
}
|
||||
}
|
||||
sensor_divider = (sensor_divider + 1) % 5;
|
||||
|
||||
/* Update clock every second */
|
||||
if (Lvgl_lock(100)) {
|
||||
dashboard_ui_update_local(temp, humidity, batt);
|
||||
dashboard_ui_update_time(rtc_time.hour, rtc_time.minute, rtc_time.second);
|
||||
dashboard_ui_update_time(rtc_time.hour, rtc_time.minute, rtc_time.second,
|
||||
rtc_time.year, rtc_time.month, rtc_time.day,
|
||||
rtc_time.week);
|
||||
Lvgl_unlock();
|
||||
}
|
||||
|
||||
vTaskDelay(pdMS_TO_TICKS(5000));
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user