Browse Source

update

master
zhaohe 1 year ago
parent
commit
daa4000f87
  1. 2
      app/src/app_ble_service.c
  2. 10
      app/src/board/board.h
  3. 8
      app/src/device_ctrl_service.c

2
app/src/app_ble_service.c

@ -321,7 +321,7 @@ static void prvf_process_ble_rx_data(void* p_event_data, uint16_t len) {
receipt->drop_state1 = 0x00; receipt->drop_state1 = 0x00;
receipt->device_state0.sampling_state = (DeviceCtrl_now_state() == kdevice_state_sampling); receipt->device_state0.sampling_state = (DeviceCtrl_now_state() == kdevice_state_sampling);
receipt->device_state0.report_state = m_realtime_report_state; receipt->device_state0.report_state = m_realtime_report_state;
receipt->device_state0.low_battery = (BoardBattery_get_battery_level() < 20);
receipt->device_state0.low_battery = (BoardBattery_get_battery_level() < APP_LOW_BATTERY_WARNING_LIMIT);
receipt->device_state0.full_storge = (SampleDataMgr_storageIsFull()); receipt->device_state0.full_storge = (SampleDataMgr_storageIsFull());
receipt->device_state1 = 0; receipt->device_state1 = 0;

10
app/src/board/board.h

@ -68,12 +68,14 @@
#define APP_MAX_EVEN_SIZE MAX(APP_TIMER_SCHED_EVENT_DATA_SIZE, sizeof(app_event_t)) #define APP_MAX_EVEN_SIZE MAX(APP_TIMER_SCHED_EVENT_DATA_SIZE, sizeof(app_event_t))
#define APP_EVENT_QUEUE_SIZE 100 #define APP_EVENT_QUEUE_SIZE 100
#define APP_AUTO_SLEEP_TIMEOUT_MS (10 * 1000)
#define APP_AUTO_SLEEP_TIMEOUT_MS (30 * 1000) // 自动休眠时间
#define APP_BYTE_EACH_FRAME 9 #define APP_BYTE_EACH_FRAME 9
#define APP_SENSOR_NUM 3 #define APP_SENSOR_NUM 3
#define APP_LOW_BATTERY_LIMIT 2
#define APP_LOW_BATTERY_LIMIT 2 // 低电量关机阈值
#define APP_LOW_BATTERY_POWER_ON_LIMIT 8 // 低电量关机阈值
#define APP_LOW_BATTERY_WARNING_LIMIT 10 // 低电量事件上报阈值
#define BLE_UNCONNECTED_OVERTIME_S 300
#define BLE_UNCONNECTED_OVERTIME_S 300 // 蓝牙未连接_心跳超时判定时间
#define ENABLE_AUTO_STOP_WHEN_BLE_DISCONNECTED 1
#define ENABLE_AUTO_STOP_WHEN_BLE_DISCONNECTED 1 // 蓝牙断开自动停止采集

8
app/src/device_ctrl_service.c

@ -174,6 +174,9 @@ static void app_event_listener(void* p_event_data, uint16_t event_size) { //
} else if (zble_module_is_connected() && zdatachannel_last_rx_data_haspassed_s() >= BLE_UNCONNECTED_OVERTIME_S) { } else if (zble_module_is_connected() && zdatachannel_last_rx_data_haspassed_s() >= BLE_UNCONNECTED_OVERTIME_S) {
ZLOGI("auto sleep because ble unconnected"); ZLOGI("auto sleep because ble unconnected");
prvf_change_to_standby_state(); prvf_change_to_standby_state();
} else if (BoardBattery_get_battery_level() < APP_LOW_BATTERY_LIMIT) {
ZLOGI("auto sleep because low battery");
prvf_change_to_standby_state();
} }
if (event->eventType == kevent_start_sample_cmd_event) { if (event->eventType == kevent_start_sample_cmd_event) {
@ -225,6 +228,9 @@ static void app_event_listener(void* p_event_data, uint16_t event_size) { //
} else if (m_sample_duration_ms != 0 && DeviceCtrl_cur_state_haspassed_ms() > m_sample_duration_ms) { } else if (m_sample_duration_ms != 0 && DeviceCtrl_cur_state_haspassed_ms() > m_sample_duration_ms) {
ZLOGI("stop sample because sample timeout"); ZLOGI("stop sample because sample timeout");
stopcapture = true; stopcapture = true;
} else if (BoardBattery_get_battery_level() < APP_LOW_BATTERY_LIMIT) {
ZLOGI("stop sample because low battery");
stopcapture = true;
} }
#ifdef ENABLE_AUTO_STOP_WHEN_BLE_DISCONNECTED #ifdef ENABLE_AUTO_STOP_WHEN_BLE_DISCONNECTED
else if (zdatachannel_last_rx_data_haspassed_s() > BLE_UNCONNECTED_OVERTIME_S) { else if (zdatachannel_last_rx_data_haspassed_s() > BLE_UNCONNECTED_OVERTIME_S) {
@ -294,7 +300,7 @@ void DeviceCtrl_init() {
// BoardLight_blockFlash(3, 100); // BoardLight_blockFlash(3, 100);
BoardBattery_load(); BoardBattery_load();
if (BoardBattery_get_battery_level() < APP_LOW_BATTERY_LIMIT) {
if (BoardBattery_get_battery_level() < APP_LOW_BATTERY_POWER_ON_LIMIT) {
BoardLight_blockFlash(3, 100); BoardLight_blockFlash(3, 100);
// ,使 // ,使

Loading…
Cancel
Save