From 4c42d1a6ab54e49f7ffaaeb00ceaaa8c1702a3a1 Mon Sep 17 00:00:00 2001 From: d15521469561 <1731678236@qq.com> Date: Tue, 16 Jun 2026 09:37:24 +0800 Subject: [PATCH] =?utf8?q?1.=E6=81=A2=E5=A4=8D=E5=87=BA=E5=8E=82=E5=8A=A0?= =?utf8?q?=E7=81=AF=E6=95=88=202.=E8=87=AA=E5=8A=A8=E5=8D=87=E7=BA=A7?= =?utf8?q?=E5=8A=9F=E8=83=BD=203.=E4=BF=AE=E6=94=B9=E7=89=88=E6=9C=AC?= =?utf8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- App/inc/iap.h | 2 + App/inc/led.h | 4 +- App/src/iap.c | 11 +++- App/src/iot.c | 19 ++++--- App/src/led.c | 90 +++++++++++++++++--------------- RVMDK/RVMDKN32G45X/main.c | 6 +++ RVMDK/RVMDKN32G45X/project_cfg.h | 2 +- 7 files changed, 83 insertions(+), 51 deletions(-) diff --git a/App/inc/iap.h b/App/inc/iap.h index 45b7d60..581a9e3 100644 --- a/App/inc/iap.h +++ b/App/inc/iap.h @@ -308,6 +308,8 @@ typedef union uint8_t protocol_version; uint8_t reply; uint8_t sub_cmd; + + uint8_t ota_auto_flag; }end; }IAP_LITE_CMD_T; diff --git a/App/inc/led.h b/App/inc/led.h index fbb2b88..d0b4b5a 100644 --- a/App/inc/led.h +++ b/App/inc/led.h @@ -348,6 +348,7 @@ typedef enum KEY_TURN_OFF, KEY_COLOR_PREVIEW, KEY_BLE_CONNECT_BLINK, + KEY_IOT_FACTORY_RESET, KEY_EXHIBITION, KEY_POWER_ON, }KEY_LED_STATUS_ENUM; @@ -366,11 +367,12 @@ typedef struct uint16_t turn_off:1; uint16_t color_preview:1; uint16_t ble_state:1; + uint16_t iot_factory_status:1; uint16_t exhibition:1; uint16_t power_on:1; - uint16_t reserved1:6; + uint16_t reserved1:5; }; uint16_t status; }; diff --git a/App/src/iap.c b/App/src/iap.c index 34322d8..ce05080 100644 --- a/App/src/iap.c +++ b/App/src/iap.c @@ -515,6 +515,7 @@ void Iap_Lite_Process(uint8_t* data, uint16_t len, uint8_t host_type) // ×¼±¸Éý¼¶ case IAP_LITE_CMD_READY: { + FLASH_EraseOnePage(FLASH_MOVE_PARTITION_ADDR); // ½«APP0°áÔ˵½APP1±¸·Ý uint32_t crc32 = Iap_Check(FLASH_APP_PARTITION, FLASH_APP_PARTITION_SIZE); @@ -588,7 +589,14 @@ void Iap_Lite_Process(uint8_t* data, uint16_t len, uint8_t host_type) //½áÊø¸´Î» case IAP_LITE_CMD_END : { - iap_end_flag = 1; + DUG_PRINTF("iap_lite_cmd->end.ota_auto_flag=%d\n",iap_lite_cmd->end.ota_auto_flag); + if(!iap_lite_cmd->end.ota_auto_flag) + { + iap_end_flag = 1; + }else{ + iap_end_flag = 0; + + } iap_lite_reply.payload.reply = REPLY_STATUS_OK; } break; @@ -607,3 +615,4 @@ void Iap_Lite_Process(uint8_t* data, uint16_t len, uint8_t host_type) Iot_Uart_Tx_Query_Add(IOT_UART_IAP_CMD, (uint8_t*)&iap_lite_reply, sizeof(iap_lite_reply.payload)); } } + diff --git a/App/src/iot.c b/App/src/iot.c index 17e4a64..9db21e5 100644 --- a/App/src/iot.c +++ b/App/src/iot.c @@ -216,7 +216,7 @@ void Iot_Uart_Rx_Handle(uint8_t *data ,uint8_t len) } // DUG_PRINTF("data[2]:%02x\n\n", data[2]); - switch (data[3]) + switch (data[4]) { case 0x00: { @@ -321,6 +321,7 @@ void Iot_Uart_Rx_Handle(uint8_t *data ,uint8_t len) case 0x13: { iot_factroy_flag=0; + key_led_status.iot_factory_status = 1; } break; @@ -333,6 +334,16 @@ void Iot_Uart_Rx_Handle(uint8_t *data ,uint8_t len) } break; + //ÖØÆôÖ÷¿ØºÍÄ£×é + case 0x15: + { + + system_reset_remain=50; + + } + break; + + case 0xB1: { @@ -384,12 +395,8 @@ void Iot_Disconnect_Count(void) void Iot_OneTimerSecond(void) { static uint32_t timerSecond=0; - static uint32_t powerOn_count=0; + static uint8_t powerOn_count=0; - if(timerSecond == 0) - { - timerSecond= systicks; - } if(systicks - timerSecond >= ONE_TIMER_SECOND) { timerSecond= systicks; diff --git a/App/src/led.c b/App/src/led.c index 15f51ee..08f5a94 100644 --- a/App/src/led.c +++ b/App/src/led.c @@ -2003,77 +2003,76 @@ void Led_Key_Ble_Connected_Blink(void) for(uint8_t num=0;num