| | |
| | | { |
| | | bat_percent = 0; |
| | | } |
| | | else if(fVoltage_mv > 4200) |
| | | else if(fVoltage_mv > 4100) |
| | | { |
| | | bat_percent = 100; |
| | | } |
| | |
| | | userkey_state = 1; |
| | | keystarttime3 = HIDO_TimerGetTick(); |
| | | flag_first_TCPconnect = 1; |
| | | // TCPHeartBeatUpload(); |
| | | //UDPClient_UploadGPS(); |
| | | } |
| | | // if(HIDO_TimerGetTick() - keystarttime2>10) |
| | |
| | | keystarttime2 = HIDO_TimerGetTick(); |
| | | } |
| | | } |
| | | uint8_t guanjiflag_count=0; |
| | | void MinuteTask(void) |
| | | { |
| | | PCA9555_Set_One_Value_Output(ADC_MINIUS,0);//拉低 |
| | | delay_ms(100); |
| | | adc_get(&sample[0], NUM_SAMPLES, adc_callback);//adc采样 |
| | | if(bat_percent<1) |
| | | { |
| | | guanjiflag_count++; |
| | | } |
| | | |
| | | } |
| | | uint8_t jingzhi_flag=0; |
| | | void SecondTask(void) |
| | | { static uint8_t second_count; |
| | | if(second_count++>120) |
| | | if(second_count++>60) |
| | | { |
| | | second_count = 0; |
| | | MinuteTask(); |
| | |
| | | HIDO_TimerTick(); |
| | | // if(nomove_count<=g_com_map[NOMOVESLEEP_TIME])//防止溢出 |
| | | nomove_count++; |
| | | if(nomove_count>g_com_map[ALARM_DISTANCE1]) |
| | | { |
| | | jingzhi_flag=1; |
| | | } |
| | | // gaodu=GetPressAndHeight()*100; |
| | | // else{ |
| | | // nomove_count=g_com_map[NOMOVESLEEP_TIME]+1; |
| | |
| | | // g_com_map[GROUP_ID]=9; |
| | | group_id=g_com_map[GROUP_ID];//组ID |
| | | memcpy(&disoffset,&g_com_map[DIST_OFFSET],2); |
| | | // g_com_map[ALARM_DISTANCE1]=10; |
| | | warning_distance=g_com_map[ALARM_DISTANCE1]; |
| | | prewarning_distance=g_com_map[ALARM_DISTANCE2]; |
| | | send_struct.warnDistence=warning_distance; |
| | |
| | | |
| | | g_com_map[MODBUS_MODE] = 0; |
| | | log_4g_enable_flag =1;//g_com_map[LOG_4G_ENABLE]; |
| | | g_com_map[VERSION] = (2<<8)|13; |
| | | g_com_map[VERSION] = (2<<8)|15; |
| | | |
| | | |
| | | LOG_INFO(TRACE_MODULE_APP,"设备ID: %x .\r\n",dev_id); |
| | |
| | | { |
| | | WT588E_PLAY(14); |
| | | } |
| | | if(bat_percent<1&&bat_percent_only_one&&jiancebat_percent_flag) |
| | | if(bat_percent<1&&bat_percent_only_one&&jiancebat_percent_flag&&(guanjiflag_count>9)) |
| | | { |
| | | WT588E_PLAY(15); |
| | | userkey_state=3; |