瀏覽代碼

2023.12.29 增加部分log

wanghechen 8 月之前
父節點
當前提交
036242a405
共有 8 個文件被更改,包括 21 次插入16 次删除
  1. 1 0
      components/EPD/EPD.c
  2. 1 0
      components/button/user_button.c
  3. 4 0
      components/c_linked_list/list.c
  4. 6 2
      main/esp_ble_ota.c
  5. 1 1
      main/user_config.h
  6. 1 1
      main/user_sleep.h
  7. 4 11
      main/yc_protocol.c
  8. 3 1
      main/yc_terminal.c

+ 1 - 0
components/EPD/EPD.c

@@ -525,6 +525,7 @@ void epd_cmd(spi_device_handle_t spi, const uint8_t cmd, bool keep_cs_active)
       t.flags = SPI_TRANS_CS_KEEP_ACTIVE;   //Keep CS active after data transfer
     }
     ret=spi_device_queue_trans(spi, &t, portMAX_DELAY);
+    
     // assert(ret==ESP_OK);            //Should have had no issues.
     spi_get_result(spi);
     #else

+ 1 - 0
components/button/user_button.c

@@ -481,6 +481,7 @@ static void user_button_single_click_cb(void *arg,void *usr_data)
 {
     is_setting = false;
     is_reset_net = false;
+    ESP_LOGW(LOG_TAG," single_click_cb[%d]", iot_button_get_ticks_time((button_handle_t)arg));
     switch ((int)usr_data)
     {
     case BAOYANG_KEY:

+ 4 - 0
components/c_linked_list/list.c

@@ -33,6 +33,10 @@ Node *newNode(int x)
 	pnt -> data = malloc(len);
 	#else
 	pnt -> data = heap_caps_malloc(len,MALLOC_CAP_RTCRAM);
+	if(pnt -> data == NULL)
+	{
+		printf("-------pnt -> data == NULL-------\n");
+	}
 	#endif
 
 	#include "string.h"

+ 6 - 2
main/esp_ble_ota.c

@@ -270,8 +270,10 @@ ota_task(void *arg)
 
     // extern Machine_info_t   Machine_info;
     // spiffs_write(&Machine_info);
-    extern void reset_default(bool is_dis);
-    reset_default(false);
+
+
+    extern void reset_default(bool is_dis,uint8_t power_status);
+    reset_default(false,0);
     ESP_LOGE(TAG, "存数据 esp_restart");
     vTaskDelay(500 / portTICK_PERIOD_MS);
     esp_restart();
@@ -280,6 +282,8 @@ OTA_ERROR:
     ESP_LOGE(TAG, "OTA failed");
     esp_ble_ota_delete();
     vTaskDelete(NULL);
+    #include "iot_button.h"
+    iot_button_resume();
     extern void sleep_timer_start(int ms);
     sleep_timer_start(100); //开始进入倒计时休眠 
 }

+ 1 - 1
main/user_config.h

@@ -119,5 +119,5 @@ void Paint_rightScreen_main_slow(Machine_info_t* info);
 void dis_instructions();
 
 void esp_ble_ota(void);
-void reset_default(bool is_dis);
+void reset_default(bool is_dis,uint8_t power_status);
 #endif

+ 1 - 1
main/user_sleep.h

@@ -3,7 +3,7 @@
 
 
 
-#define TIMER_WAKEUP_TIME_US    (30 * 1000 * 1000)     //定义的唤醒的时间         单位s
+#define TIMER_WAKEUP_TIME_US    (6 * 1000 * 1000)     //定义的唤醒的时间         单位s
 #define TIMER_CAN_SEND_TIME     (200)                 //定义可以唤醒lora工作的时间单位ms
 #define LORA_POWER_TIME         (2000)
 

+ 4 - 11
main/yc_protocol.c

@@ -88,13 +88,13 @@ RTC_FAST_ATTR Person_t  person[5]=
 
 
 
-void reset_default(bool is_dis)
+void reset_default(bool is_dis,uint8_t power_status)
 {
     
     extern Machine_info_t default_info;
     Machine_info_t tmp ;
     memcpy(&tmp,&default_info,sizeof(Machine_info_t));
-    tmp.power_status = 1;
+    tmp.power_status = power_status;
     esp_read_mac((uint8_t *)tmp.mac_addr, ESP_MAC_WIFI_STA);
     memcpy(&tmp.cid,&Machine_info.cid,20);
     tmp.batt_precent = Machine_info.batt_precent;
@@ -112,13 +112,6 @@ void reset_default(bool is_dis)
 
 
 
-#if 0
-void insertNode_head(ListNode *head, ListNode *P);
-void removeNode_byNumber(ListNode *head,uint16_t number);
-ListNode *getListNode_byNumber(ListNode *head,uint16_t number);
-ListNode *newListNode(uint16_t number,uint8_t type,char* name);
-#endif
-
 /*
 *    使用 vTaskList() 前需使能:
 *    Enable FreeRTOS trace facility
@@ -1674,7 +1667,7 @@ static void hardware_ungwpair_func(const LORA_DATA_T* buf)
      dymatic_change_device_id(0x00000001);
      dymatic_change_dst_device_id(0xFFFFFFFF);
     //切换信道
-    reset_default(true);
+    reset_default(true,1);
     vTaskDelay(300 / portTICK_PERIOD_MS);
     Machine_info.lora_new_channel = LORA_CHANENL;
     // dymatic_change_chanel(Machine_info.lora_factory_channel);  //切换信道
@@ -1837,7 +1830,7 @@ void business_logic_func(const LORA_DATA_T* buf,uint8_t cmd_index,int msg)
         break;   
 
     case PROTOCOL_HARDWARE_GWPAIRED:  //配网 暂时单独发送ack 
-    reset_default(false);
+    reset_default(false,1);
     hardware_gwpair_func(buf);
     Paint_leftScreen_main_quick(&Machine_info);
     Paint_rightScreen_main_quick(&Machine_info);

+ 3 - 1
main/yc_terminal.c

@@ -1756,6 +1756,8 @@ static void button_task(void* arg)
                 {
                     beep_blink(50,3);
                     printf("into ota mode\r\n");
+                    #include "iot_button.h"
+                    iot_button_stop();
                     esp_ble_ota();
                 }
 
@@ -1790,7 +1792,7 @@ static void button_task(void* arg)
 
 
                     vTaskDelay(300 / portTICK_PERIOD_MS);
-                    reset_default(true);
+                    reset_default(true,1);
                     reset_lora();
                     vTaskDelay(300 / portTICK_PERIOD_MS);
                 }