| | |
| | | //deca_sleep(1000); |
| | | |
| | | g_com_map[GROUP_ID]=3; |
| | | g_com_map[VERSION] = (3<<8)|1; |
| | | g_com_map[VERSION] = (3<<8)|6; |
| | | |
| | | if (g_com_map[COM_INTERVAL] <50) |
| | | { |
| | |
| | | uwbled=WHITE; |
| | | loraled=WHITE; |
| | | powerled=WHITE; |
| | | |
| | | Set4LEDColor(uwbled,gpsled,loraled,powerled); |
| | | if(HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_12)==0) |
| | | { |
| | | powercount = 0; |
| | |
| | | while(1) |
| | | { |
| | | |
| | | if((HIDO_TimerGetTick() - l_u32QXpowerTick) >=100) |
| | | // if((HIDO_TimerGetTick() - l_u32QXpowerTick) >=100) |
| | | { |
| | | HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_RESET); |
| | | HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_RESET); |
| | |
| | | loraled = 1; |
| | | HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_SET); |
| | | } |
| | | extern uint8_t ledonflag; |
| | | extern uint32_t ledontime; |
| | | void PowerLedTask(void) |
| | | { |
| | | static u8 powerled_state=0; |
| | |
| | | chargedbg_flag = 0; |
| | | |
| | | } |
| | | if(HIDO_TimerGetTick()%1000<50 ) |
| | | if(HIDO_TimerGetTick()-ledontime>100&&ledonflag==1) |
| | | { |
| | | // if(powerled_state==0) |
| | | ledonflag=0; |
| | | Set4LEDColor_Off(); |
| | | } |
| | | // else |
| | | // { |
| | | ////// if(bat_percent>15) |
| | | ////// { |
| | | ////// powerled = BLUE; |
| | | ////// }else{ |
| | | ////// powerled = RED; |
| | | ////// } |
| | | // powerled_state = 1; |
| | | //// // bat_percent = Battery_GetPercentage(); |
| | | ////// Set4LEDColor(uwbled,gpsled,loraled,powerled); |
| | | // } |
| | | }else |
| | | { |
| | | // if(powerled_state) |
| | | { |
| | | powerled_state = 0; |
| | | // powerled = LEDOFF; |
| | | // uwbled = LEDOFF; |
| | | // gpsled = LEDOFF; |
| | | // loraled = LEDOFF; |
| | | // Set4LEDColor(uwbled,gpsled,loraled,powerled); |
| | | Set4LEDColor_Off(); |
| | | } |
| | | |
| | | } |
| | | //// if(powerled_state) |
| | | // { |
| | | // powerled_state = 0; |
| | | //// powerled = LEDOFF; |
| | | //// uwbled = LEDOFF; |
| | | //// gpsled = LEDOFF; |
| | | //// loraled = LEDOFF; |
| | | //// Set4LEDColor(uwbled,gpsled,loraled,powerled); |
| | | // Set4LEDColor_Off(); |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | |
| | | |
| | | if(HIDO_TimerGetTick()-adctick>6000) //10分钟采样一次 电量 |
| | | { |
| | | adctick = HIDO_TimerGetTick(); |
| | |
| | | } |
| | | } |
| | | } |
| | | if(bat_percent<=1) |
| | | { |
| | | HAL_GPIO_WritePin(GPIOA, GPIO_PIN_12, GPIO_PIN_RESET); |
| | | HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_RESET); |
| | | HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET); |
| | | } |
| | | } |
| | | |
| | | extern uint32_t main_time; |
| | |
| | | char str[17]= {"AT+IPR=9600;&W\r\n"}; |
| | | extern UART_HandleTypeDef huart5; |
| | | extern uint8_t stop_flag; |
| | | extern uint16_t beepontime; |
| | | u32 keystarttime,keystarttime2; |
| | | extern uint8_t userkey_state4g; |
| | | void UserKeyTask(void) |
| | | { |
| | | if(!HAL_GPIO_ReadPin(GPIOB,GPIO_PIN_1)) |
| | | { |
| | | if(HIDO_TimerGetTick() - keystarttime>1000) |
| | | { |
| | | beepontime = 2; |
| | | userkey_state4g = 1; |
| | | // userkey_state = 1; |
| | | // heartbeasend_flag = 1; |
| | | keystarttime = HIDO_TimerGetTick(); |
| | | } |
| | | }else |
| | | { |
| | | keystarttime = HIDO_TimerGetTick(); |
| | | keystarttime2 = HIDO_TimerGetTick(); |
| | | } |
| | | if(beepontime>0) |
| | | {Beep_On();} |
| | | else |
| | | {Beep_Off();} |
| | | Sleep_Panduan_Poll(); |
| | | |
| | | } |
| | | void Main_Poll() |
| | | { |
| | | // if(main_time>10&&only_one_flag==0) |
| | |
| | | HIDO_ATLitePoll(); |
| | | UDPClient_Poll(); |
| | | HAL_IWDG_Refresh(&hiwdg); |
| | | PowerDownDetect(); |
| | | PowerDownDetect(); |
| | | UserKeyTask(); |
| | | Sleep_Panduan_Poll(); |
| | | |
| | | } |
| | | // if(AIR780E_IsIPIdle() && Socket_IsSendQueueEmpty(0)) |
| | | // { |