Эх сурвалжийг харах

恢复出厂设置时,也将日期时间重置

robbin 10 цаг өмнө
parent
commit
c608446f74

+ 19 - 0
application/aem_watch/src/application/settings/aem_system_tips.c

@@ -29,6 +29,9 @@ const uint16_t tipe_h = 200;
 const uint16_t system_tips_pad_top = 46;
 const uint16_t system_tips_pad_top = 46;
 const uint8_t system_tips_btn_x = 100;
 const uint8_t system_tips_btn_x = 100;
 const int8_t system_tips_btn_y = -40;
 const int8_t system_tips_btn_y = -40;
+extern uint8_t bySetHour;
+extern uint8_t bySetTimeStep;  // 时间设置标志位
+extern bool bInitTimeData;     // 时间初始化标志位
 
 
 extern uint32_t flash_read(const char *name, uint32_t offset, void *data, uint32_t size);
 extern uint32_t flash_read(const char *name, uint32_t offset, void *data, uint32_t size);
 extern uint32_t flash_erase(const char *name);  // 擦除Flash
 extern uint32_t flash_erase(const char *name);  // 擦除Flash
@@ -64,6 +67,7 @@ static const void* loading_img[LOADING_IMG_CNT] =
 static void btn_click_cb(lv_obj_t *btn)
 static void btn_click_cb(lv_obj_t *btn)
 {
 {
     uint8_t photo_data_size_buff[3] = {0};
     uint8_t photo_data_size_buff[3] = {0};
+    uint8_t cnt = 0;
 
 
     if (btn == s_ui->cancel)
     if (btn == s_ui->cancel)
     {
     {
@@ -97,6 +101,21 @@ static void btn_click_cb(lv_obj_t *btn)
             {
             {
                 flash_erase("profile_photo_name");
                 flash_erase("profile_photo_name");
             }
             }
+
+            bySetHour = 0;         //随便给一个非0xff的值,表示要设置时间
+            bInitTimeData = true;  //need to init time data
+            bySetTimeStep = 2;     //step2, 表示设置时间
+            do
+            {
+                k_msleep(500);     //每次延时500ms,最多延时3s,留足设置的时间
+                cnt++;
+                if (cnt >= 6)
+                {
+                    bySetTimeStep = 3;
+                    break;
+                }
+            }while (bySetTimeStep == 2);
+
             on_off.type = AEM_POWER_OFF_RETURN_FACTORY;
             on_off.type = AEM_POWER_OFF_RETURN_FACTORY;
             aem_power_off_main(&on_off);
             aem_power_off_main(&on_off);
             break;
             break;

+ 2 - 2
application/aem_watch/src/user_cfg/device_info_cfg.h

@@ -8,11 +8,11 @@
 #if DMG_LCM
 #if DMG_LCM
 #define MAJOR_VERSION 0x01
 #define MAJOR_VERSION 0x01
 #define MINOR_VERSION 0x02
 #define MINOR_VERSION 0x02
-#define MICRO_VERSION 0x00
+#define MICRO_VERSION 0x02
 #else
 #else
 #define MAJOR_VERSION 0x03
 #define MAJOR_VERSION 0x03
 #define MINOR_VERSION 0x00
 #define MINOR_VERSION 0x00
-#define MICRO_VERSION 0x01
+#define MICRO_VERSION 0x02
 #endif
 #endif
 
 
 #define DEVICE_ID "CJ01"//3085
 #define DEVICE_ID "CJ01"//3085

+ 1 - 1
thirdparty/lib/aem/config/aem_project.h

@@ -4,7 +4,7 @@
 #pragma warning(error : 4013)
 #pragma warning(error : 4013)
 #endif
 #endif
 #define AEM_VERSION "BL_Develop_NOR"
 #define AEM_VERSION "BL_Develop_NOR"
-#define BUILD_TIME "202511061600"
+#define BUILD_TIME "202511131600"
 #define AEM_GUI_FWK_LIB_VER "2.0.0.0"
 #define AEM_GUI_FWK_LIB_VER "2.0.0.0"
 #define APP_DOWNLOAD_URL "https://customer.com"
 #define APP_DOWNLOAD_URL "https://customer.com"
 #define AEM_APP_TRANS_ANIMATION 1
 #define AEM_APP_TRANS_ANIMATION 1

+ 5 - 3
zephyr/drivers/input/sd8563_timer_acts.c

@@ -60,6 +60,7 @@ struct acts_timer_data {
 
 
 uint16_t timer_crc[2] __attribute((used)) = {0};
 uint16_t timer_crc[2] __attribute((used)) = {0};
 uint8_t read_time_data[7] = {0};
 uint8_t read_time_data[7] = {0};
+bool bInitTimeData;  // 0: no need to init; 1: need to init
 static struct acts_timer_data timer_acts_ddata;
 static struct acts_timer_data timer_acts_ddata;
 
 
 static int _sd8563_close_write_protection(const struct device *i2c_dev);
 static int _sd8563_close_write_protection(const struct device *i2c_dev);
@@ -343,7 +344,6 @@ static void _sd8563_set_time(const struct device *i2c_dev,
 #if 1	
 #if 1	
 	uint8_t write_cmd[8] = {0};
 	uint8_t write_cmd[8] = {0};
 	uint8_t read_cmd[7] = {0};
 	uint8_t read_cmd[7] = {0};
-	bool power_on_set_time_data = false;
 	int ret = 0;
 	int ret = 0;
 
 
 	printk("_sd8563_set_time start\n");
 	printk("_sd8563_set_time start\n");
@@ -365,7 +365,7 @@ static void _sd8563_set_time(const struct device *i2c_dev,
 			return;
 			return;
 		}
 		}
 
 
-		power_on_set_time_data = true;
+		bInitTimeData = true;  //need to init time
 	}
 	}
 
 
     _sd8563_read_time(i2c_dev, false);  //read time
     _sd8563_read_time(i2c_dev, false);  //read time
@@ -397,7 +397,7 @@ static void _sd8563_set_time(const struct device *i2c_dev,
 		read_time_data[6] = set_year;//(set_year / 10) * 16  + set_year % 10;  //DEC TO BCD CODE
 		read_time_data[6] = set_year;//(set_year / 10) * 16  + set_year % 10;  //DEC TO BCD CODE
 	}
 	}
 
 
-    if (power_on_set_time_data == true)
+    if (bInitTimeData == true)  //need to init time
 	{
 	{
         //BCD code
         //BCD code
 		write_cmd[1] = 0;  //sec
 		write_cmd[1] = 0;  //sec
@@ -504,6 +504,8 @@ static void _sd8563_init_work(struct k_work *work)
 
 
 	external_rtc->inited = true;
 	external_rtc->inited = true;
 
 
+	bInitTimeData = false;
+
 	if (_sd8563_close_write_protection(external_rtc->i2c_dev) == 1)
 	if (_sd8563_close_write_protection(external_rtc->i2c_dev) == 1)
 	{
 	{
 		//k_msleep(2);
 		//k_msleep(2);

+ 1 - 1
zephyr/drivers/serial/uart2_rec.c

@@ -924,7 +924,7 @@ static void uart_fifo_callback(const struct device *dev, void *user_data)
 							bySetWeekday = str_uart2_rec_data.rec_data[7];
 							bySetWeekday = str_uart2_rec_data.rec_data[7];
 							bySetMonth = str_uart2_rec_data.rec_data[8];
 							bySetMonth = str_uart2_rec_data.rec_data[8];
 							wSetYear = str_uart2_rec_data.rec_data[9];
 							wSetYear = str_uart2_rec_data.rec_data[9];
-							bySetTimeStep = 1;
+							bySetTimeStep = 1;  //step1:recieved set time data
 						}
 						}
 						
 						
 						send_frame(SET_TIME_CMD, tx_buff, 0);
 						send_frame(SET_TIME_CMD, tx_buff, 0);