#define __APP_VER_H__
#define SW_VER_MAJOR 2
-#define SW_VER_MINOR 3
+#define SW_VER_MINOR 4
#endif //__APP_VER_H__
{
huart->Init.BaudRate = 9600;
}else if( index == 1 ){
- huart->Init.BaudRate = 1000000; //µ÷ÊÔ´úÂ룬 Ç¿ÖÆ1MËÙÂÊ
+ huart->Init.BaudRate = 1000000; //ÉÏλ»úͨÐŹ̶¨1000000
}
else
{
return;
}
LedBuzzer_Data_state();
- McuArm_LedBuzzer_Send(LED_STATE, &Mcu_to_Arm_state.led_state);
- McuArm_Alarm_Send();
+
+ if( !is_ota_start() ){
+ McuArm_LedBuzzer_Send(LED_STATE, &Mcu_to_Arm_state.led_state);
+ McuArm_Alarm_Send();
+ }
+
if(Arm_to_Mcu_state.DS_TempRequest !=false)
{
McuCom_Send_DsTemp_Request();
WORD txlen;
McuCom_Head_t *McuCom_Head;
uint8_t data;
- uint8_t head_len;
+ uint16_t head_len;
// ½«Öжϻº³å¶ÓÁÐÊý¾Ý¿½±´µ½Ó¦Óûº³åÇø
Port_Get_One_Rx_Frame(PORT_UART_IFACE_WIFI, &frame, &len);
uint32_t off;
uint8_t *p;
uint32_t data_crc;
+ uint32_t need_reboot = 0;
ota.act_time = HAL_GetTick(); //update active time
+
/*
MCU»ØÓ¦ Ò»¸ö×Ö½Ú£º
printf( "MCU img data crc ok!\n" );
resp = 1;
Update_Over( ota.img_size );
- ota_reboot_notify(); //notify host
- SetRunFlag(TCM_FLAG_HARD_INIT, FLAG_SET); //¸´Î»
+ need_reboot = 1;
}else{
printf( "MCU img data crc fail %x / %x!\n", crc, data_crc );
}
mcucom_ota_ack( port, 3, &resp, 1 );
//TODO£º add ack before reboot
HAL_Delay(20);
+ if( need_reboot ){
+ ota_reboot_notify(); //notify host
+ SetRunFlag(TCM_FLAG_HARD_INIT, FLAG_SET); //¸´Î»
+ }
}
int32_t is_ota_start( void )
self.rx_event.set()
def transmit(self, tx, timeout = 5, retry=1, verbose=1 ):
+ wait_timeout = time.time() + timeout
while retry>0:
retry -= 1
- self.rx_event.clear()
try:
print( "发送[%d]: %s ..."%( len(tx), tx[:64].hex()))
self.s.write( tx )
- if self.rx_event.wait( timeout= timeout ):
- print( "接收[%d]: %s ..."%( len(self.rx_pkt), self.rx_pkt[:64].hex() ) )
- return True
- elif verbose:
- self.log_add( '数据传输超时!', 'error')
+ while time.time() < wait_timeout:
+ self.rx_event.clear()
+ if self.rx_event.wait( timeout= timeout ):
+ print( "接收[%d]: %s ..."%( len(self.rx_pkt), self.rx_pkt[:64].hex() ) )
+ if self.rx_pkt[2] == tx[2]:
+ print( "get pkt %02X resp"%(tx[2]))
+ return True
+ else:
+ print( "get pkt %02X != %02X resp, wait again..."%( self.rx_pkt[2],tx[2]))
+ continue
+ elif verbose:
+ self.log_add( '数据传输超时!', 'error')
+ break
except:
if verbose:
self.log_add( '数据发送失败!', 'error')