|
@@ -10,7 +10,7 @@
|
|
#include "freertos/event_groups.h"
|
|
#include "freertos/event_groups.h"
|
|
#include "esp_timer.h"
|
|
#include "esp_timer.h"
|
|
#include "esp_err.h"
|
|
#include "esp_err.h"
|
|
-
|
|
|
|
|
|
+#include "iot_button.h"
|
|
#include "user_config.h"
|
|
#include "user_config.h"
|
|
|
|
|
|
#include "LED.h"
|
|
#include "LED.h"
|
|
@@ -829,7 +829,7 @@ if(tmp_paint_buf!=NULL)
|
|
}
|
|
}
|
|
static void screen_task(void *arg)
|
|
static void screen_task(void *arg)
|
|
{
|
|
{
|
|
- // Machine_info.rssi = 100; // 没有获取到真数据,默认100
|
|
|
|
|
|
+ Machine_info.rssi = 100; // 没有获取到真数据,默认100
|
|
int reson = is_wake_up_reson(); // 返回唤醒的原因
|
|
int reson = is_wake_up_reson(); // 返回唤醒的原因
|
|
ESP_LOGW(LOG_TAG, "screen_task %d", reson);
|
|
ESP_LOGW(LOG_TAG, "screen_task %d", reson);
|
|
if ((reson != ESP_SLEEP_WAKEUP_ULP) && (reson != ESP_SLEEP_WAKEUP_TIMER) && (reson != ESP_SLEEP_WAKEUP_EXT0))
|
|
if ((reson != ESP_SLEEP_WAKEUP_ULP) && (reson != ESP_SLEEP_WAKEUP_TIMER) && (reson != ESP_SLEEP_WAKEUP_EXT0))
|
|
@@ -865,8 +865,8 @@ static void screen_task(void *arg)
|
|
{
|
|
{
|
|
if (screen_rev_info.is_change_power)
|
|
if (screen_rev_info.is_change_power)
|
|
{
|
|
{
|
|
- ESP_LOGE(LOG_TAG, "=============power_status %s======== set power off", Machine_info.power_status ? "is power on" : "is power off");
|
|
|
|
- Machine_info.power_status = 0; // 关机
|
|
|
|
|
|
+ ESP_LOGE(LOG_TAG, "power_status:%s", Machine_info.power_status ? "now[poweron],after[poweroff]" : "now[poweroff],after[poweron]");
|
|
|
|
+ Machine_info.power_status = !Machine_info.power_status; // 关机
|
|
}
|
|
}
|
|
if (Machine_info.left_current_Quick_refresh_time >= Machine_info.left_max_Quick_refresh_time)
|
|
if (Machine_info.left_current_Quick_refresh_time >= Machine_info.left_max_Quick_refresh_time)
|
|
{
|
|
{
|
|
@@ -897,10 +897,10 @@ static void screen_task(void *arg)
|
|
if ((Machine_info.power_status == 1) /*&& (Machine_info.paired == 1) */ && screen_rev_info.is_into_sleep)
|
|
if ((Machine_info.power_status == 1) /*&& (Machine_info.paired == 1) */ && screen_rev_info.is_into_sleep)
|
|
{
|
|
{
|
|
ESP_LOGW(LOG_TAG, "%dms sleep %s", screen_rev_info.sleep_ms, screen_rev_info.is_left ? "left" : "right");
|
|
ESP_LOGW(LOG_TAG, "%dms sleep %s", screen_rev_info.sleep_ms, screen_rev_info.is_left ? "left" : "right");
|
|
- if (screen_rev_info.sleep_ms == 1)
|
|
|
|
- sleep_timer_start(100); // 进入睡眠
|
|
|
|
- else
|
|
|
|
- sleep_timer_start(screen_rev_info.sleep_ms); // 进入睡眠
|
|
|
|
|
|
+ // if (screen_rev_info.sleep_ms == 1)
|
|
|
|
+ // sleep_timer_start(100); // 进入睡眠
|
|
|
|
+ // else
|
|
|
|
+ sleep_timer_start(screen_rev_info.sleep_ms); // 进入睡眠
|
|
}
|
|
}
|
|
|
|
|
|
if (Machine_info.power_status == 0) // 展示说明书都是先左后右,等右屏刷完再休眠
|
|
if (Machine_info.power_status == 0) // 展示说明书都是先左后右,等右屏刷完再休眠
|
|
@@ -1028,7 +1028,7 @@ static void button_task(void *arg)
|
|
{
|
|
{
|
|
printf("repeat ,goto sleep !\r\n");
|
|
printf("repeat ,goto sleep !\r\n");
|
|
// sleep_timer_start(100); // 开始进入倒计时休眠
|
|
// sleep_timer_start(100); // 开始进入倒计时休眠
|
|
- set_screen_dis_info_and_send_queue(false, false, false, true, 1000);
|
|
|
|
|
|
+ set_screen_dis_info_and_send_queue(true, false, false, true, 100);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else // 右屏幕按键触发
|
|
else // 右屏幕按键触发
|
|
@@ -1060,19 +1060,18 @@ static void button_task(void *arg)
|
|
|
|
|
|
if (Machine_info.power_status == 1) // 开机状态
|
|
if (Machine_info.power_status == 1) // 开机状态
|
|
{
|
|
{
|
|
|
|
+ printf("poweron->poweroff\r\n");
|
|
|
|
+ lora_set_power_level(0); // 关机关闭lora防止lora消息刷屏
|
|
// Machine_info.power_status = 0;
|
|
// Machine_info.power_status = 0;
|
|
// screen_dis_info.is_change_power = true;
|
|
// screen_dis_info.is_change_power = true;
|
|
xQueueReset(screen_queue);
|
|
xQueueReset(screen_queue);
|
|
- set_screen_dis_info_and_send_queue(false, true, true, false, 100);// 关机
|
|
|
|
- set_screen_dis_info_and_send_queue(true, false, false, false, 1000);
|
|
|
|
- printf("poweron->poweroff\r\n");
|
|
|
|
|
|
+ set_screen_dis_info_and_send_queue(false, true, true, false, 5000); // 关机
|
|
|
|
+ set_screen_dis_info_and_send_queue(true, false, false, false, 5000);
|
|
}
|
|
}
|
|
- else if (Machine_info.power_status == 0)
|
|
|
|
|
|
+ else if (Machine_info.power_status == 0) // 关机后还未进入休眠直接长按开机
|
|
{
|
|
{
|
|
- printf("power on\r\n");
|
|
|
|
|
|
+ printf("button power on\r\n");
|
|
Machine_info.power_status = 1;
|
|
Machine_info.power_status = 1;
|
|
- lora_set_power_level(1);
|
|
|
|
- font_exit_sleep();
|
|
|
|
|
|
|
|
gpio_hold_dis(LORA_TXD_PIN);
|
|
gpio_hold_dis(LORA_TXD_PIN);
|
|
gpio_hold_dis(LORA_RXD_PIN);
|
|
gpio_hold_dis(LORA_RXD_PIN);
|
|
@@ -1080,10 +1079,13 @@ static void button_task(void *arg)
|
|
gpio_hold_dis(PIN_L_CS);
|
|
gpio_hold_dis(PIN_L_CS);
|
|
gpio_hold_dis(PIN_R_CS);
|
|
gpio_hold_dis(PIN_R_CS);
|
|
|
|
|
|
- // 恢复串口i功能
|
|
|
|
- uart_sleep_out_config();
|
|
|
|
set_screen_dis_info_and_send_queue(false, true, false, false, 100);
|
|
set_screen_dis_info_and_send_queue(false, true, false, false, 100);
|
|
set_screen_dis_info_and_send_queue(true, false, false, false, 100);
|
|
set_screen_dis_info_and_send_queue(true, false, false, false, 100);
|
|
|
|
+
|
|
|
|
+ lora_set_power_level(1);
|
|
|
|
+ // 恢复串口i功能
|
|
|
|
+ uart_sleep_out_config();
|
|
|
|
+ font_exit_sleep();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1099,7 +1101,7 @@ static void button_task(void *arg)
|
|
{
|
|
{
|
|
beep_blink(50, 3);
|
|
beep_blink(50, 3);
|
|
printf("into ota mode\r\n");
|
|
printf("into ota mode\r\n");
|
|
-#include "iot_button.h"
|
|
|
|
|
|
+
|
|
iot_button_stop();
|
|
iot_button_stop();
|
|
esp_ble_ota();
|
|
esp_ble_ota();
|
|
}
|
|
}
|
|
@@ -1113,22 +1115,12 @@ static void button_task(void *arg)
|
|
lora_set_power_level(1);
|
|
lora_set_power_level(1);
|
|
uart_sleep_out_config();
|
|
uart_sleep_out_config();
|
|
|
|
|
|
-#include "user_sleep.h"
|
|
|
|
- // #include "esp_sleep.h"
|
|
|
|
-
|
|
|
|
extern void sleep_timer_stop();
|
|
extern void sleep_timer_stop();
|
|
extern void Already_send_timer_stop();
|
|
extern void Already_send_timer_stop();
|
|
|
|
|
|
sleep_timer_stop();
|
|
sleep_timer_stop();
|
|
Already_send_timer_stop();
|
|
Already_send_timer_stop();
|
|
|
|
|
|
- // //修改信道前修改设备ID 及 设备ID
|
|
|
|
- // dymatic_change_device_id(0x00000001);
|
|
|
|
- // dymatic_change_dst_device_id(0xFFFFFFFF);
|
|
|
|
- // //切换信道
|
|
|
|
- // dymatic_change_chanel(Machine_info.lora_factory_channel); //切换信道
|
|
|
|
- // // spiffs_read(&Machine_info);
|
|
|
|
-
|
|
|
|
vTaskDelay(300 / portTICK_PERIOD_MS);
|
|
vTaskDelay(300 / portTICK_PERIOD_MS);
|
|
reset_default(true, 1);
|
|
reset_default(true, 1);
|
|
reset_lora(LORA_CHANENL);
|
|
reset_lora(LORA_CHANENL);
|
|
@@ -1404,11 +1396,6 @@ void read_deal_data_callback_handler()
|
|
{
|
|
{
|
|
if (xQueueReceive(lora_dealhandle, &length, portMAX_DELAY) == pdPASS)
|
|
if (xQueueReceive(lora_dealhandle, &length, portMAX_DELAY) == pdPASS)
|
|
{
|
|
{
|
|
- if (rssi != 0)
|
|
|
|
- {
|
|
|
|
- Machine_info.rssi = rssi;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
// printf("deal data\r\n");
|
|
// printf("deal data\r\n");
|
|
user_size = y_ringbuf_get_used_size(lora_ringbuf);
|
|
user_size = y_ringbuf_get_used_size(lora_ringbuf);
|
|
if (user_size > 0)
|
|
if (user_size > 0)
|