Created
September 20, 2021 09:25
-
-
Save Rajssss/27d5af83619724f81428848c8420c17f to your computer and use it in GitHub Desktop.
airpurifier ui param update
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <time.h> | |
#include "datoms_airpurifier_main.h" | |
#include "main_screen.h" | |
void datoms_test_param_update(void); | |
void humidity_update_param(lv_task_t *task); | |
void pm_update_param(lv_task_t *task); | |
void tvoc_update_param(lv_task_t *task); | |
void co2_update_param(lv_task_t *task); | |
void no2_update_param(lv_task_t *task); | |
void so2_update_param(lv_task_t *task); | |
void aqi_update_param(lv_task_t *task); | |
void temp_update_param(lv_task_t *task); | |
void statusbar_update_param(lv_task_t *task); | |
void time_update_param(lv_task_t *task); | |
void date_update_param(lv_task_t *task); | |
void err_update_param(lv_task_t *task); | |
lv_task_t *humidity_up_task; | |
lv_task_t *pm_up_task; | |
lv_task_t *tvoc_up_task; | |
lv_task_t *co2_up_task; | |
lv_task_t *no2_up_task; | |
lv_task_t *so2_up_task; | |
lv_task_t *aqi_up_task; | |
lv_task_t *temp_up_task; | |
lv_task_t *statusbar_up_task; | |
lv_task_t *time_up_task; | |
lv_task_t *date_up_task; | |
lv_task_t *err_up_task; | |
void main() | |
{ | |
datoms_test_param_update(); | |
} | |
void datoms_test_param_update(void) | |
{ | |
humidity_up_task = lv_task_create(humidity_update_param, 2000, LV_TASK_PRIO_MID, NULL); | |
pm_up_task = lv_task_create(pm_update_param, 1100, LV_TASK_PRIO_MID, NULL); | |
tvoc_up_task = lv_task_create(tvoc_update_param, 1500, LV_TASK_PRIO_MID, NULL); | |
co2_up_task = lv_task_create(co2_update_param, 600, LV_TASK_PRIO_MID, NULL); | |
no2_up_task = lv_task_create(no2_update_param, 3000, LV_TASK_PRIO_MID, NULL); | |
so2_up_task = lv_task_create(so2_update_param, 1100, LV_TASK_PRIO_MID, NULL); | |
aqi_up_task = lv_task_create(aqi_update_param, 1800, LV_TASK_PRIO_MID, NULL); | |
temp_up_task = lv_task_create(temp_update_param, 2100, LV_TASK_PRIO_MID, NULL); | |
statusbar_up_task = lv_task_create(statusbar_update_param, 250, LV_TASK_PRIO_MID, NULL); | |
time_up_task = lv_task_create(time_update_param, 100, LV_TASK_PRIO_MID, NULL); | |
date_up_task = lv_task_create(date_update_param, 100, LV_TASK_PRIO_MID, NULL); | |
err_up_task = lv_task_create(err_update_param, 100, LV_TASK_PRIO_MID, NULL); | |
} | |
void humidity_update_param(lv_task_t *task) | |
{ | |
gui_update_param(PARAM_HUMIDITY, (rand()%PARAM_HUMIDITY_MAX_VAL), SET_POINT_DEFAULT_HUMIDITY); | |
} | |
void pm_update_param(lv_task_t *task) | |
{ | |
gui_update_param(PARAM_PM2_5, (rand()%PARAM_PM2_5_MAX_VAL), SET_POINT_DEFAULT_PM2_5); | |
} | |
void tvoc_update_param(lv_task_t *task) | |
{ | |
gui_update_param(PARAM_TVOC, (rand()%PARAM_TVOC_MAX_VAL), SET_POINT_DEFAULT_TVOC); | |
} | |
void co2_update_param(lv_task_t *task) | |
{ | |
gui_update_param(PARAM_CO2, (rand()%PARAM_CO2_MAX_VAL), SET_POINT_DEFAULT_CO2); | |
} | |
void no2_update_param(lv_task_t *task) | |
{ | |
gui_update_param(PARAM_NO2, (rand()%PARAM_NO2_MAX_VAL), SET_POINT_DEFAULT_NO2); | |
} | |
void so2_update_param(lv_task_t *task) | |
{ | |
gui_update_param(PARAM_SO2, (rand()%PARAM_SO2_MAX_VAL), SET_POINT_DEFAULT_SO2); | |
} | |
void aqi_update_param(lv_task_t *task) | |
{ | |
gui_update_param(PARAM_AQI, (rand()%PARAM_AQI_MAX_VAL), SET_POINT_DEFAULT_AQI); | |
} | |
void temp_update_param(lv_task_t *task) | |
{ | |
gui_update_param(PARAM_TEMP, (rand()%85), SET_POINT_DEFAULT_TEMP); | |
} | |
void statusbar_update_param(lv_task_t *task) | |
{ | |
static uint8_t flag=0; | |
gui_update_statusbar(flag); | |
flag++; | |
if(flag == 13) | |
{ | |
flag = 0; | |
} | |
} | |
void time_update_param(lv_task_t *task) | |
{ | |
static uint8_t hr = 0, min = 0; | |
gui_update_time(hr, min); | |
hr++; min++; | |
if(hr == 24) | |
hr = 0; | |
if(min == 60) | |
min = 0; | |
} | |
void date_update_param(lv_task_t *task) | |
{ | |
static uint8_t day = 1, day_in_week = DAY_SUN, month = MONTH_JAN; | |
gui_update_date(day, day_in_week, month); | |
day++; day_in_week++; month++; | |
if(day == 32) | |
day = 1; | |
if(day_in_week == 8) | |
day_in_week = 1; | |
if(month == 13) | |
month = 1; | |
} | |
void err_update_param(lv_task_t *task) | |
{ | |
static uint8_t err = 0; | |
gui_update_error(err); | |
err++; | |
if(err == 6) | |
err = 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment