| | |
| | | uint8_t group_id,enable_sleep_count; |
| | | uint32_t dev_id; |
| | | uint16_t disoffset; |
| | | uint16_t set_mk_time; |
| | | uint8_t flag_sleeptimer,flag_secondtask,secondtask_count; |
| | | float nomove_count; |
| | | // Default pool descriptor. |
| | |
| | | } |
| | | uint8_t bat_percent; |
| | | uint8_t stationary_flag; |
| | | extern uint8_t send_flag; |
| | | extern uint8_t txdone; |
| | | void mcu_deep_sleep(void) |
| | | { |
| | | uint32_t lock; |
| | |
| | | // Disable watchdog timer |
| | | wdt_close(WDT_ID0); |
| | | LOG_INFO(TRACE_MODULE_APP, "UCI FiRa example\r\n"); |
| | | // delay_ms(300); |
| | | // LOG_INFO(TRACE_MODULE_APP, "进入休眠模式\r\n");//测试 |
| | | // power_init(); |
| | | // mcu_deep_sleep(); |
| | | |
| | | if(gpio_pin_get_val(SLEEP_PIN)) |
| | | { |
| | | if(gpio_pin_get_val(MODE_CHANGE_PIN))//记得改回来与正式的相反 |
| | |
| | | power_manage(); |
| | | if(!gpio_pin_get_val(SLEEP_PIN)) |
| | | { |
| | | gpio_pin_clr(LORA_NRST);//lora休眠 |
| | | LOG_INFO(TRACE_MODULE_APP, "进入休眠模式\r\n"); |
| | | mcu_deep_sleep(); |
| | | } |
| | |
| | | sleep_timer_start(__MS_TO_32K_CNT(SLEEP_TIMER_NUM));//测试 |
| | | while (1) |
| | | { |
| | | if(send_flag) |
| | | { |
| | | LOG_INFO(TRACE_MODULE_APP,"发送数量%d. \r\n",txdone); |
| | | send_flag=0; |
| | | } |
| | | uwb_app_poll();//我们的测距逻辑 |
| | | if(flag_secondtask) |
| | | { |
| | |
| | | Lora_Tx_Poll(); |
| | | if(!gpio_pin_get_val(SLEEP_PIN)) |
| | | { |
| | | //gpio_pin_clr(LORA_NRST);//lora休眠 |
| | | LOG_INFO(TRACE_MODULE_APP, "进入休眠模式\r\n"); |
| | | mcu_deep_sleep(); |
| | | } |
| | |
| | | }else{ |
| | | //delay_ms(300); |
| | | LOG_INFO(TRACE_MODULE_APP, "进入休眠模式\r\n"); |
| | | //gpio_pin_clr(LORA_NRST);//lora休眠 |
| | | // spi_close(SPI_ID0); |
| | | //lora_in_sleep(); |
| | | power_init(); |
| | | mcu_deep_sleep(); |
| | | } |