Browse Source

修复上报一次后无法再次写入文件的BUG

master
zhaohe 1 year ago
parent
commit
e3c51abe4b
  1. 1
      README.md
  2. 20
      app/src/ble_cmd_process_service.c
  3. 2
      app/src/board/board_light_ctrl.c
  4. 2
      app/src/heart_wave_sample_service.c
  5. 6
      app/src/sample_data_manager.c
  6. 3
      app/src/sample_data_manager.h
  7. 2
      dynamic_electrocardiograph_ble_server

1
README.md

@ -23,7 +23,6 @@ TODO
²βΚΤ:
1. ΅η³Ψ΅ηΑΏ²βΚΤ
2. ³δ΅η²εΘλΌμ²β

20
app/src/ble_cmd_process_service.c

@ -1,15 +1,15 @@
#include "ble_cmd_process_service.h"
#include "../../ify_hrs_protocol/heart_rate_sensor_protocol.h"
#include "basic/device_version_info_mgr.h"
#include "board/board.h"
#include "board/board_battery_state.h"
#include "board/board_ecg_sensor.h"
#include "config.h"
#include "one_conduction_board.h"
#include "sample_data_manager.h"
#include "zble_module.h"
#include "zdatachannel_service.h"
#include "basic/device_version_info_mgr.h"
#include "board/board_ecg_sensor.h"
#include "board/board_battery_state.h"
APP_TIMER_DEF(m_record_upload_tmr); //
APP_TIMER_DEF(m_record_upload_finish_packet_report_tmr); //
@ -58,7 +58,7 @@ int ble_stop_realtime_report() {
m_realtime_report_state = false;
return 0;
}
void ble_cmder_try_report_one_sample_data(uint32_t frameIndex, uint16_t data0, uint16_t data1, uint16_t data2, uint16_t data3,uint16_t data4) {
void ble_cmder_try_report_one_sample_data(uint32_t frameIndex, uint16_t data0, uint16_t data1, uint16_t data2, uint16_t data3, uint16_t data4) {
if (!m_realtime_report_state) {
return;
}
@ -216,6 +216,12 @@ int ble_start_upload_record(sample_data_filename_t* recordid) {
int ble_stop_upload_record() {
m_isupload_data_state = false;
app_timer_stop(m_record_upload_tmr);
if (m_upload_fd > 0) {
sample_data_mgr_close(m_upload_fd);
m_upload_fd = 0;
}
return 0;
}
bool ble_is_upload_record() { return m_isupload_data_state; }
@ -231,9 +237,7 @@ static void send_error_receipt(ify_hrs_packet_t* rxpacket, int32_t errorcode) {
txheader->cmd = rxpacket->cmd;
txheader->frame_index = rxpacket->frame_index;
txheader->frame_type = kifyhrs_pt_error_receipt;
txheader->frame_type = kifyhrs_pt_error_receipt;
receipt->errorcode = kifyhrs_ecode_cmd_not_support;
receipt->errorcode = errorcode;
zdatachannel_data_send2(txbuf, sendlen);
}
@ -417,7 +421,7 @@ void ble_cmder_process_rx(uint8_t* rx, int len) {
}
}
else if (cmd == ify_hrs_cmd_start_upload_record) { // 12 0x0C
else if (cmd == ify_hrs_cmd_start_upload_record) { // 12 0x0C
// 12-
start_upload_record_cmd_t* cmd = (start_upload_record_cmd_t*)rxheader->data;

2
app/src/board/board_light_ctrl.c

@ -56,7 +56,7 @@ void BoardLight_toggleGreenLightState() { BoardLight_setGreenLightState(!m_board
void BoardLight_setGreenLightState(bool state) {
m_boardlight_greenlightstate = state;
if (state) {
light_ctrl.seq_values.channel_0 = 95; // top_value
light_ctrl.seq_values.channel_0 = 90; // top_value
nrfx_pwm_simple_playback(&light_ctrl.driver, &light_ctrl.seq, 1, NRF_DRV_PWM_FLAG_LOOP);
} else {
nrfx_pwm_stop(&light_ctrl.driver, true);

2
app/src/heart_wave_sample_service.c

@ -87,7 +87,7 @@ static inline void prvf_light_block_trigger_event() {
event.val.little_data_block.data[i].data = m_sensor_little_frame_cache[i].data;
}
event.val.little_data_block.frameIndex = m_frame_index - LITTLE_DATA_BLOCK_FRAME_NUM;
ZLOGI("%d", event.val.little_data_block.frameIndex);
// ZLOGI("%d", event.val.little_data_block.frameIndex);
AppEvent_pushEvent(&event);
}

6
app/src/sample_data_manager.c

@ -5,7 +5,7 @@
#include "zeeprom_fs.h"
#include "znordic.h"
static sample_data_fileinfo_t fileinfocache[FILE_MAX_COUNT];
static sample_data_fileinfo_t fileinfocache[MAX_FILE_NUM];
static uint8_t fileinfocache_count = 0;
void sample_data_mgr_init() { zeeprom_fs_init(); }
@ -44,7 +44,7 @@ sample_data_fileinfo_list_t* sample_data_mgr_get_fileinfo_list() { //
return &fileinfo_list;
}
bool sample_data_mgr_storage_is_full() { return zeeprom_fs_get_file_num() >= FILE_MAX_COUNT; }
bool sample_data_mgr_storage_is_full() { return zeeprom_fs_get_file_num() >= MAX_FILE_NUM; }
int32_t sample_data_mgr_get_file_num() { return zeeprom_fs_get_file_num(); }
#if 1
@ -70,7 +70,7 @@ int32_t sample_data_mgr_open(sample_data_filename_t* filename, wrflag_t flag) {
* @brief ²é¿´ÎļşÊıÁ¿
*/
if (flag == kwrflag_write_only) {
if (zeeprom_fs_get_file_num() >= FILE_MAX_COUNT) {
if (zeeprom_fs_get_file_num() >= MAX_FILE_NUM) {
zeeprom_fs_delete_the_oldest_file();
}
}

3
app/src/sample_data_manager.h

@ -7,7 +7,6 @@
void sample_data_mgr_init();
#define FILE_MAX_COUNT MAX_FILE_NUM
typedef struct {
uint8_t year;
@ -26,7 +25,7 @@ typedef struct {
} sample_data_fileinfo_t;
typedef struct {
sample_data_fileinfo_t* fileinfo[FILE_MAX_COUNT];
sample_data_fileinfo_t* fileinfo[MAX_FILE_NUM];
int count;
} sample_data_fileinfo_list_t;

2
dynamic_electrocardiograph_ble_server

@ -1 +1 @@
Subproject commit 41e7b619f0e767affbc04172dd922819af27fda6
Subproject commit 718b1187ddec42d53c08267a63197f25fd1152dd
Loading…
Cancel
Save