|
@@ -68,7 +68,7 @@ QueueHandle_t Send_Data_queue; //发送链表任务
|
|
|
|
|
|
SemaphoreHandle_t button_semaphore; //刷新屏幕时都得加上按键互斥锁
|
|
|
|
|
|
-SemaphoreHandle_t screen_semaphore; //刷新屏幕时都得加上互斥锁
|
|
|
+// SemaphoreHandle_t screen_semaphore; //刷新屏幕时都得加上互斥锁
|
|
|
|
|
|
|
|
|
|
|
@@ -358,7 +358,7 @@ void app_init()
|
|
|
//charge_init();
|
|
|
//decection_charging_init();
|
|
|
|
|
|
- screen_queue = xQueueCreate(10, sizeof(bool));
|
|
|
+ screen_queue = xQueueCreate(25, sizeof(bool));
|
|
|
|
|
|
|
|
|
lora_data_queue = xQueueCreate(20, sizeof(LORA_DATA_T));
|
|
@@ -367,7 +367,7 @@ void app_init()
|
|
|
|
|
|
button_Data_queue = xQueueCreate(10, sizeof(uint8_t));
|
|
|
|
|
|
- screen_semaphore = xSemaphoreCreateMutex();
|
|
|
+ // screen_semaphore = xSemaphoreCreateMutex();
|
|
|
screen_event = xEventGroupCreate();
|
|
|
// button_semaphore = xSemaphoreCreateMutex();
|
|
|
|
|
@@ -465,9 +465,13 @@ if(last_paint_buf_right!=NULL)
|
|
|
{
|
|
|
|
|
|
adc1_init();
|
|
|
- extern void dis_right_instructions();
|
|
|
- dis_right_instructions();
|
|
|
-
|
|
|
+ // extern void dis_right_instructions();
|
|
|
+ // dis_right_instructions();
|
|
|
+ bool is_left = false;
|
|
|
+ if(xQueueSend(screen_queue,&is_left,portMAX_DELAY) != true)
|
|
|
+ {
|
|
|
+ ESP_LOGE(LOG_TAG,"queue:screen_queue");
|
|
|
+ }
|
|
|
int power_key = 0;
|
|
|
int charge_key = 0;
|
|
|
|
|
@@ -485,7 +489,7 @@ if(last_paint_buf_right!=NULL)
|
|
|
Machine_info.batt_precent = read_battery_voltage();
|
|
|
|
|
|
Machine_info.last_batt_precent = Machine_info.batt_precent;
|
|
|
-
|
|
|
+ is_left = false;
|
|
|
while(1)
|
|
|
{
|
|
|
//value++;
|
|
@@ -514,9 +518,13 @@ if(last_paint_buf_right!=NULL)
|
|
|
{
|
|
|
printf("charge_key is %s\r\n",!charge_key?"charge in":"charge out");
|
|
|
|
|
|
- extern void dis_right_instructions();
|
|
|
- dis_right_instructions();
|
|
|
-
|
|
|
+ // extern void dis_right_instructions();
|
|
|
+ // dis_right_instructions();
|
|
|
+ is_left = false;
|
|
|
+ if(xQueueSend(screen_queue,&is_left,portMAX_DELAY) != true)
|
|
|
+ {
|
|
|
+ ESP_LOGE(LOG_TAG,"queue:screen_queue");
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -1101,16 +1109,22 @@ static void screen_task(void* arg)
|
|
|
ESP_LOGW(LOG_TAG,"screen_task %d",reson);
|
|
|
if ((reson != ESP_SLEEP_WAKEUP_ULP) && (reson != ESP_SLEEP_WAKEUP_TIMER)&&(reson != ESP_SLEEP_WAKEUP_EXT0))
|
|
|
{
|
|
|
- Paint_leftScreen_main_powerOn();
|
|
|
- Paint_rightScreen_main_powerON();
|
|
|
+ // Paint_leftScreen_main_powerOn();
|
|
|
+ // Paint_rightScreen_main_powerON();
|
|
|
+ Paint_leftScreen(Machine_info.power_status,Machine_info.paired,false,false);
|
|
|
+ Paint_rightScreen(Machine_info.power_status,Machine_info.paired,false,false);
|
|
|
}
|
|
|
else if(reson == ESP_SLEEP_WAKEUP_EXT0)
|
|
|
{
|
|
|
- //开机刷新左屏慕
|
|
|
- Paint_leftScreen_main_slow(&Machine_info);
|
|
|
- Paint_rightScreen_main_slow(&Machine_info);
|
|
|
+ //按键从深睡唤醒,开机刷新屏慕
|
|
|
+ ESP_LOGW(LOG_TAG,"按键从深睡唤醒,开机刷新屏慕");
|
|
|
+ // Paint_leftScreen_main_slow(&Machine_info);
|
|
|
+ // Paint_rightScreen_main_slow(&Machine_info);
|
|
|
+ Paint_leftScreen(Machine_info.power_status,Machine_info.paired,false,false);
|
|
|
+ Paint_rightScreen(Machine_info.power_status,Machine_info.paired,false,false);
|
|
|
}
|
|
|
bool is_left = false;
|
|
|
+ Machine_info.left_current_Quick_refresh_time = 1;//开机慢刷
|
|
|
while(1)
|
|
|
{
|
|
|
if(xQueueReceive(screen_queue, &is_left,(TickType_t)portMAX_DELAY))
|
|
@@ -1122,17 +1136,27 @@ static void screen_task(void* arg)
|
|
|
if(Machine_info.left_current_Quick_refresh_time >= Machine_info.left_max_Quick_refresh_time)
|
|
|
{
|
|
|
Machine_info.left_current_Quick_refresh_time = 0;
|
|
|
- Paint_leftScreen_main_slow(&Machine_info);
|
|
|
+ // Paint_leftScreen_main_slow(&Machine_info);
|
|
|
+ Paint_leftScreen(Machine_info.power_status,Machine_info.paired,false,false);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
Machine_info.left_current_Quick_refresh_time++;
|
|
|
- Paint_leftScreen_main_quick(&Machine_info);
|
|
|
+ // Paint_leftScreen_main_quick(&Machine_info);
|
|
|
+ Paint_leftScreen(Machine_info.power_status,Machine_info.paired,true,false);
|
|
|
}
|
|
|
}
|
|
|
else//刷右屏
|
|
|
{
|
|
|
- Paint_rightScreen_main_slow(&Machine_info);
|
|
|
+ if(Machine_info.right_current_Quick_refresh_time == 0)
|
|
|
+ {
|
|
|
+ Machine_info.left_current_Quick_refresh_time = 1;
|
|
|
+ Paint_rightScreen(Machine_info.power_status,Machine_info.paired,true,false);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Paint_rightScreen(Machine_info.power_status,Machine_info.paired,false,false);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if((Machine_info.power_status == 1)&&(Machine_info.paired == 1))
|
|
@@ -1192,6 +1216,7 @@ static void button_task(void* arg)
|
|
|
#endif
|
|
|
if(button_info < 0x12) //左屏慕按键
|
|
|
{
|
|
|
+ // print_lora();//按键查询lora配置
|
|
|
if(Machine_info.btn_dis_flag[button_info-1] == false)
|
|
|
{
|
|
|
printf("按键关闭,默认运行\n");
|
|
@@ -1347,9 +1372,20 @@ static void button_task(void* arg)
|
|
|
if(Machine_info.power_status == 1) //开机状态
|
|
|
{
|
|
|
Machine_info.power_status = 0;
|
|
|
- dis_instructions();
|
|
|
- vTaskDelay(1000 / portTICK_PERIOD_MS);
|
|
|
- sleep_timer_start(100); //开始进入倒计时休眠
|
|
|
+ // dis_instructions();
|
|
|
+
|
|
|
+ // bool is_left = true;
|
|
|
+ // if(xQueueSend(screen_queue,&is_left,portMAX_DELAY) != true)
|
|
|
+ // {
|
|
|
+ // ESP_LOGE(LOG_TAG,"queue:screen_queue");
|
|
|
+ // }
|
|
|
+ // is_left = false;
|
|
|
+ // if(xQueueSend(screen_queue,&is_left,portMAX_DELAY) != true)
|
|
|
+ // {
|
|
|
+ // ESP_LOGE(LOG_TAG,"queue:screen_queue");
|
|
|
+ // }
|
|
|
+ // vTaskDelay(1000 / portTICK_PERIOD_MS);
|
|
|
+ // sleep_timer_start(100); //开始进入倒计时休眠
|
|
|
|
|
|
printf("last power on current power off ready sleep\r\n");
|
|
|
// sleep_timer_start(100); //开始进入倒计时休眠 //更改为刷完两个屏幕,倒计时
|
|
@@ -1373,16 +1409,42 @@ static void button_task(void* arg)
|
|
|
uart_sleep_out_config();
|
|
|
|
|
|
|
|
|
- Paint_leftScreen_main_slow(&Machine_info);
|
|
|
- Paint_rightScreen_main_slow(&Machine_info);
|
|
|
+ // Paint_leftScreen_main_slow(&Machine_info);
|
|
|
+ // Paint_rightScreen_main_slow(&Machine_info);
|
|
|
// Paint_leftScreen_main_quick(&Machine_info);
|
|
|
// Paint_rightScreen_main_quick(&Machine_info);
|
|
|
+ // dis_instructions();
|
|
|
+ // bool is_left = true;
|
|
|
+ // if(xQueueSend(screen_queue,&is_left,portMAX_DELAY) != true)
|
|
|
+ // {
|
|
|
+ // ESP_LOGE(LOG_TAG,"queue:screen_queue");
|
|
|
+ // }
|
|
|
+ // is_left = false;
|
|
|
+ // if(xQueueSend(screen_queue,&is_left,portMAX_DELAY) != true)
|
|
|
+ // {
|
|
|
+ // ESP_LOGE(LOG_TAG,"queue:screen_queue");
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if( (Machine_info.power_status == 1) && (Machine_info.paired == 1))
|
|
|
+ // {
|
|
|
+ // //判断当前开机 是否配对 继续执行时间片操作
|
|
|
+ // sleep_timer_start(100); //开始进入倒计时休眠
|
|
|
+ // }
|
|
|
+ }
|
|
|
|
|
|
- if( (Machine_info.power_status == 1) && (Machine_info.paired == 1))
|
|
|
- {
|
|
|
- //判断当前开机 是否配对 继续执行时间片操作
|
|
|
- sleep_timer_start(100); //开始进入倒计时休眠
|
|
|
- }
|
|
|
+ is_left = true;
|
|
|
+ if(xQueueSend(screen_queue,&is_left,portMAX_DELAY) != true)
|
|
|
+ {
|
|
|
+ ESP_LOGE(LOG_TAG,"queue:screen_queue");
|
|
|
+ }
|
|
|
+ is_left = false;
|
|
|
+ if(xQueueSend(screen_queue,&is_left,portMAX_DELAY) != true)
|
|
|
+ {
|
|
|
+ ESP_LOGE(LOG_TAG,"queue:screen_queue");
|
|
|
+ }
|
|
|
+ if(Machine_info.paired || !Machine_info.power_status)
|
|
|
+ {
|
|
|
+ sleep_timer_start(100); //开始进入倒计时休眠
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1788,238 +1850,3 @@ void read_deal_data_callback_handler()
|
|
|
|
|
|
#endif
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// #define MY_DISP_HOR_RES 648
|
|
|
-// #define MY_DISP_VER_RES 480
|
|
|
-// #define DISP_BUF_SIZE (480 * 648)
|
|
|
-
|
|
|
-
|
|
|
-// volatile bool disp_flush_enabled = true;
|
|
|
-
|
|
|
-// /* Enable updating the screen (the flushing process) when disp_flush() is called by LVGL
|
|
|
-// */
|
|
|
-// void disp_enable_update(void)
|
|
|
-// {
|
|
|
-// disp_flush_enabled = true;
|
|
|
-// }
|
|
|
-
|
|
|
-// /* Disable updating the screen (the flushing process) when disp_flush() is called by LVGL
|
|
|
-// */
|
|
|
-// void disp_disable_update(void)
|
|
|
-// {
|
|
|
-// disp_flush_enabled = false;
|
|
|
-// }
|
|
|
-
|
|
|
-// /*Flush the content of the internal buffer the specific area on the display.
|
|
|
-// *`px_map` contains the rendered image as raw pixel map and it should be copied to `area` on the display.
|
|
|
-// *You can use DMA or any hardware acceleration to do this operation in the background but
|
|
|
-// *'lv_display_flush_ready()' has to be called when it's finished.*/
|
|
|
-
|
|
|
-
|
|
|
-// void disp_driver_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_map)
|
|
|
-// // static void disp_flush(lv_display_t * disp_drv, const lv_area_t * area, lv_color_t * px_map)
|
|
|
-// {
|
|
|
-// //printf("-------------------disp_flush \r\n");
|
|
|
-// if(disp_flush_enabled) {
|
|
|
-// /*The most simple case (but also the slowest) to put all pixels to the screen one-by-one*/
|
|
|
-// int32_t x;
|
|
|
-// int32_t y;
|
|
|
-// printf("%d,%d,%d,%d\r\n",area->x1, area->y1, area->x2, area->y2);
|
|
|
-// epd_partial_cache1( area->x1, area->y1, area->x2, area->y2,SCREEN_LEFT,color_map);
|
|
|
-// epd_powerOn_refresh(SCREEN_LEFT);
|
|
|
-// #if 0
|
|
|
-// for(y = area->y1; y <= area->y2; y++) {
|
|
|
-// for(x = area->x1; x <= area->x2; x++) {
|
|
|
-// printf("%ld,%ld\r\n",x,y);
|
|
|
-// /*Put a pixel to the display. For example:*/
|
|
|
-// /*put_px(x, y, *px_map)*/
|
|
|
-// px_map++;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// #endif
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-// /*IMPORTANT!!!
|
|
|
-// *Inform the graphics library that you are ready with the flushing*/
|
|
|
-// #if 0
|
|
|
-// lv_display_flush_ready(disp_drv);
|
|
|
-// #else
|
|
|
-
|
|
|
-// lv_disp_flush_ready(drv);
|
|
|
-// #endif
|
|
|
-// }
|
|
|
-
|
|
|
-// #if 0
|
|
|
-// static uint8_t *buf_3_1;
|
|
|
-// static uint8_t *buf_3_2;
|
|
|
-// #else
|
|
|
-// static uint8_t *buf;
|
|
|
-// #endif
|
|
|
-
|
|
|
-
|
|
|
-// static void gui_task(void* pvParameter)
|
|
|
-// {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// #if 0
|
|
|
-// lv_init();
|
|
|
-
|
|
|
-// //buf= heap_caps_malloc(DISP_BUF_SIZE * sizeof(lv_color_t), MALLOC_CAP_DMA|MALLOC_CAP_SPIRAM);
|
|
|
-// //assert(buf != NULL);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// /*------------------------------------
|
|
|
-// * Create a display and set a flush_cb
|
|
|
-// * -----------------------------------*/
|
|
|
-// lv_display_t * disp = lv_display_create(MY_DISP_HOR_RES, MY_DISP_VER_RES);
|
|
|
-// lv_display_set_flush_cb(disp, disp_flush);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// /* Example 3
|
|
|
-// * Two buffers screen sized buffer for double buffering.
|
|
|
-// * Both LV_DISPLAY_RENDER_MODE_DIRECT and LV_DISPLAY_RENDER_MODE_FULL works, see their comments*/
|
|
|
-
|
|
|
-// buf_3_1= heap_caps_malloc(MY_DISP_HOR_RES *MY_DISP_VER_RES, MALLOC_CAP_8BIT);
|
|
|
-// buf_3_2= heap_caps_malloc(MY_DISP_HOR_RES *MY_DISP_VER_RES, MALLOC_CAP_8BIT);
|
|
|
-
|
|
|
-// if(buf_3_1 ==NULL)
|
|
|
-// {
|
|
|
-// printf("-------------------buf_3_1 \r\n");
|
|
|
-
|
|
|
-// }
|
|
|
-
|
|
|
-// if(buf_3_2 ==NULL)
|
|
|
-// {
|
|
|
-// printf("-------------------buf_3_2 \r\n");
|
|
|
-
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// lv_display_set_draw_buffers(disp, buf_3_1, buf_3_2, sizeof(buf_3_1)*MY_DISP_HOR_RES *MY_DISP_VER_RES, LV_DISPLAY_RENDER_MODE_DIRECT);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// lv_theme_t * th = lv_theme_mono_init(disp, true, &lv_font_montserrat_14);
|
|
|
-
|
|
|
-// bool is = lv_theme_mono_is_inited();
|
|
|
-
|
|
|
-// if(is)printf("========================ok=================\r\n");
|
|
|
-// else printf("========================fail=================\r\n");
|
|
|
-
|
|
|
-
|
|
|
-// lv_disp_set_theme(disp, th); /*Assign the theme to the display*/
|
|
|
-
|
|
|
-// /*Create a white label, set its text and align it to the center*/
|
|
|
-// lv_obj_t * label = lv_label_create(lv_scr_act());
|
|
|
-// lv_label_set_text(label, "Hello world");
|
|
|
-// lv_obj_set_style_text_color(lv_scr_act(), lv_color_hex(0xffffff), LV_PART_MAIN);
|
|
|
-// lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// #else
|
|
|
-
|
|
|
-// lv_init();
|
|
|
-// //disp_driver_init();
|
|
|
-// static lv_disp_draw_buf_t disp_buf;
|
|
|
-
|
|
|
-// uint32_t size_in_px = DISP_BUF_SIZE;
|
|
|
-
|
|
|
-// buf= heap_caps_malloc(MY_DISP_HOR_RES *MY_DISP_VER_RES, MALLOC_CAP_8BIT);
|
|
|
-
|
|
|
-
|
|
|
-// lv_disp_draw_buf_init(&disp_buf, buf, NULL, size_in_px);
|
|
|
-
|
|
|
-// lv_disp_drv_t disp_drv;
|
|
|
-// lv_disp_drv_init(&disp_drv);
|
|
|
-
|
|
|
-// disp_drv.flush_cb = disp_driver_flush;
|
|
|
-// disp_drv.hor_res = 648;
|
|
|
-// disp_drv.ver_res = 480;
|
|
|
-// disp_drv.full_refresh = 1;
|
|
|
-// disp_drv.draw_buf = &disp_buf;
|
|
|
-
|
|
|
-// lv_disp_t * disp = lv_disp_drv_register(&disp_drv);
|
|
|
-
|
|
|
-
|
|
|
-// lv_disp_rot_t dir = lv_disp_get_rotation(disp);
|
|
|
-// lv_disp_set_rotation(disp, LV_DISP_ROT_180);
|
|
|
-
|
|
|
-// printf("dir=%d\r\n",dir);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// /*Create a white label, set its text and align it to the center*/
|
|
|
-// lv_obj_t * label = lv_label_create(lv_scr_act());
|
|
|
-// lv_label_set_text(label, "Hello world");
|
|
|
-
|
|
|
-// lv_obj_set_style_bg_color(lv_scr_act(), lv_color_make(0,0,0), 0);//设置背景颜色为白色
|
|
|
-
|
|
|
-// lv_obj_set_style_text_color(lv_scr_act(), lv_color_hex(0xffffff), LV_PART_MAIN);
|
|
|
-// lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// lv_obj_t * label1 = lv_label_create(lv_scr_act());
|
|
|
-// lv_label_set_text(label1, "world");
|
|
|
-// //lv_obj_set_style_bg_color(lv_scr_act(), lv_color_make(0,0,0), 0);//设置背景颜色为白色
|
|
|
-// lv_obj_set_style_text_color(lv_scr_act(), lv_color_hex(0xffffff), LV_PART_MAIN);
|
|
|
-// //lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
|
|
|
-// lv_obj_set_pos(label1,0,20);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// //sgf_lvgl_display(&info);
|
|
|
-// lv_refr_now(NULL);
|
|
|
-// // if (wait_second != 0) {
|
|
|
-// // ESP_LOGI(TAG, "wait=%ds", wait_second);
|
|
|
-// // vTaskDelay(pdMS_TO_TICKS(1000 * wait_second));
|
|
|
-// // }
|
|
|
-// // gpio_weekup_init_s(sleep_second);
|
|
|
-
|
|
|
-
|
|
|
-// #endif
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// //lv_refr_now(disp);
|
|
|
-// for(;;) {
|
|
|
-
|
|
|
-// lv_tick_inc(10); /*Use a not round number to cover more anim states */
|
|
|
-// lv_timer_handler();
|
|
|
-// vTaskDelay(10 / portTICK_PERIOD_MS);
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|