|
|
@ -32,6 +32,7 @@ device_state_t DeviceCtrl_now_state(); |
|
|
|
static void state_machine_driver_tmr_cb(void* p_context) { // |
|
|
|
static app_event_t appevent; |
|
|
|
appevent.eventType = kevent_tmr_scheduler; |
|
|
|
wd_feed(); |
|
|
|
AppEvent_pushEvent(&appevent); |
|
|
|
} |
|
|
|
/** |
|
|
@ -237,12 +238,6 @@ static void app_event_listener(void* p_event_data, uint16_t event_size) { // |
|
|
|
ZLOGI("stop sample because low battery"); |
|
|
|
stopcapture = true; |
|
|
|
} |
|
|
|
#ifdef ENABLE_AUTO_STOP_WHEN_BLE_DISCONNECTED |
|
|
|
else if (zdatachannel_last_rx_data_haspassed_s() > BLE_UNCONNECTED_OVERTIME_S) { |
|
|
|
ZLOGI("stop sample because ble unconnected"); |
|
|
|
stopcapture = true; |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
if (stopcapture) { |
|
|
|
// 关闭文件 |
|
|
@ -269,6 +264,9 @@ static void app_event_listener(void* p_event_data, uint16_t event_size) { // |
|
|
|
void DeviceCtrl_startSample(int duration_s) { |
|
|
|
ZLOGI("start sample %d", duration_s); |
|
|
|
m_sample_duration_ms = duration_s * 1000; |
|
|
|
if (duration_s == 0) { |
|
|
|
m_sample_duration_ms = 2 * 60 * 1000; // 两分钟 |
|
|
|
} |
|
|
|
static app_event_t event; |
|
|
|
event.eventType = kevent_start_sample_cmd_event; |
|
|
|
AppEvent_pushEvent(&event); |
|
|
@ -319,6 +317,8 @@ void DeviceCtrl_init() { |
|
|
|
// 切换到待机状态 |
|
|
|
prvf_change_to_ready_state(); |
|
|
|
|
|
|
|
wd_init(); |
|
|
|
|
|
|
|
ZERROR_CHECK(app_timer_create(&m_state_machine_driver_tmr, APP_TIMER_MODE_REPEATED, state_machine_driver_tmr_cb)); |
|
|
|
ZERROR_CHECK(app_timer_start(m_state_machine_driver_tmr, APP_TIMER_TICKS(100), NULL)); // 200HZ采样 |
|
|
|
} |
|
|
|