sggt/App/APP_WU/Src/apps_gather.c

371 lines
8.9 KiB
C

/*
* @Author: wujunchao wujunchao@wuxismart.com
* @Date: 2024-12-27 11:50:56
* @LastEditors: wujunchao wujunchao@wuxismart.com
* @LastEditTime: 2025-01-09 15:17:28
* @FilePath: \signal_generator\App\APP_WU\Src\apps_gather.c
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
#include "apps_gather.h" //用于头文件打包汇总
// lv_conf.h { line:282->CPU&FPS; line:289->MEM used }
#if 1
/**********test4**********/
uint8_t scr_init_bar1 = 0, scr_init_cnt = 0, scr_init_flag = 0;
int tick_prv = -1, tick_cur = -1;
void menu_test4()
{
if(scr_init_flag == 0)
{
scr_init_run();
}else
{
scr_main_run();
}
if(key == 103)
{
key = 0;
menu_test4_reset();
}
}
void scr_init_run(void)
{
if( scr_init_cnt <= 4 )
{
if( tick_prv == -1 )
{
tick_prv = xTaskGetTickCount();
}else
{
tick_cur = xTaskGetTickCount();
if(tick_cur - tick_prv >= 1000)
{
tick_prv = -1;
tick_cur = -1;
scr_init_bar1 = scr_init_cnt*25;
lv_bar_set_value(guider_ui.screen_init_bar_1, scr_init_bar1, LV_ANIM_OFF);
scr_init_cnt ++;
}
}
}else
{
if( tick_prv == -1 )
{
tick_prv = xTaskGetTickCount();
}else
{
tick_cur = xTaskGetTickCount();
if(tick_cur - tick_prv >= 250)
{
scr_init_flag = 1;
tick_prv = -1;
tick_cur = -1;
// lv_scr_load_anim(guider_ui.screen_main, LV_SCR_LOAD_ANIM_NONE, 100, 0, 1); ?会进入错误中断,原因未知
setup_scr_screen_main(&guider_ui);
lv_scr_load(guider_ui.screen_main);
//开机动画结束后,清除该对象,释放内存
guider_ui.screen_init_del = true;
lv_obj_del(guider_ui.screen_init);
}
}
}
}
SCR_MAIN scr_main;
int nowtime_hours = 0, nowtime_minutes = 0, nowtime_seconds = 0;
void scr_main_run(void)
{
//运行时间显示
nowtime_show();
//电池电量显示
battery_show();
//曲线绘制 & 输出输入值显示
dynamic_plot();
}
void nowtime_show(void)
{
if(heart_1000ms_flag)
{
heart_1000ms_flag = 0;
nowtime_seconds++;
if(nowtime_seconds > 59)
{
nowtime_minutes++;
nowtime_seconds = 0;
}
if(nowtime_minutes > 59)
{
nowtime_hours++;
nowtime_minutes = 0;
}
if(nowtime_hours > 99)
{
nowtime_seconds = 0;
nowtime_minutes = 0;
nowtime_hours = 0;
}
sprintf(scr_main.sig_runtime, "%02d:%02d:%02d",nowtime_hours, nowtime_minutes,nowtime_seconds);
lv_span_set_text(guider_ui.screen_main_spangroup_1_span, scr_main.sig_runtime);
}
}
uint8_t bt_cnt = 0;
void battery_show(void)
{
if(battery_3000ms_flag)
{
battery_3000ms_flag = 0;
lv_img_set_src(guider_ui.screen_main_animimg_1, screen_main_animimg_1_imgs[bt_cnt]);
bt_cnt = (bt_cnt >= 5)?(0):( bt_cnt + 1);
}
}
uint8_t plot_cnt = 0;
void dynamic_plot(void)
{
if(plot_1500ms_flag)
{
plot_1500ms_flag = 0;
lv_chart_set_next_value(guider_ui.screen_main_chart_1, guider_ui.screen_main_chart_1_0, 10 * plot_cnt);
plot_cnt = (plot_cnt > 9)?(0):( plot_cnt + 1);
sprintf(scr_main.sig_data_io, "%03d.%03d", 0, 10 * plot_cnt);
lv_span_set_text(guider_ui.screen_main_spangroup_2_span, scr_main.sig_data_io);
if(plot_cnt % 2)
{
lv_span_set_text(guider_ui.screen_main_spangroup_4_span, "OUT");
}else{
lv_span_set_text(guider_ui.screen_main_spangroup_4_span, "IN");
}
}
}
void menu_test4_reset(void)
{
scr_init_flag = 0;
scr_init_bar1 = 0;
scr_init_cnt = 0;
scr_init_flag = 0;
tick_prv = -1;
tick_cur = -1;
nowtime_hours = 0;
nowtime_minutes = 0;
nowtime_seconds = 0;
bt_cnt = 0;
plot_cnt = 0;
setup_scr_screen_init(&guider_ui);
lv_scr_load(guider_ui.screen_init);
guider_ui.screen_main_del = true;
lv_obj_del(guider_ui.screen_main);
guider_ui.screen_setting_del = true;
lv_obj_del(guider_ui.screen_setting);
}
/**********test4**********/
#else
/**********test3**********/
// uint8_t scr_init_bar1 = 0, scr_init_cnt = 0, scr_init_flag = 0;
// int tick_prv = -1, tick_cur = -1;
// void menu_test3(void)
// {
// if(scr_init_flag == 0)
// {
// scr_init_run();
// }else
// {
// scr_main_run();
// }
// }
// void scr_init_run(void)
// {
// if( scr_init_cnt <= 5 )
// {
// if( tick_prv == -1 )
// {
// tick_prv = xTaskGetTickCount();
// }else
// {
// tick_cur = xTaskGetTickCount();
// if(tick_cur - tick_prv >= 1000)
// {
// tick_prv = -1;
// tick_cur = -1;
// scr_init_bar1 = scr_init_cnt*20;
// lv_bar_set_value(guider_ui.screen_init_bar_1, scr_init_bar1, LV_ANIM_OFF);
// scr_init_cnt ++;
// }
// }
// }else
// {
// if( tick_prv == -1 )
// {
// tick_prv = xTaskGetTickCount();
// }else
// {
// tick_cur = xTaskGetTickCount();
// if(tick_cur - tick_prv >= 250)
// {
// scr_init_flag = 1;
// tick_prv = -1;
// tick_cur = -1;
// // lv_scr_load_anim(guider_ui.screen_main, LV_SCR_LOAD_ANIM_FADE_OUT, 1000, 250, 1);
// init_scr_del_flag(&guider_ui);
// setup_scr_screen_main(&guider_ui);
// lv_scr_load(guider_ui.screen_main);
// }
// }
// }
// }
// uint8_t led_bri = 0;
// void scr_main_run(void)
// {
// //LED_LCD
// if( tick_prv == -1 )
// {
// tick_prv = xTaskGetTickCount();
// }else
// {
// tick_cur = xTaskGetTickCount();
// if(tick_cur - tick_prv >= 1000)
// {
// tick_prv = -1;
// tick_cur = -1;
// led_bri = (led_bri == 0)?(255):(0);
// lv_led_set_brightness(guider_ui.screen_main_led_1, led_bri);
// }
// }
// //Menu_LCD
// switch(key)
// {
// case 71:
// {
// key = 0;
// lv_event_send(guider_ui.screen_main_menu_1_cont_1, LV_EVENT_CLICKED, NULL);
// lv_meter_set_indicator_value(guider_ui.screen_main_meter_1,guider_ui.screen_main_meter_1_scale_0_ndline_0, 25);
// }
// break;
// case 79:
// {
// key = 0;
// lv_event_send(guider_ui.screen_main_menu_1_cont_2, LV_EVENT_CLICKED, NULL);
// lv_meter_set_indicator_value(guider_ui.screen_main_meter_1, guider_ui.screen_main_meter_1_scale_0_ndline_0, 50);
// }
// break;
// case 87:
// {
// key = 0;
// lv_event_send(guider_ui.screen_main_menu_1_cont_3, LV_EVENT_CLICKED, NULL);
// lv_meter_set_indicator_value(guider_ui.screen_main_meter_1, guider_ui.screen_main_meter_1_scale_0_ndline_0, 75);
// }
// break;
// case 95:
// {
// key = 0;
// scr_init_flag = 0;
// scr_init_bar1 = 0;
// scr_init_cnt = 0;
// init_scr_del_flag(&guider_ui);
// setup_scr_screen_init(&guider_ui);
// lv_scr_load(guider_ui.screen_init);
// }
// default:
// {
// }
// break;
// }
// }
/**********test3**********/
/**********test2**********/
// int bar1_v = 0, bar2_v = 0, bar3_v = 0;
// void menu_test2(void)
// {
// switch(key)
// {
// case 68:
// {
// key = 0;
// bar1_v = ( bar1_v > 90 )?( 0 ):( bar1_v + 10 );
// lv_bar_set_value(guider_ui.screen_bar_1, bar1_v, LV_ANIM_OFF);
// }
// break;
// case 69:
// {
// key = 0;
// bar2_v = ( bar2_v > 90 )?( 0 ):( bar2_v + 10 );
// lv_bar_set_value(guider_ui.screen_bar_2, bar2_v, LV_ANIM_OFF);
// }
// break;
// case 70:
// {
// key = 0;
// bar3_v = ( bar3_v > 90 )?( 0 ):( bar3_v + 10 );
// lv_bar_set_value(guider_ui.screen_bar_3, bar3_v, LV_ANIM_OFF);
// }
// break;
// default:
// {
// }
// break;
// }
// }
/**********test2**********/
#endif