WXK
2023-03-25 baf8b42fca25208021259fde69eabdd2fc31cefa
Src/main.c
@@ -31,7 +31,7 @@
#define NSH1 0x0001
#define GP   0x0002
//#define DEBUG_MODE
#define DEBUG_MODE
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@@ -208,31 +208,7 @@
      LED_LG_OFF;
//   }
}
   if(g_com_map[CNT_UPDATE]==1)
   {
   uint32_t result = 0;
      uint16_t tmp = 0xAAAA;
   __disable_irq();
   result = FLASH_Prepare(0x8004A38, 128);
   if(result)
      result = FLASH_Write(0x8004A38, (const uint8_t*)&tmp, 2);
   __enable_irq();
      printf("进入升级模式\r\n");
   g_com_map[CNT_UPDATE]=0;
   save_com_map_to_flash();
   delay_ms(100);
      //   STMFLASH_Write_NoCheck(0x8004A38,0xAAAA);
      //   Delay_ms(100);
         SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //软复位回到bootloader
   }
         if(g_com_map[CNT_REBOOT]==1)
      {
         g_com_map[CNT_REBOOT]=0;
         g_com_map[MAP_SIGN_INDEX]=0;
         save_com_map_to_flash();
         delay_ms(100);
         SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //软复位回到bootloader
      }
      if(g_com_map[CNT_RESTART]==1)
      {
         g_com_map[CNT_RESTART]=0;
@@ -281,7 +257,7 @@
   hardware_pici= STMFLASH_ReadHalfWord(FLASH_HARDWARE_VERSION_MAP+2);
   hardware_type= STMFLASH_ReadHalfWord(FLASH_HARDWARE_VERSION_MAP+4);
   //deca_sleep(1000);
   g_com_map[VERSION] = (2<<8)|61;
   g_com_map[VERSION] = (2<<8)|62;
    
//   g_com_map[DEV_ID]=0x7;
#ifdef DEBUG_MODE
@@ -357,7 +333,7 @@
   {
         g_com_map[MOTORBEEPER_INDEX] = 2;
   }
   hardware_type   = g_com_map[MOTORBEEPER_INDEX];
   hardware_type   = 1;//g_com_map[MOTORBEEPER_INDEX];;
   switch(hardware_type)
      {
        case 1:     
@@ -459,6 +435,7 @@
      if(g_start_send_flag&&active_flag)
   { static uint16_t blink_count=0;
      g_start_send_flag = 0;   
        static u8 uwbcount =0;
   //   GetPressAndTemp();
//      if(current_count>slot_startcount&&current_count<slot_startcount+interval_count)
//      {
@@ -477,6 +454,7 @@
         Tag_App();
         LED_TR_OFF;      
      }
         __enable_irq();
      //LED0_BLINK;      
      IdleTask();