From 0e8ebd14862cc8c2af2660d13f0afb2e777e1446 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Tue, 2 Jul 2024 13:31:59 +0800 Subject: [PATCH] v1 --- app/src/acid_dispenser_ble_slave_main.c | 13 +++++ .../app_basic_service/device_version_info_mgr.c | 4 +- app/src/app_service/light_ctrl.c | 2 + app/src/aproject_config/config.h | 57 ++-------------------- app/src/ble_data_processer_utils.c | 6 +++ libznordic | 2 +- protocol | 2 +- 7 files changed, 30 insertions(+), 56 deletions(-) diff --git a/app/src/acid_dispenser_ble_slave_main.c b/app/src/acid_dispenser_ble_slave_main.c index 0aeaff9..c7f69ad 100644 --- a/app/src/acid_dispenser_ble_slave_main.c +++ b/app/src/acid_dispenser_ble_slave_main.c @@ -116,6 +116,19 @@ void one_conduction_process_rx_packet(uint8_t* rx, int len) { else if (kproto_cmd_reset == cmd) { NVIC_SystemReset(); } + + else if (kproto_cmd_read_power == cmd) { + txheader->data.read_power.power = 100; + send_success_receipt(txheader); + } + + else if (kproto_cmd_read_version == cmd) { + txheader->data.read_version.firmware_version = FIRMWARE_VERSION; + txheader->data.read_version.blestack_version = BLESTACK_VERSION; + txheader->data.read_version.bootloader_version = BOOTLOADER_VERSION; + txheader->data.read_version.hardware_version = HARDWARE_VERSION; + send_success_receipt(txheader); + } } /*********************************************************************************************************************** diff --git a/app/src/app_basic_service/device_version_info_mgr.c b/app/src/app_basic_service/device_version_info_mgr.c index d2fa2dc..5ebf4fc 100644 --- a/app/src/app_basic_service/device_version_info_mgr.c +++ b/app/src/app_basic_service/device_version_info_mgr.c @@ -54,9 +54,9 @@ void device_info_read_sn(sn_t *sn) { uint32_t id = NRF_UICR->CUSTOMER[1]; static char sn_str[15]; if ((lot == 0 && id == 0) || lot == 0xffffffff || id == 0xffffffff) { - sprintf(sn_str, "AciDisp%02d%03d", 0, 0); + sprintf(sn_str, "%s%02d%03d", CATEGORY, 0, 0); } else { - sprintf(sn_str, "AciDisp%02d%03d", lot, id); + sprintf(sn_str, "%s%02d%03d", CATEGORY, lot, id); } memcpy(sn->sn, sn_str, sizeof(sn->sn)); } diff --git a/app/src/app_service/light_ctrl.c b/app/src/app_service/light_ctrl.c index d91f4fb..f5ecb2c 100644 --- a/app/src/app_service/light_ctrl.c +++ b/app/src/app_service/light_ctrl.c @@ -3,6 +3,7 @@ #include "aproject_config/config.h" #include "nrf_gpio.h" #include "znordic.h" +#if 0 #define BLINK_PERIOD_MS (100) #define QUICK_BLINK_PERIOD_MS (100) @@ -110,3 +111,4 @@ void light_ctrl_green_block_flash(int times, int periodms){ } } +#endif \ No newline at end of file diff --git a/app/src/aproject_config/config.h b/app/src/aproject_config/config.h index b0fb598..16452c6 100644 --- a/app/src/aproject_config/config.h +++ b/app/src/aproject_config/config.h @@ -1,62 +1,15 @@ #pragma once /*********************************************************************************************************************** - * 设备信息配置 * + * 璁惧淇℃伅閰嶇疆 * ***********************************************************************************************************************/ -#define CATEGORY "M1003" // 单导联 +#define CATEGORY "AciDisp" // #define MANUFACTURER_NAME "iflytop" -#define FIRMWARE_VERSION (6) -#define BLESTACK_VERSION 1 -#define BOOTLOADER_VERSION 1 +#define FIRMWARE_VERSION (1) +#define BLESTACK_VERSION (1) +#define BOOTLOADER_VERSION (1) #define HARDWARE_VERSION (2) #define APP_COMPANY_IDENTIFIER 0xFFFF - -/******************************************************************************* - * BEEP * - *******************************************************************************/ -#define BEEP_PIN 1 -#define BEEP_PWM_INSTANCE 0 - -#define BATTERY_ADC_PIN NRF_SAADC_INPUT_AIN3 -#define BATTERY_ADC_CHANNEL 1 // 不重复即可 -#define BATTERY_CHARGE_DETECT_PIN 6 - -/** - * @brief - */ - -#define MAX_STORAGE_TIMEOUT_S (60 * 10) // 最长存储时间 -#define MAX_STORAGE_SIZE (MAX_STORAGE_TIMEOUT_S * 400) // 存储最大限制为 (256-8)kbyte -#define MAX_FILE_NUM 10 // 最多存储条目数 -#define SAMPLE_RATE 500 // 采样率 -#define SAMPLE_PRECISION 32 // 采样精度 -#define AUTOMATIC_SLEEP_TIME 30000 // 开机后自动休眠时间 -#define SAMPLE_MIN_TIME_S (30.0) // 采样最小时间 -#define LITTLE_DATA_BLOCK_FRAME_NUM 50 // 每次多少帧上报一次 - -#define KEEP_STILL_OVERTIME_MS_1P5 1500 // 保持静止超时时间的1/6 - -#define LED_GREEN_PIN 9 -#define LED_BLUE_PIN 10 -#define LED_RED_PIN 39 - -#define HEART_WAVE_SAMPLE_TMR_INSTANCE 3 - -#define LIGHT_PWM_INSTANCE 1 - -// #define APP_BATTERY_PROTECT_LEVEL 2 // 低于此电量不能开机,保护电池 -// #define APP_AUTO_STANDY_BATTERY_LEVEL 5 // 低于此电量自动待机,保持时钟 -// #define APP_WORK_BATTERY_LEVEL 10 // Main初始化时候和从standy切换到work的时候,检查这个电量 -#define APP_LOW_BATTERY_WARNING_LIMIT 20 // - -#define LOW_BATTERY_REMINDER_DELAY_MS 3000 -#define BLE_UNCONNECTED_OVERTIME_S 300 - -/*********************************************************************************************************************** - * ADS1291_IF * - ***********************************************************************************************************************/ - -#define ADS1291_SPI_INSTANCE 2 diff --git a/app/src/ble_data_processer_utils.c b/app/src/ble_data_processer_utils.c index 4cdb59e..3817845 100644 --- a/app/src/ble_data_processer_utils.c +++ b/app/src/ble_data_processer_utils.c @@ -27,6 +27,12 @@ void send_success_receipt(hand_acid_ble_proto_t* rxpacket) { txheader->frame_index = rxpacket->frame_index; txheader->frame_type = kproto_cmd_receipt; + if (txheader->cmd == kproto_cmd_read_power) { + sendlen = HAND_ACID_BLE_BASE_SIZE + sizeof(txheader->data.read_power); + } else if (txheader->cmd == kproto_cmd_read_version) { + sendlen = HAND_ACID_BLE_BASE_SIZE + sizeof(txheader->data.read_version); + } + zdatachannel_data_send2(_bletxbuf, sendlen); } diff --git a/libznordic b/libznordic index 817961a..580f3fa 160000 --- a/libznordic +++ b/libznordic @@ -1 +1 @@ -Subproject commit 817961a6ee6a75c2eb9ae6e02a166df822de0f45 +Subproject commit 580f3fa2c782904ac2e26dfa73db6f7134fd8eb3 diff --git a/protocol b/protocol index f2646b0..36ac082 160000 --- a/protocol +++ b/protocol @@ -1 +1 @@ -Subproject commit f2646b051b0d2661fb354dd442e82f9c303512d1 +Subproject commit 36ac082e16852c6b5e3ecc7bb36899286191a0e8