| | |
| | | extern uint16_t ip0,ip1,ip2,ip3,port; |
| | | extern uint8_t gps_4g_flag; |
| | | extern uint8_t gps_need_data_flag,gps_open_flag; |
| | | uint8_t uwb_ch; |
| | | void Program_Init(void) |
| | | { |
| | | Usart1ParseDataCallback = UsartParseDataHandler;//需改为默认为gps处理,UsartParseDataHandler为升级处理当调试时候改为 |
| | |
| | | send_struct.alarmDistence=prewarning_distance;//更新报警距离 |
| | | memcpy(&send_struct.gunLableId,&g_com_map[BIND_DEV_ID],2);//更新绑定ID |
| | | send_struct.tagId=dev_id;//更新设备ID |
| | | |
| | | // uwb_ch=g_com_map[NEARBASE_ID1]; |
| | | // if(g_com_map[BIND_DEV_ID]==0) |
| | | // { |
| | | // UWB_work_state = UN_BIND; |
| | |
| | | ip2 = (g_com_map[TCP_IP_2]>>12&0xf)*1000+(g_com_map[TCP_IP_2]>>8&0xf)*100+(g_com_map[TCP_IP_2]>>4&0xf)*10+(g_com_map[TCP_IP_2]&0xf); |
| | | ip3 = (g_com_map[TCP_IP_3]>>12&0xf)*1000+(g_com_map[TCP_IP_3]>>8&0xf)*100+(g_com_map[TCP_IP_3]>>4&0xf)*10+(g_com_map[TCP_IP_3]&0xf); |
| | | port = g_com_map[TCP_PORT]; |
| | | g_com_map[VERSION] = (1<<8)|0; |
| | | g_com_map[VERSION] = (1<<8)|1; |
| | | LOG_INFO(TRACE_MODULE_APP,"设备ID: %x .\r\n",dev_id); |
| | | LOG_INFO(TRACE_MODULE_APP,"固件版本:4G-GPS定位手环 V%d.%d. \r\n",g_com_map[VERSION]>>8,g_com_map[VERSION]&0xff); |
| | | LOG_INFO(TRACE_MODULE_APP,"服务器地址: %d.%d.%d.%d:%d.\r\n",ip0,ip1,ip2,ip3,port); |
| | | LOG_INFO(TRACE_MODULE_APP,"铁鞋升级工卡\r\n",ip0,ip1,ip2,ip3,port); |
| | | } |
| | | |
| | | |
| | |
| | | delay_ms(300); |
| | | // Get_anchor_appdata_flag=0; |
| | | SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //软复位回到bootloader |
| | | } |
| | | } |
| | | // else{ |
| | | // SCB->AIRCR = 0X05FA0000|(unsigned int)0x04; //软复位回到bootloader |
| | | // } |
| | | } |
| | | } |
| | | } |
| | |
| | | extern uint32_t tempflag; |
| | | uint32_t tx_en_start_u32; |
| | | uint32_t tx_en_start_u321; |
| | | uint8_t baifenbi=5; |
| | | void Lora_upanc_ing_Poll( void ) |
| | | { uint16_t crc16; |
| | | // if(Lora_upanc_flag==1) |
| | |
| | | // LOG_INFO(TRACE_MODULE_APP, "升级进度%d\r\n",jindu); |
| | | Dtu_shengji_jindu[4]=jindu; |
| | | memcpy(&Dtu_shengji_jindu[5],&mubiao_anchor_ID,2); |
| | | if(jindu>baifenbi) |
| | | { |
| | | uart_send(UART_ID0, Dtu_shengji_jindu,9, NULL); |
| | | baifenbi=baifenbi+10; |
| | | } |
| | | tx_en_start_u32 = phy_timer_count_get()+US_TO_PHY_TIMER_COUNT(100U);//发送必须要延时发送才可以用于测距否则立即发送会获取时间戳不对,需要计算程序运行时间,避免设置过去时间 |
| | | tempflag=uwb_tx(send_lora_data,DATA_IDX+ONE_BAG_DAXIAO+2+2,1,tx_en_start_u32);//立即发送 |
| | | tx_en_start_u321= phy_timer_count_get(); |
| | |
| | | } |
| | | // } |
| | | } |
| | | extern uint8_t shengji_flag; |
| | | int main(void) |
| | | { |
| | | board_clock_run(); |
| | |
| | | |
| | | adc_open(&usr_adc_cfg); |
| | | |
| | | IIC2_Init(); |
| | | // IIC2_Init(); |
| | | Accelerometer_Init(); |
| | | PCA9555_init(); |
| | | // PCA9555_init(); |
| | | if(!read_5v_input_pca()) |
| | | { |
| | | Set4LEDColor(BLUE,GREEN,WHITE,GREEN); |
| | |
| | | //board_4GUsart_detection_init(_4gUsart_handler); |
| | | while (1) |
| | | { |
| | | if(!shengji_flag) |
| | | uwb_app_poll(); |
| | | // Lora_upanc_ing_Poll(); |
| | | //test4=gpio_pin_get_val(SCL_PIN); |