diff --git a/app/app.uvoptx b/app/app.uvoptx
index 0654d60..fa2d23b 100644
--- a/app/app.uvoptx
+++ b/app/app.uvoptx
@@ -135,7 +135,6 @@
0
DLGUARM
- d
0
@@ -148,7 +147,24 @@
UL2CM3(-S0 -C0 -P0 -FD20000000 -FC4000 -FN2 -FF0nrf52xxx -FS00 -FL0200000 -FF1nrf52xxx_uicr -FS110001000 -FL11000 -FP0($$Device:nRF52833_xxAA$Flash\nrf52xxx.flm) -FP1($$Device:nRF52833_xxAA$Flash\nrf52xxx_uicr.flm))
-
+
+
+ 0
+ 0
+ 125
+ 1
+ 207178
+ 0
+ 0
+ 0
+ 0
+ 0
+ 1
+ .\src\device_ctrl_service.c
+
+ \\nrf52833_xxaa\src/device_ctrl_service.c\125
+
+
0
diff --git a/app/src/app_ble_service.c b/app/src/app_ble_service.c
index e210a8c..ef7d527 100644
--- a/app/src/app_ble_service.c
+++ b/app/src/app_ble_service.c
@@ -240,12 +240,14 @@ static void prvf_process_ble_rx_data(void* p_event_data, uint16_t len) {
}
else if (cmd == ify_hrs_cmd_start_capture) {
- hwss_start_capture();
+ // hwss_start_capture();
+ DeviceCtrl_startSample();
send_success_receipt(rxheader, 0);
}
else if (cmd == ify_hrs_cmd_stop_capture) {
- hwss_stop_capture();
+ // hwss_stop_capture();
+ DeviceCtrl_stopSample();
send_success_receipt(rxheader, 0);
}
@@ -290,9 +292,9 @@ static void prvf_process_ble_rx_data(void* p_event_data, uint16_t len) {
sample_data_fileinfo_t* fileinfo = recordlist->fileinfo[recordoff];
memcpy(receipt->record_id, fileinfo->filename, 6);
- receipt->frameNum = fileinfo->size / 2; // 2byte per frame
+ receipt->frameNum = fileinfo->size / APP_BYTE_EACH_FRAME;
receipt->dataSize = fileinfo->size;
- receipt->sensorNum = 1;
+ receipt->sensorNum = APP_SENSOR_NUM;
receipt->captureRate = SAMPLE_RATE / 10;
receipt->capturePrecision = SAMPLE_PRECISION;
receipt->compressAlgorithm = 0;
diff --git a/app/src/board/board.h b/app/src/board/board.h
index 6b643dc..de42ee3 100644
--- a/app/src/board/board.h
+++ b/app/src/board/board.h
@@ -66,4 +66,6 @@
#define APP_MAX_EVEN_SIZE MAX(APP_TIMER_SCHED_EVENT_DATA_SIZE, sizeof(app_event_t))
#define APP_EVENT_QUEUE_SIZE 20
-#define APP_AUTO_SLEEP_TIMEOUT_MS (10 * 1000)
\ No newline at end of file
+#define APP_AUTO_SLEEP_TIMEOUT_MS (10 * 1000)
+#define APP_BYTE_EACH_FRAME 9
+#define APP_SENSOR_NUM 3
\ No newline at end of file
diff --git a/app/src/device_ctrl_service.c b/app/src/device_ctrl_service.c
index 6f7698c..552a539 100644
--- a/app/src/device_ctrl_service.c
+++ b/app/src/device_ctrl_service.c
@@ -109,8 +109,14 @@ static sample_data_filename_t* cratefilename() {
return &sampledata_file_name;
}
-static void prvf_change_to_standby_state() { poweroff(); }
-static void prvf_change_to_ready_state() { poweron(); }
+static void prvf_change_to_standby_state() {
+ poweroff();
+ DeviceCtrl_change_to_state(kdevice_state_standby);
+}
+static void prvf_change_to_ready_state() {
+ poweron();
+ DeviceCtrl_change_to_state(kdevice_state_ready);
+}
static const char* dropstate(uint8_t drop0, uint8_t drop1) {
static char state[128];
sprintf(state, "drop0:%d%d%d%d-%d%d%d%d drop1:%d%d%d%d-%d%d%d%d", //
@@ -145,6 +151,7 @@ static void app_event_listener(void* p_event_data, uint16_t event_size) { //
/*******************************************************************************
* 状态机 *
*******************************************************************************/
+ // ZLOGI("state %d", m_device_state);
if (m_device_state == kdevice_state_standby) {
// 休眠模式现在是深度睡眠,所以永远不会触发这个回调
}
@@ -156,6 +163,7 @@ static void app_event_listener(void* p_event_data, uint16_t event_size) { //
}
if (event->eventType == kevent_start_sample_cmd_event) {
+ ZLOGI("start sample");
// SD卡连接到单片机
SampleDataMgr_changeToLocalMode();
// 创建文件
@@ -184,8 +192,8 @@ static void app_event_listener(void* p_event_data, uint16_t event_size) { //
uint8_t drop0 = hwss_get_drop_state0();
uint8_t drop1 = hwss_get_drop_state1();
- if (drop0 || drop1) {
- ZLOGI("drop %s", dropstate(drop0, drop1));
+ if ((drop0 || drop1) && event->eventType == kevent_tmr_scheduler) {
+ ZLOGI("[%d] drop %s", znordic_getpower_on_ms(), dropstate(drop0, drop1));
}
bool stopcapture = false;
diff --git a/app/src/heart_wave_sample_service.c b/app/src/heart_wave_sample_service.c
index ffa129a..f5df314 100644
--- a/app/src/heart_wave_sample_service.c
+++ b/app/src/heart_wave_sample_service.c
@@ -263,7 +263,7 @@ static void ads1293_ready_pin_irq(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t a
prvf_trigger_sensor_drop_event(m_lodstate0, m_lodstate1);
}
} else {
- if (!(m_lodstate0 && m_lodstate1)) {
+ if (!(m_lodstate0 || m_lodstate1)) {
m_drop_state_triggered = false;
}
}