| | |
| | | while(Uart_GetChar(UART_ID_LORA, &u8Byte) == HIDO_OK) |
| | | { |
| | | Lora_RecvByte(u8Byte); |
| | | lora_rxbuf[lora_rxbufnum++]=u8Byte; |
| | | if(lora_rxbuf[0]==0x55&&lora_rxbuf[1]==0xAA&&lora_rxbuf[9]==0x55&&lora_rxbuf[10]==0xAA) |
| | | { |
| | | memcpy(&lora_recv_devid,&lora_rxbuf[4],2); |
| | | if(lora_recv_devid==dev_id) |
| | | { |
| | | if(lora_rxbuf[6]==0x01&&lora_rxbuf[7]==0x01&&lora_rxbuf[8]==0x00)//接收GPS回复的OK |
| | | { |
| | | lora_sendfinalbag_flag=0; |
| | | lora_sendfinal_rx_bag_flag=0; |
| | | HIDO_Debug("收到GPS的OK\r\n"); |
| | | memset(&lora_rxbuf,0,sizeof(lora_rxbuf)); |
| | | lora_rxbufnum=0; |
| | | } |
| | | if(lora_rxbuf[6]==0x02)//接收下发修改GPS开关时间参数 |
| | | { |
| | | memcpy(&lora_recv_gpstime,&lora_rxbuf[7],2); |
| | | if(lora_recv_gpstime<=1800) |
| | | lora_recv_gpstime=1800; |
| | | g_com_map[GPS_ONTIME]=lora_recv_gpstime; |
| | | save_com_map_to_flash(); |
| | | HIDO_Debug("收到修改GPS开关时间:%d\r\n",lora_recv_gpstime); |
| | | delay_ms(100); |
| | | NVIC_SystemReset(); |
| | | } |
| | | if(lora_rxbuf[6]==0x03)//接收下发修改静止休眠时间参数 |
| | | { |
| | | memcpy(&lora_recv_gpstime,&lora_rxbuf[7],2); |
| | | if(lora_recv_gpstime<=10) |
| | | lora_recv_gpstime=10; |
| | | g_com_map[NOMOVESLEEP_TIME]=lora_recv_gpstime; |
| | | save_com_map_to_flash(); |
| | | HIDO_Debug("收到修改静止休眠时间:%d\r\n",lora_recv_gpstime); |
| | | delay_ms(100); |
| | | NVIC_SystemReset(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | // lora_rxbuf[lora_rxbufnum++]=u8Byte; |
| | | // if(lora_rxbuf[0]==0x55&&lora_rxbuf[1]==0xAA&&lora_rxbuf[9]==0x55&&lora_rxbuf[10]==0xAA) |
| | | // { |
| | | // memcpy(&lora_recv_devid,&lora_rxbuf[4],2); |
| | | // if(lora_recv_devid==dev_id) |
| | | // { |
| | | // if(lora_rxbuf[6]==0x01&&lora_rxbuf[7]==0x01&&lora_rxbuf[8]==0x00)//接收GPS回复的OK |
| | | // { |
| | | // lora_sendfinalbag_flag=0; |
| | | // lora_sendfinal_rx_bag_flag=0; |
| | | // HIDO_Debug("收到GPS的OK\r\n"); |
| | | // memset(&lora_rxbuf,0,sizeof(lora_rxbuf)); |
| | | // lora_rxbufnum=0; |
| | | // } |
| | | // if(lora_rxbuf[6]==0x02)//接收下发修改GPS开关时间参数 |
| | | // { |
| | | // memcpy(&lora_recv_gpstime,&lora_rxbuf[7],2); |
| | | // if(lora_recv_gpstime<=1800) |
| | | // lora_recv_gpstime=1800; |
| | | // g_com_map[GPS_ONTIME]=lora_recv_gpstime; |
| | | // save_com_map_to_flash(); |
| | | // HIDO_Debug("收到修改GPS开关时间:%d\r\n",lora_recv_gpstime); |
| | | // delay_ms(100); |
| | | // NVIC_SystemReset(); |
| | | // } |
| | | // if(lora_rxbuf[6]==0x03)//接收下发修改静止休眠时间参数 |
| | | // { |
| | | // memcpy(&lora_recv_gpstime,&lora_rxbuf[7],2); |
| | | // if(lora_recv_gpstime<=10) |
| | | // lora_recv_gpstime=10; |
| | | // g_com_map[NOMOVESLEEP_TIME]=lora_recv_gpstime; |
| | | // save_com_map_to_flash(); |
| | | // HIDO_Debug("收到修改静止休眠时间:%d\r\n",lora_recv_gpstime); |
| | | // delay_ms(100); |
| | | // NVIC_SystemReset(); |
| | | // } |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | } |
| | | if(Lora_IsIdle() == HIDO_TRUE&&flag_lorainit) |
| | | { |
| | | memset(&lora_rxbuf,0,sizeof(lora_rxbuf)); |
| | | flag_lorainit=0; |
| | | lora_rxbufnum=0; |
| | | } |
| | | // if(Lora_IsIdle() == HIDO_TRUE&&flag_lorainit) |
| | | // { |
| | | // memset(&lora_rxbuf,0,sizeof(lora_rxbuf)); |
| | | // flag_lorainit=0; |
| | | // lora_rxbufnum=0; |
| | | // } |
| | | } |
| | | |
| | | /******************************************************************************* |