zhaohe 1 year ago
parent
commit
070ed79048
  1. 3
      app/src/app_service/beep_ctrl.h
  2. 43
      app/src/app_service/display_ctrl_service/display_mgr.c
  3. 2
      app/src/app_service/ecg_service/ecg_service.c
  4. 4
      app/src/aproject_config/config.h
  5. 12
      app/src/one_conduction_main.c
  6. 13
      screen_res/font/data/config/array2ImgFrom.table
  7. 2
      screen_res/font/data/config/arrayCfg.table
  8. 3
      screen_res/font/data/config/bottomFrom.table
  9. 38
      scripter/flash.bat
  10. 1
      temp.txt

3
app/src/app_service/beep_ctrl.h

@ -10,7 +10,8 @@
#define START_SAMPLE_EFFECT kBoardBeepEffect_oneShortLongBeep
#define STOP_SAMPLE_EFFECT kBoardBeepEffect_oneShortLongBeep
#define POWER_ON_EFFECT kBoardBeepEffect_oneShortBeep
#define LEAD_OFF_EFFECT kBoardBeepEffect_continuousShortBeep
#define LEAD_OFF_EFFECT kBoardBeepEffect_threeShortBeep
#define LEAD_OFF_RECOVER_EFFECT kBoardBeepEffect_oneShortBeep
typedef enum {
kBoardBeepEffect_none = 0,

43
app/src/app_service/display_ctrl_service/display_mgr.c

@ -11,9 +11,9 @@
#include "ssd1306/driver_ssd1306_basic.h"
#include "ssd1306/wave_drawer.h"
//
#include "app_service/beep_ctrl.h"
#include "app_service/ecg_service/ecg_service.h"
#include "ssd1306_if_impl.h"
/***********************************************************************************************************************
* MARCO *
***********************************************************************************************************************/
@ -165,11 +165,32 @@ typedef struct {
int heartrate_x;
int heartrate_y;
bool in_error_page;
} sample_page_state_t;
sample_page_state_t m_sample_page_state;
static void page_sampling_show_error_info() {
if (m_sample_page_state.in_error_page) {
return;
}
m_sample_page_state.in_error_page = true;
ssd1306_basic_clear_gram();
uint8_t x = 0;
uint8_t y = 0;
uint8_t xchange, ychange;
x = compute_x_pos_by_center(SCREEN_CENTER_X, font24x24_zh_lib.widthPixel * 4);
y = compute_y_pos_by_center(SCREEN_CENTER_Y, font24x24_zh_lib.heightPixel);
ssd1306_basic_draw_str(x, y, &xchange, &ychange, "放上双手", &font24x24_zh_lib);
ssd1306_basic_gram_update();
}
static void page_sampling_load() {
sample_page_state_t* sps = &m_sample_page_state;
m_sample_page_state.in_error_page = false;
sample_page_state_t* sps = &m_sample_page_state;
sps->progress_x = SMAPLE_PAGE_START_X + 10;
sps->progress_y = SMAPLE_PAGE_START_Y + 3;
@ -208,7 +229,8 @@ static void page_sampling_load() {
void samplePage_update_state(int progress_s, int wave_y, bool leadoff, int heartrate, bool updateHeart, bool update_screen) { //
sample_page_state_t* sps = &m_sample_page_state;
m_sample_page_state.in_error_page = false;
sample_page_state_t* sps = &m_sample_page_state;
uint8_t xchange, ychange;
static bool heart_logo_state = false;
@ -259,7 +281,18 @@ static void page_sampling_tmr_cb() {
heartrate = 0;
}
samplePage_update_state(capturetime / 1000, wave_y, leadoff, heartrate, count % 15 == 0, count % 5 == 0);
if (leadoff) {
if (!m_sample_page_state.in_error_page) {
beep_set_effect(LEAD_OFF_EFFECT);
page_sampling_show_error_info();
}
} else {
if (m_sample_page_state.in_error_page) {
beep_set_effect(LEAD_OFF_RECOVER_EFFECT);
page_sampling_load();
}
samplePage_update_state(capturetime / 1000, wave_y, leadoff, heartrate, count % 15 == 0, count % 5 == 0);
}
}
/***********************************************************************************************************************
@ -337,7 +370,7 @@ static void page_prepare_sample_show(int progress) {
if (progress == 0) {
ssd1306_basic_draw_str(x, y, &xchange, &ychange, "放上双手", &font24x24_zh_lib);
}else{
} else {
ssd1306_basic_draw_str(x, y, &xchange, &ychange, "保持静止", &font24x24_zh_lib);
}

2
app/src/app_service/ecg_service/ecg_service.c

@ -227,7 +227,7 @@ static void leadoff_state_process(ads129x_capture_data_t* capture_data) {
}
if (leadoff != m_leadoffstate) {
if (m_leadoffstate && un_leadoffcnt > 1500) {
if (m_leadoffstate && un_leadoffcnt > 500) {
m_leadoffstate = false;
} else {
m_leadoffstate = true;

4
app/src/aproject_config/config.h

@ -7,10 +7,10 @@
#define CATEGORY "M1003" // µ¥µ¼Áª
#define MANUFACTURER_NAME "iflytop"
#define FIRMWARE_VERSION (1)
#define FIRMWARE_VERSION (2)
#define BLESTACK_VERSION 1
#define BOOTLOADER_VERSION 1
#define HARDWARE_VERSION (1)
#define HARDWARE_VERSION (2)
#define APP_COMPANY_IDENTIFIER 0xFFFF

12
app/src/one_conduction_main.c

@ -348,12 +348,9 @@ void on_zapp_ebus_event(void* p_event_data, uint16_t event_size) {
zapp_state_machine_change_state(kstate_mainPage);
} else {
if (event == kappevent_tmr_1s_scheduler_event) {
if (ecg_leadoff_detect()) {
m_capture_prepare_progress = 0;
dsp_mgr_page_sample_prepare_set_progress(m_capture_prepare_progress);
} else {
if (!ecg_leadoff_detect() && zapp_state_machine_haspassed_ms() > 1500) {
m_capture_prepare_progress++;
if (m_capture_prepare_progress < 4) {
m_capture_prepare_progress++;
dsp_mgr_page_sample_prepare_set_progress(m_capture_prepare_progress);
} else {
/**
@ -362,6 +359,9 @@ void on_zapp_ebus_event(void* p_event_data, uint16_t event_size) {
zapp_state_machine_change_state(kstate_capture);
beep_set_effect(POWER_ON_EFFECT);
}
} else {
m_capture_prepare_progress = 0;
dsp_mgr_page_sample_prepare_set_progress(m_capture_prepare_progress);
}
}
}
@ -457,7 +457,7 @@ void one_conduction_main() {
dsp_mgr_init();
ecg_service_init();
zapp_state_machine_change_state(kstate_prepare_capture);
// zapp_state_machine_change_state(kstate_prepare_capture);
zble_module_start_adv();
zapp_start_schedule();

13
screen_res/font/data/config/array2ImgFrom.table

@ -1,16 +1,17 @@
{
edtOffset="0";
rdScanModeH=0;
afterLoad=null;
cmbbxMode=1;
rdScanModeVH=1;
rdByteLsb=1;
rdComVcc=0;
edtImgW='8\r\n';
edtImgH="16";
rdScanModeHV=0;
edtArray=' { 0x08,0xF8,0x08,0x08,0x08,0xC8,0x18,0x00,0x00,0x3F,0x21,0x21,0x21,0x23,0x30,0x00, }/* 0, "中",Size:100, 25×25 */';
rdByteMsb=0;
rdScanModeV=0;
rdComGnd=1
rdComGnd=1;
rdScanModeHV=0;
afterLoad=null;
beforeSave=null;
rdByteLsb=1;
rdByteMsb=0;
rdScanModeH=0
}

2
screen_res/font/data/config/arrayCfg.table

@ -1,6 +1,6 @@
{
scanMode="VH";
isByteMsb=0;
txtLineCharMaxNum=20;
scanMode="VH";
isCommonGnd=1
}

3
screen_res/font/data/config/bottomFrom.table

@ -1,3 +1,4 @@
{
afterLoad=null
afterLoad=null;
beforeSave=null
}

38
scripter/flash.bat

@ -1,14 +1,42 @@
@echo off
echo "Start flashing..."
setlocal EnableDelayedExpansion
nrfjprog --memrd 0x10001080 > _temp.txt
set /p lot_string=<_temp.txt
nrfjprog --memrd 0x10001084 > _temp.txt
set /p id_string=<_temp.txt
del _temp.txt
for /L %%i in (0,1,7) do (
set "hex_digit=!lot_string:~12,1!"
set "lot_num=!lot_num!!hex_digit!"
set "lot_string=!lot_string:~1!"
)
for /L %%i in (0,1,7) do (
set "hex_digit=!id_string:~12,1!"
set "id_num=!id_num!!hex_digit!"
set "id_string=!id_string:~1!"
)
echo lot_num: %lot_num% id_num: %id_num%
nrfjprog --eraseall -f NRF52
@REM 烧录lot
nrfjprog -f nrf52 --memwr 0x10001080 --val 0x%lot_num%
@REM 烧录ID
nrfjprog -f nrf52 --memwr 0x10001084 --val 0x%id_num%
call scripter\unlock.bat
nrfjprog --program output/app_whole.hex -f NRF52 %烧录%
nrfjprog --program output/app_whole.hex --verify -f NRF52 %烧录%
if %errorlevel% neq 0 (
echo EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
echo E 烧录失败 E
echo EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
endlocal
exit /b 1
)
nrfjprog --reset -f NRF52 %复位%
@ -16,6 +44,7 @@ if %errorlevel% neq 0 (
echo EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
echo E 复位失败 E
echo EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
endlocal
exit /b 1
)
@ -25,3 +54,4 @@ echo - done
echo ---------------------------------------------------------------
endlocal

1
temp.txt

@ -0,0 +1 @@
0x10001084: FFFFFFFF |....|
Loading…
Cancel
Save