Compare commits
2 Commits
e06c240191
...
e5afe5ef93
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e5afe5ef93 | ||
![]() |
6b7a65900a |
12
.vscode/settings.json
vendored
Normal file
12
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"typedef.h": "c",
|
||||
"app_temperature.h": "c",
|
||||
"tuya_ble_stdlib.h": "c",
|
||||
"xutility": "c",
|
||||
"tuya_ble_type.h": "c",
|
||||
"initializer_list": "c",
|
||||
"type_traits": "c",
|
||||
"event.h": "c"
|
||||
}
|
||||
}
|
@ -48,6 +48,8 @@ tuya_ble_status_t tuya_ble_dequeue(tuya_ble_queue_t *q, void *out);
|
||||
void tuya_ble_queue_decrease(tuya_ble_queue_t *q);
|
||||
void tuya_ble_queue_flush(tuya_ble_queue_t *q);
|
||||
uint8_t tuya_ble_get_queue_used(tuya_ble_queue_t *q);
|
||||
bool tuya_ble_queue_isFull(tuya_ble_queue_t *q);
|
||||
uint8_t tuya_ble_queue_size(tuya_ble_queue_t* q);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "tuya_ble_stdlib.h"
|
||||
#include "tuya_ble_queue.h"
|
||||
#include "tuya_ble_type.h"
|
||||
|
||||
#include "app_temperature.h"
|
||||
tuya_ble_status_t tuya_ble_queue_init(tuya_ble_queue_t *q, void *buf, uint8_t queue_size, uint8_t elem_size)
|
||||
{
|
||||
if (buf == NULL || q == NULL) {
|
||||
@ -98,3 +98,10 @@ uint8_t tuya_ble_get_queue_used(tuya_ble_queue_t *q)
|
||||
return q->used;
|
||||
}
|
||||
|
||||
bool tuya_ble_queue_isFull(tuya_ble_queue_t *q) {
|
||||
return q->used >= q->size;
|
||||
}
|
||||
|
||||
uint8_t tuya_ble_queue_size(tuya_ble_queue_t* q) {
|
||||
return q->size;
|
||||
}
|
@ -77,8 +77,8 @@ void app_var_init(void)
|
||||
app_var.play_poweron_tone = 1;
|
||||
|
||||
app_var.auto_off_time = TCFG_AUTO_SHUT_DOWN_TIME;
|
||||
app_var.warning_tone_v = 340;
|
||||
app_var.poweroff_tone_v = 330;
|
||||
app_var.warning_tone_v = 365;
|
||||
app_var.poweroff_tone_v = 360;
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "asm/charge.h"
|
||||
#include "app_temperature.h"
|
||||
#include "typedef.h"
|
||||
|
||||
#include "tuya_ble_queue.h"
|
||||
#include "le_common.h"
|
||||
#include "cpu.h"
|
||||
#include "timer.h"
|
||||
@ -20,8 +20,10 @@
|
||||
#include "examples/trans_data/ble_trans_profile.h"
|
||||
//#include "ble_trans_profile.h"
|
||||
static int led_state = 0;
|
||||
static u16 temer_temperature_detect = 0;
|
||||
static u16 temer_sleep = 0;
|
||||
static u16 timer_temperature_detect = 0;
|
||||
static u16 timer_sleep = 0;
|
||||
//static u16 timer_work = 0;
|
||||
static int16_t ADJ_temp = 0;
|
||||
|
||||
app_dev_info_t dev_info;
|
||||
//struct app_dev_config_t dev_config;
|
||||
@ -68,13 +70,13 @@ void ble_receive_callback(u8* data,u16 len){
|
||||
if(strstr(data,"AT^TEMP:") != NULL){
|
||||
u8 str_get_temp[64] = {0};
|
||||
memset(str_get_temp,0,sizeof(str_get_temp));
|
||||
sprintf(str_get_temp,"AT^TEMP:%d,%d,%d", dev_info.temperature_sensor/10, dev_info.temperature_sensor/10, dev_info.temperature_sensor/10);
|
||||
sprintf(str_get_temp,"AT^TEMP:%d,%d,%d,%d", dev_info.temperature_sensor/10, dev_info.temperature_sensor/10, dev_info.temperature_sensor/10, dev_info.temperature_state);
|
||||
ble_send_data(&str_get_temp,strlen(str_get_temp));
|
||||
}
|
||||
else if(strstr(data,"AT+TEMP=") != NULL){
|
||||
u8 str_get_temp[64] = {0};
|
||||
memset(str_get_temp,0,sizeof(str_get_temp));
|
||||
sprintf(str_get_temp,"AT+TEMP=%d,%d,%d", dev_info.temperature_sensor/10, dev_info.temperature_sensor/10, dev_info.temperature_sensor/10);
|
||||
sprintf(str_get_temp,"AT+TEMP=%d,%d,%d,%d", dev_info.temperature_sensor/10, dev_info.temperature_sensor/10, dev_info.temperature_sensor/10, dev_info.temperature_state);
|
||||
ble_send_data(&str_get_temp,strlen(str_get_temp));
|
||||
}
|
||||
//BATT 真实电压值
|
||||
@ -121,11 +123,31 @@ void ble_receive_callback(u8* data,u16 len){
|
||||
memset(str_adj,0,sizeof(str_adj));
|
||||
sprintf(str_adj,"AT+ADJ37=OK");
|
||||
ble_send_data(&str_adj,strlen(str_adj));
|
||||
|
||||
u16 temp = dev_info.temperature_sensor;
|
||||
ADJ_temp = dev_info.temperature_sensor - BLE_ADJUST_TEMP_37 ;
|
||||
if (ADJ_temp > 5000 || ADJ_temp < -5000) {
|
||||
ADJ_temp = 0;
|
||||
}
|
||||
syscfg_write(ADJ_TEMP_CONFIG, &ADJ_temp,sizeof(ADJ_temp));
|
||||
|
||||
}
|
||||
else{
|
||||
printf("unknow cmd\n");
|
||||
}
|
||||
}
|
||||
static u16 blink_timer_id = 0;
|
||||
void temperature_poweron_led_timeout(){
|
||||
temperature_work_led(0);
|
||||
}
|
||||
static void blink_led_callback(void *priv) {
|
||||
temperature_work_led(1);
|
||||
sys_s_hi_timerout_add(NULL, temperature_poweron_led_timeout, 50); // 0.05 秒后关闭
|
||||
}
|
||||
void ble_led_timeout() {
|
||||
temperature_work_led(0);
|
||||
blink_timer_id = usr_timer_add(NULL, blink_led_callback, 6000, 1);
|
||||
}
|
||||
/**
|
||||
*
|
||||
*当有蓝牙连接1 蓝牙断开
|
||||
@ -134,8 +156,10 @@ void ble_on_connect_change(u8 is_connect){
|
||||
printf("ble_on_connect_change :(state:%d) \n",is_connect);
|
||||
if(is_connect){
|
||||
temperature_work_led(1);
|
||||
sys_s_hi_timerout_add(NULL,ble_led_timeout,3000);
|
||||
}else{
|
||||
temperature_work_led(0);
|
||||
usr_timer_del(blink_timer_id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -371,7 +395,10 @@ static uint8_t reversal(uint8_t data)
|
||||
return -4;
|
||||
}
|
||||
}
|
||||
char err_code[4][20] = {"NOT Connected", "No DONE signal", "DAT Recv Err", "CRC Err"};
|
||||
|
||||
char err_code[4][20] = {"NOT Connected", "No DONE signal", "DAT Recv Err", "CRC Err"};
|
||||
static tuya_ble_queue_t temp_queue;
|
||||
u16 buffer[MAX_SIZE];
|
||||
void nst1002_read_temperatura(void)
|
||||
{
|
||||
if(charge_state){
|
||||
@ -381,7 +408,6 @@ static uint8_t reversal(uint8_t data)
|
||||
int err, ei;
|
||||
float dtmp;
|
||||
int16_t cal;
|
||||
|
||||
// NTC VDD
|
||||
gpio_set_direction(IO_PORTB_05,0);
|
||||
gpio_direction_output(IO_PORTB_05, 1);
|
||||
@ -402,22 +428,47 @@ static uint8_t reversal(uint8_t data)
|
||||
|
||||
printf("Temp: %d\r\n\r\n", temp_value);
|
||||
|
||||
|
||||
|
||||
//FF
|
||||
//BBOOEEb 2字节体温 2字节物温 2字节环温 1字节电量
|
||||
u16 body = (u16)temp_value;
|
||||
u16 obj = (u16)temp_value;
|
||||
u16 ntc = (u16)0;
|
||||
u8 battery = 99;
|
||||
// u8 battery = 99;
|
||||
u8 battery = get_vbat_percent();
|
||||
u16 batt_val = 0;
|
||||
|
||||
if (!batt_val) {
|
||||
batt_val = get_vbat_level();
|
||||
} else {
|
||||
batt_val = (get_vbat_level() + batt_val) / 2;
|
||||
}
|
||||
//batt
|
||||
battery = get_cur_battery_level() *10;
|
||||
// battery = get_cur_battery_level() *10;
|
||||
if (ADJ_temp != 0) {
|
||||
int16_t temp_body = (int16_t)body;
|
||||
int16_t temp_obj = (int16_t)obj;
|
||||
|
||||
temp_body -= ADJ_temp;
|
||||
temp_obj -= ADJ_temp;
|
||||
|
||||
body = (temp_body > 0) ? (u16)temp_body : 0;
|
||||
obj = (temp_obj > 0) ? (u16)temp_obj : 0;
|
||||
}
|
||||
|
||||
if(body == 0 && obj == 0 ){
|
||||
printf("error data ...\r\n");
|
||||
return ;
|
||||
}
|
||||
|
||||
dev_info.temperature_sensor = body;
|
||||
dev_info.temperature_ntc = body;
|
||||
dev_info.batt_percent = battery;
|
||||
dev_info.batt_val = get_vbat_value();
|
||||
dev_info.batt_val = batt_val;
|
||||
|
||||
printf("battery: %d\r\n",battery);
|
||||
|
||||
u8 ff_temp_data[7] = {0};
|
||||
u8 ff_temp_data[9] = {0};
|
||||
//body
|
||||
ff_temp_data[0] = (body >> 8) & 0xFF;
|
||||
ff_temp_data[1] = (body) & 0xFF;
|
||||
@ -430,6 +481,9 @@ static uint8_t reversal(uint8_t data)
|
||||
|
||||
ff_temp_data[6] = battery & 0xFF;
|
||||
|
||||
ff_temp_data[7] = (batt_val >> 8) & 0xFF;
|
||||
ff_temp_data[8] = batt_val & 0xFF;
|
||||
|
||||
//先查明当前连接的conn_handle
|
||||
u16 connection_handle = ble_comm_dev_get_handle(0, GATT_ROLE_SERVER);
|
||||
if(connection_handle != 0)//
|
||||
@ -440,8 +494,77 @@ static uint8_t reversal(uint8_t data)
|
||||
//printf("connection_handle: %04x\n", connection_handle);
|
||||
}
|
||||
|
||||
if(body < BLE_TEMPERATURE_LIMIT_MIN || body > BLE_TEMPERATURE_LIMIT_MAX){ //异常温度不发送
|
||||
printf("error temp_body\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
trans_client_adv_data_set_ff(ff_temp_data,sizeof(ff_temp_data));
|
||||
gpio_direction_output(IO_PORTB_05, 0);
|
||||
|
||||
//计算当前温度是否稳定
|
||||
u16 temp_body = dev_info.temperature_sensor;
|
||||
|
||||
//添加数据到队列,数量足够后取出所有温度数据 计算方差 如果小于 N N可以趋近于0 暂定小于20 则表示温度稳定
|
||||
if (tuya_ble_queue_isFull(&temp_queue)) {
|
||||
tuya_ble_queue_decrease(&temp_queue); // 移除队首元素
|
||||
}
|
||||
|
||||
tuya_ble_enqueue(&temp_queue, &temp_body);
|
||||
|
||||
uint8_t size = tuya_ble_get_queue_used(&temp_queue);
|
||||
if (!tuya_ble_queue_isFull(&temp_queue)) {
|
||||
printf("queue_size -> %d \r\n", size);
|
||||
}
|
||||
|
||||
if (tuya_ble_queue_isFull(&temp_queue)) {
|
||||
uint8_t i = 0;
|
||||
u16 t_datas[MAX_SIZE];
|
||||
uint8_t index = temp_queue.rd_ptr;
|
||||
|
||||
for (int i = 0; i < MAX_SIZE; i++) {
|
||||
t_datas[i] = *(u16*)((uint8_t*)temp_queue.buf + index * temp_queue.offset);
|
||||
index = (index + 1) % temp_queue.size;
|
||||
}
|
||||
|
||||
// 中值滤波取中值
|
||||
for (int i = 0; i < MAX_SIZE - 1; i++) {
|
||||
for (int j = i + 1; j < MAX_SIZE; j++) {
|
||||
if (t_datas[i] > t_datas[j]) {
|
||||
u16 tmp = t_datas[i];
|
||||
t_datas[i] = t_datas[j];
|
||||
t_datas[j] = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
u16 mean_value;
|
||||
if (MAX_SIZE % 2 == 1) {
|
||||
mean_value = t_datas[MAX_SIZE / 2];
|
||||
} else {
|
||||
mean_value = (t_datas[MAX_SIZE / 2 - 1] + t_datas[MAX_SIZE / 2]) / 2;
|
||||
}
|
||||
printf("mean_value:%d \r\n", mean_value);
|
||||
|
||||
// //计算平均值
|
||||
// u32 sum = 0;
|
||||
// for(i = 0;i < MAX_SIZE; i++){
|
||||
// sum += t_datas[i];
|
||||
// }
|
||||
// u16 mean_value = sum / MAX_SIZE;
|
||||
// printf("mean_value:%d \r\n", mean_value);
|
||||
|
||||
//计算方差
|
||||
double sumOfSquares = 0;
|
||||
for (int i = 0; i < MAX_SIZE; i++) {
|
||||
sumOfSquares += (t_datas[i] - mean_value) * (t_datas[i] - mean_value);
|
||||
}
|
||||
u16 variance_value = sumOfSquares / MAX_SIZE; // 注意这里是n,而不是n-1(对于样本方差)
|
||||
printf("variance_value:%d \r\n", variance_value);
|
||||
|
||||
//方差小于 20 表示温度稳定
|
||||
dev_info.temperature_state = (variance_value <= 30) ? 1 : 0;
|
||||
printf("dev_info.temperature_state:%d\r\n", dev_info.temperature_state);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -449,12 +572,14 @@ static uint8_t reversal(uint8_t data)
|
||||
* //BBOOEEbs 2字节体温 2字节物温 2字节环温 1字节电量 1字节状态
|
||||
* 状态:00 正常模式 01 进入充电
|
||||
*/
|
||||
void temperature_update_adv_ff(u16 temp_body,u16 temp_obj,u16 temp_env,u8 batt,u8 state){
|
||||
void temperature_update_adv_ff(u16 temp_body,u16 temp_obj,u16 temp_env,u8 batt,u8 state ,u16 batt_val){
|
||||
u16 body = (u16)temp_body;
|
||||
u16 obj = (u16)temp_obj;
|
||||
u16 ntc = (u16)temp_env;
|
||||
u8 battery = 99;
|
||||
u8 ff_temp_data[8] = {0};
|
||||
u8 battery = (u8)batt;
|
||||
u16 val = (u16)batt_val;
|
||||
|
||||
u8 ff_temp_data[10] = {0};
|
||||
//body
|
||||
ff_temp_data[0] = (body >> 8) & 0xFF;
|
||||
ff_temp_data[1] = (body) & 0xFF;
|
||||
@ -465,9 +590,12 @@ static uint8_t reversal(uint8_t data)
|
||||
ff_temp_data[4] = (ntc >> 8) & 0xFF;
|
||||
ff_temp_data[5] = (ntc) & 0xFF;
|
||||
//batt
|
||||
battery = get_cur_battery_level() *10;
|
||||
//battery = get_cur_battery_level() *10;
|
||||
ff_temp_data[6] = battery & 0xFF;
|
||||
ff_temp_data[7] = state & 0xFF;
|
||||
//val
|
||||
ff_temp_data[8] = (val >> 8) & 0xFF; // 高字节
|
||||
ff_temp_data[9] = val & 0xFF;
|
||||
trans_client_adv_data_set_ff(ff_temp_data,sizeof(ff_temp_data));
|
||||
}
|
||||
|
||||
@ -492,12 +620,59 @@ void rtc_test_demo()
|
||||
//read_alarm(&tmp_time); //读修改后alarm时间
|
||||
//printf("rtc_read_alarm_after: %d-%d-%d %d:%d:%d", tmp_time.year, tmp_time.month, tmp_time.day, tmp_time.hour, tmp_time.min, tmp_time.sec); //打印修改后闹钟时间值
|
||||
}
|
||||
static u8 low_battery_led_blinking = 0;
|
||||
static u16 low_battery_led_timer_id = 0;
|
||||
void low_battery_led_flash(void *priv)
|
||||
{
|
||||
if (charge_state) {
|
||||
if (low_battery_led_timer_id) {
|
||||
usr_timer_del(low_battery_led_timer_id);
|
||||
low_battery_led_timer_id = 0;
|
||||
}
|
||||
temperature_work_led(0); // 关闭LED
|
||||
low_battery_led_blinking = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
led_state = !led_state;
|
||||
temperature_work_led(led_state); // 切换LED状态
|
||||
}
|
||||
void stop_low_battery_blink(void)
|
||||
{
|
||||
if (low_battery_led_timer_id) {
|
||||
usr_timer_del(low_battery_led_timer_id);
|
||||
low_battery_led_timer_id = 0;
|
||||
}
|
||||
low_battery_led_blinking = 0;
|
||||
temperature_work_led(0); // 关闭LED
|
||||
}
|
||||
void temperature_detect(void)
|
||||
{
|
||||
rtc_test_demo();
|
||||
nst1002_read_temperatura();
|
||||
|
||||
u16 batt_val = 0;
|
||||
|
||||
if (!batt_val) {
|
||||
batt_val = get_vbat_level();
|
||||
} else {
|
||||
batt_val = (get_vbat_level() + batt_val) / 2;
|
||||
}
|
||||
|
||||
printf("battery:%d\r\n", batt_val);
|
||||
|
||||
// 低电处理:电压小于365
|
||||
if (batt_val <= 365 && !charge_state) {
|
||||
if (!low_battery_led_blinking) {
|
||||
// 开始闪烁
|
||||
low_battery_led_blinking = 1;
|
||||
low_battery_led_timer_id = usr_timer_add(NULL, low_battery_led_flash, 500, 1);
|
||||
}
|
||||
} else { // 停止闪烁
|
||||
if (low_battery_led_blinking) {
|
||||
stop_low_battery_blink();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -522,16 +697,22 @@ void temperature_work_led(u8 on){
|
||||
gpio_direction_output(BLE_TEMPERATURE_WORK_LED, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void temperature_poweron_led_timeout(){
|
||||
temperature_work_led(0);
|
||||
void device_hell(u8 on){
|
||||
gpio_set_direction(DEVICE_HALL, 1);
|
||||
if(on){
|
||||
gpio_set_hd0(DEVICE_HALL, 1);
|
||||
gpio_direction_output(DEVICE_HALL, 1);
|
||||
}else{
|
||||
gpio_direction_output(DEVICE_HALL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static u8 init_complete = 0;
|
||||
void temperature_set_soft_poweroff(void)
|
||||
{
|
||||
printf("temperature_set_soft_poweroff\n");
|
||||
|
||||
temperature_deinit();
|
||||
syscfg_write(INIT_COMPLETE_FLAG_CONFIG, &init_complete,sizeof(init_complete));
|
||||
//VCM_DET_EN(0);//关闭VCM复位
|
||||
//gpio_shortpress_reset_config(0);//1--enable 0--disable
|
||||
|
||||
@ -548,17 +729,62 @@ void temperature_set_soft_poweroff(void)
|
||||
power_set_soft_poweroff();
|
||||
#endif
|
||||
}
|
||||
void hall_isr_callback()
|
||||
{
|
||||
// 这里写HALL变化时的处理逻辑
|
||||
printf("hall_isr_callback:%d\n", gpio_read(DEVICE_HALL));
|
||||
// 例如:唤醒、计数、状态切换等
|
||||
}
|
||||
|
||||
// 注册下降沿/上升沿中断
|
||||
void hall_gpio_init(void)
|
||||
{
|
||||
gpio_set_direction(DEVICE_HALL, 1);
|
||||
gpio_set_pull_up(DEVICE_HALL, 1);
|
||||
gpio_set_die(DEVICE_HALL, 1);
|
||||
|
||||
// 配置为唤醒源,下降沿/上升沿触发
|
||||
gpio_wakeup0(DEVICE_HALL); // 使能唤醒通道0,具体通道可查手册
|
||||
}
|
||||
void timer_sleep_callback(void);
|
||||
void temperature_charge_state(int state){
|
||||
switch (state)
|
||||
{
|
||||
//接入充电
|
||||
static u8 charge_inited = 0;//防止充电因电压不稳,重复触发充电状态
|
||||
printf("init_complete:%d",init_complete);
|
||||
|
||||
if ( init_complete == 0 ) { //读取初始化标志,防止休眠重置
|
||||
syscfg_read(INIT_COMPLETE_FLAG_CONFIG, &init_complete, sizeof(init_complete));
|
||||
init_complete = (init_complete == 1);
|
||||
}
|
||||
|
||||
if (!init_complete && state == BLE_TEMPERATURE_CHARGE_KEEP_CHARGING ) { //防止开机误判充电状态,并提前亮灯
|
||||
init_complete = 1;
|
||||
sys_timer_del(timer_temperature_detect);
|
||||
temperature_work_led(1);
|
||||
sys_s_hi_timerout_add(NULL,temperature_poweron_led_timeout,2000);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (state){
|
||||
//接入充电
|
||||
case BLE_TEMPERATURE_CHARGE_STATE_CHARGING :
|
||||
charge_state = 1;
|
||||
if (gpio_read(DEVICE_HALL) == 1 ) {
|
||||
|
||||
}
|
||||
if (charge_inited) {
|
||||
printf("vbal instablity!\n");
|
||||
return;
|
||||
}
|
||||
printf("BLE_TEMPERATURE_CHARGE_STATE_CHARGING\n");
|
||||
//关闭低电提示LED
|
||||
charge_state = 1;
|
||||
init_complete = 0;
|
||||
charge_inited = 1;
|
||||
|
||||
syscfg_write(INIT_COMPLETE_FLAG_CONFIG, &init_complete,sizeof(init_complete));
|
||||
temperature_charge_lowpower(0);
|
||||
sys_timer_del(temer_temperature_detect);
|
||||
|
||||
sys_timer_del(timer_temperature_detect);
|
||||
//sys_timer_del(timer_sleep);
|
||||
|
||||
//体温计指标灯闪烁3次后转灭
|
||||
for(int i = 0; i< 3 ; i++){
|
||||
temperature_work_led(1);
|
||||
@ -572,7 +798,36 @@ void temperature_charge_state(int state){
|
||||
//spple_power_event_to_user(POWER_EVENT_POWER_SOFTOFF);
|
||||
//printf("!!!!!!!!!!!!!! CHARGING POWER OFF!!!!!!!!!!!!!!!!\n");
|
||||
//printf("BLE_TEMPERATURE_CHARGE_STATE_CHARGING 2\n");
|
||||
break;
|
||||
//拔出电压(0.6左右)< ldoin < vbat
|
||||
case BLE_TEMPERATURE_CHARGE_KEEP_CHARGING :
|
||||
if (gpio_read(DEVICE_HALL) == 1 ) {
|
||||
}
|
||||
if (charge_inited) {
|
||||
printf("vbal instablity!\n");
|
||||
return;
|
||||
}
|
||||
printf("BLE_TEMPERATURE_CHARGE_KEEP_CHARGING\n");
|
||||
charge_state = 1;
|
||||
init_complete = 0;
|
||||
charge_inited = 1;
|
||||
|
||||
syscfg_write(INIT_COMPLETE_FLAG_CONFIG, &init_complete,sizeof(init_complete));
|
||||
temperature_charge_lowpower(0);
|
||||
|
||||
sys_timer_del(timer_temperature_detect);
|
||||
//sys_timer_del(timer_sleep);
|
||||
|
||||
//体温计指标灯闪烁3次后转灭
|
||||
for(int i = 0; i< 3 ; i++){
|
||||
temperature_work_led(1);
|
||||
delay_ms_by_timer0(150);
|
||||
temperature_work_led(0);
|
||||
delay_ms_by_timer0(150);
|
||||
}
|
||||
//接入充电关闭蓝牙广播
|
||||
ble_op_adv_enable(0);
|
||||
ble_module_enable(0);
|
||||
break;
|
||||
//充电完成
|
||||
case BLE_TEMPERATURE_CHARGE_STATE_FULL :
|
||||
@ -582,12 +837,19 @@ void temperature_charge_state(int state){
|
||||
//拔出充电
|
||||
case BLE_TEMPERATURE_CHARGE_STATE_IDLE :
|
||||
charge_state = 0;
|
||||
printf("BLE_TEMPERATURE_CHARGE_STATE_IDLE\n");
|
||||
temer_temperature_detect = sys_timer_add(NULL, temperature_detect, dev_config.detect_interval);
|
||||
//temperature_charge_led(0);
|
||||
temperature_work_led(1);
|
||||
sys_s_hi_timerout_add(NULL,temperature_poweron_led_timeout,2000);
|
||||
charge_inited = 0;
|
||||
|
||||
printf("BLE_TEMPERATURE_CHARGE_STATE_IDLE\n");
|
||||
timer_temperature_detect = sys_timer_add(NULL, temperature_detect, dev_config.detect_interval);
|
||||
//timer_sleep = sys_timer_add(NULL, timer_sleep_callback,DEVICE_WORK_TIMEOUT);
|
||||
printf("dev_info.batt_percent:%d\n",dev_info.batt_percent);
|
||||
//temperature_charge_led(0);
|
||||
|
||||
if(init_complete == 0 ){ //如果开机未进入BLE_TEMPERATURE_CHARGE_KEEP_CHARGING则亮灯
|
||||
temperature_work_led(1);
|
||||
sys_s_hi_timerout_add(NULL,temperature_poweron_led_timeout,2000);
|
||||
}
|
||||
init_complete = 1;
|
||||
//拔出充电打开蓝牙广播
|
||||
ble_module_enable(1);
|
||||
ble_op_adv_enable(1);
|
||||
@ -616,8 +878,6 @@ void temperature_ble_init(){
|
||||
char ble_name[12] ={0};
|
||||
sprintf(ble_name,"iT12_%02X%02X",bt_mac_addr[1],bt_mac_addr[0]);
|
||||
ble_comm_set_config_name(&ble_name, 0);
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* 初始化测温相关的参数
|
||||
@ -629,7 +889,6 @@ void temperature_config_init(){
|
||||
int ret = syscfg_read(BLE_TEMPERATURE_VM_DEVICE_CONFIG, &dev_config, sizeof(app_dev_config_t));
|
||||
if (ret != sizeof(app_dev_config_t)) {
|
||||
printf("temperature_config_init err:%d", ret);
|
||||
|
||||
dev_config.detect_interval = 500;
|
||||
dev_config.temperature_offset = 0;
|
||||
syscfg_write(BLE_TEMPERATURE_VM_DEVICE_CONFIG, &dev_config, sizeof(app_dev_config_t));
|
||||
@ -659,33 +918,40 @@ void timer_sleep_callback(void)
|
||||
{
|
||||
//关机开启闹钟
|
||||
printf(">>>>>>>>>>>>>>>>> timer_sleep_callback ...\n");
|
||||
//先查明当前连接的conn_handle 如果是蓝牙连接状态 不休眠
|
||||
//先查明当前连接的conn_handle 如果是蓝牙连接状态或充电状态 不休眠
|
||||
u16 connection_handle = ble_comm_dev_get_handle(0, GATT_ROLE_SERVER);
|
||||
if(connection_handle != 0)//
|
||||
{
|
||||
printf("ble connected !! connection_handle: %04x\n", connection_handle);
|
||||
if(connection_handle != 0 || charge_state == 1){
|
||||
sys_timer_del(timer_sleep);
|
||||
timer_sleep = sys_timer_add(NULL, timer_sleep_callback, DEVICE_WORK_TIMEOUT);
|
||||
printf("ble connected or charging !! connection_handle: %04x\n", connection_handle);
|
||||
return ;
|
||||
}else{
|
||||
//printf("connection_handle: %04x\n", connection_handle);
|
||||
}
|
||||
|
||||
if( charge_state == 1){
|
||||
printf("charging !! do not sleep\n");
|
||||
return ;
|
||||
}
|
||||
|
||||
rtc_alarm_set_timer(5);
|
||||
|
||||
stop_low_battery_blink();
|
||||
rtc_alarm_set_timer(DEVICE_SLEEP_TIMEOUT);
|
||||
temperature_set_soft_poweroff();
|
||||
// sys_timer_del(timer_sleep); // 清除旧定时器
|
||||
// timer_work = sys_timer_add(NULL, timer_work_callback, 5000);
|
||||
}
|
||||
|
||||
// void timer_work_callback(void){
|
||||
// printf(">>>>>>>>>>>>>>>>> timer_work_callback ...\n");
|
||||
// // 重启测温
|
||||
// timer_temperature_detect = sys_timer_add(NULL, temperature_detect, dev_config.detect_interval);
|
||||
|
||||
// // 启动下一轮10秒工作定时器
|
||||
// sys_timer_del(timer_work);
|
||||
// timer_sleep = sys_timer_add(NULL, timer_sleep_callback, 10000);
|
||||
// }
|
||||
void temperature_init(void)
|
||||
{
|
||||
{
|
||||
|
||||
//extern void user_alarm_test(void);
|
||||
//extern void alarm_rtc_start(void);
|
||||
//alarm_rtc_start();
|
||||
//user_alarm_test();
|
||||
|
||||
printf(">>>>>>>>>>>>>>>>> temperature_init ...\n");
|
||||
delay_us(60);
|
||||
printf(">>>>>>>>>>>>>>>>> temperature_OTA ...\n");
|
||||
@ -694,20 +960,28 @@ void temperature_init(void)
|
||||
extern u16 get_vbg_trim();
|
||||
printf("vbat_trim:%d...vbg_trim:%d", get_vbat_trim(), get_vbg_trim());
|
||||
// 添加以上代码,看打印值,如果为15跟63,那就要用烧录器先烧录一遍。
|
||||
|
||||
hall_gpio_init();
|
||||
temperature_config_init();
|
||||
|
||||
//从收纳仓取出时自动开机(指示灯亮2S后灭)
|
||||
temperature_work_led(1);
|
||||
sys_s_hi_timerout_add(NULL,temperature_poweron_led_timeout,2000);
|
||||
// temperature_work_led(1);
|
||||
// sys_s_hi_timerout_add(NULL,temperature_poweron_led_timeout,2000);
|
||||
|
||||
//sys_s_hi_timer_add(NULL, temperature_blink_led, 200);
|
||||
//sys_s_hi_timer_add(NULL, temperature_detect, 2000);
|
||||
//sys_timer_add 方式添加定时任务 任务里边可以使用udelay delay_ms 等延时 sys_s_hi_timer_add 则延时无效
|
||||
temer_temperature_detect = sys_timer_add(NULL, temperature_detect, dev_config.detect_interval);
|
||||
//工作10秒关机 关机10s后 RTC重新唤醒
|
||||
//temer_sleep = sys_timer_add(NULL, timer_sleep_callback,10*1000);
|
||||
|
||||
if (syscfg_read(ADJ_TEMP_CONFIG, &ADJ_temp, sizeof(ADJ_temp)) != sizeof(ADJ_temp)) {
|
||||
ADJ_temp = 0;
|
||||
}
|
||||
timer_temperature_detect = sys_timer_add(NULL, temperature_detect, dev_config.detect_interval);
|
||||
//工作15秒关机 关机5s后 RTC重新唤醒
|
||||
//timer_sleep = sys_timer_add(NULL, timer_sleep_callback,DEVICE_WORK_TIMEOUT);
|
||||
|
||||
tuya_ble_queue_init(&temp_queue, buffer, MAX_SIZE, sizeof(u16));
|
||||
tuya_ble_queue_flush(&temp_queue);
|
||||
|
||||
//charge_only = 0;
|
||||
//HALL PIN 输入
|
||||
gpio_set_direction(IO_PORTA_00,1);
|
||||
gpio_set_die(IO_PORTA_00,1);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,22 +2,12 @@
|
||||
<CodeBlocks_layout_file>
|
||||
<FileVersion major="1" minor="0" />
|
||||
<ActiveTarget name="Release" />
|
||||
<File name="..\..\app_temperature.c" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="board_ac6323a_demo_cfg.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="10635" topLine="320" />
|
||||
<Cursor1 position="12074" topLine="216" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="..\..\..\common\third_party_profile\jieli\gatt_common\le_gatt_server.c" open="1" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="27428" topLine="677" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="..\..\examples\trans_data\ble_trans.h" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="553" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="board_config.h" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="board_config.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="518" topLine="0" />
|
||||
</Cursor>
|
||||
@ -27,9 +17,24 @@
|
||||
<Cursor1 position="10242" topLine="189" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="..\..\examples\trans_data\ble_trans.h" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="553" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="..\..\..\..\cpu\bd19\adc_api.c" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="11677" topLine="439" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="..\..\modules\power\app_charge.c" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="855" topLine="6" />
|
||||
<Cursor1 position="1522" topLine="53" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="..\..\..\..\cpu\bd19\charge.c" open="1" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="8796" topLine="308" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="..\..\examples\trans_data\ble_trans.c" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
@ -37,14 +42,19 @@
|
||||
<Cursor1 position="26810" topLine="719" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="board_ac6323a_demo_cfg.h" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="..\..\app_temperature.c" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="4367" topLine="216" />
|
||||
<Cursor1 position="22937" topLine="673" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="..\..\..\..\cpu\bd19\adc_api.c" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="..\..\..\common\third_party_profile\jieli\gatt_common\le_gatt_server.c" open="1" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="11677" topLine="441" />
|
||||
<Cursor1 position="27428" topLine="677" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="..\..\app_main.c" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="7497" topLine="279" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="..\..\modules\bt\app_comm_edr.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
@ -52,9 +62,4 @@
|
||||
<Cursor1 position="1154" topLine="18" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="..\..\app_main.c" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="7571" topLine="261" />
|
||||
</Cursor>
|
||||
</File>
|
||||
</CodeBlocks_layout_file>
|
||||
|
@ -5,9 +5,9 @@
|
||||
#include "system/event.h"
|
||||
|
||||
/**
|
||||
* 1.0.1 2025.05.16
|
||||
* 1.0.2 2025.06.13
|
||||
*/
|
||||
#define BLE_TEMPERATURE_DEVICE_SOFT_VER "1.0.1"
|
||||
#define BLE_TEMPERATURE_DEVICE_SOFT_VER "1.0.2"
|
||||
|
||||
#define BLE_TEMPERATURE_DETECT_INTERVAL 250
|
||||
#define BLE_TEMPERATURE_WORK_TIMEOUT 10*1000
|
||||
@ -19,15 +19,27 @@
|
||||
#define BLE_TEMPERATURE_DEVICE_NTC 0
|
||||
|
||||
#define BLE_TEMPERATURE_WORK_LED IO_PORTA_07
|
||||
#define DEVICE_HALL IO_PORTB_07
|
||||
|
||||
#define BLE_TEMPERATURE_CHARGE_STATE_CHARGING 1
|
||||
#define BLE_TEMPERATURE_CHARGE_STATE_FULL 2
|
||||
#define BLE_TEMPERATURE_CHARGE_STATE_IDLE 3
|
||||
#define BLE_TEMPERATURE_CHARGE_STATE_LOWPOWER 4
|
||||
#define BLE_TEMPERATURE_CHARGE_KEEP_CHARGING 5
|
||||
|
||||
//VM用户自定义配置项[1 ~ 49]
|
||||
#define BLE_TEMPERATURE_VM_DEVICE_CONFIG 2
|
||||
#define INIT_COMPLETE_FLAG_CONFIG 3
|
||||
#define ADJ_TEMP_CONFIG 4
|
||||
|
||||
#define DEVICE_SLEEP_TIMEOUT 5 //设备休眠时间
|
||||
#define DEVICE_WORK_TIMEOUT 15000 //设备工作时间
|
||||
|
||||
#define BLE_TEMPERATURE_LIMIT_MIN 2000
|
||||
#define BLE_TEMPERATURE_LIMIT_MAX 4500
|
||||
|
||||
#define BLE_ADJUST_TEMP_37 3700 //37.0C
|
||||
#define MAX_SIZE 30
|
||||
typedef struct
|
||||
{
|
||||
u16 temperature_sensor;
|
||||
@ -36,6 +48,7 @@ typedef struct
|
||||
u16 batt_val;
|
||||
u8 is_bat_charge;
|
||||
u8 is_bat_full;
|
||||
u8 temperature_state;
|
||||
}app_dev_info_t;
|
||||
|
||||
typedef struct
|
||||
@ -59,4 +72,5 @@ void temperature_work_led(u8 on);
|
||||
void temperature_charge_led(u8 on);
|
||||
void temperature_charge_state(int state);
|
||||
void temperature_deinit(void);
|
||||
|
||||
#endif //_APP_TEMPERATURE_H_
|
||||
|
@ -43,7 +43,7 @@ void ldo5v_keep_deal(void)
|
||||
#if TCFG_HANDSHAKE_ENABLE
|
||||
handshake_app_start(2, handshake_complete);
|
||||
#endif
|
||||
temperature_charge_state(BLE_TEMPERATURE_CHARGE_STATE_CHARGING);
|
||||
temperature_charge_state(BLE_TEMPERATURE_CHARGE_KEEP_CHARGING);
|
||||
}
|
||||
|
||||
void charge_full_deal(void)
|
||||
@ -54,7 +54,7 @@ void charge_full_deal(void)
|
||||
//extern spple_set_soft_poweroff();
|
||||
//spple_set_soft_poweroff();
|
||||
temperature_charge_state(BLE_TEMPERATURE_CHARGE_STATE_FULL);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void charge_close_deal(void)
|
||||
@ -65,6 +65,7 @@ void charge_close_deal(void)
|
||||
void charge_ldo5v_in_deal(void)
|
||||
{
|
||||
log_info("%s\n", __FUNCTION__);
|
||||
|
||||
#if TCFG_HANDSHAKE_ENABLE
|
||||
handshake_app_start(2, handshake_complete);
|
||||
#else
|
||||
@ -73,6 +74,7 @@ void charge_ldo5v_in_deal(void)
|
||||
temperature_charge_state(BLE_TEMPERATURE_CHARGE_STATE_CHARGING);
|
||||
}
|
||||
|
||||
|
||||
void charge_ldo5v_off_deal(void)
|
||||
{
|
||||
log_info("%s\n", __FUNCTION__);
|
||||
@ -85,11 +87,14 @@ void charge_ldo5v_off_deal(void)
|
||||
vbat_check_init();
|
||||
#endif
|
||||
temperature_charge_state(BLE_TEMPERATURE_CHARGE_STATE_IDLE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int app_charge_event_handler(struct device_event *dev)
|
||||
{
|
||||
log_info("%s\n %d", __FUNCTION__,dev->event);
|
||||
|
||||
switch (dev->event) {
|
||||
case CHARGE_EVENT_CHARGE_START:
|
||||
charge_start_deal();
|
||||
@ -112,8 +117,11 @@ int app_charge_event_handler(struct device_event *dev)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -24,7 +24,7 @@ enum {
|
||||
VBAT_LOWPOWER,
|
||||
} VBAT_STATUS;
|
||||
|
||||
#define VBAT_DETECT_CNT (2*1) //2*N
|
||||
#define VBAT_DETECT_CNT (2*3) //2*N
|
||||
#define VBAT_DETECT_ADC_MS (10) //unint:ms
|
||||
#define VBAT_PERIOD_CHECK_S (30) //unint:s
|
||||
|
||||
@ -113,11 +113,12 @@ u16 get_vbat_value(void)
|
||||
{
|
||||
return bat_val;
|
||||
}
|
||||
|
||||
u8 get_vbat_percent(void)
|
||||
//1
|
||||
u8 get_vbat_percent(void)
|
||||
{
|
||||
u16 tmp_bat_val;
|
||||
u16 bat_val = get_vbat_level();
|
||||
app_var.poweroff_tone_v = 360;
|
||||
if (battery_full_value == 0) {
|
||||
#if TCFG_CHARGE_ENABLE
|
||||
battery_full_value = (get_charge_full_value() - 100) / 10; //防止部分电池充不了这么高电量,充满显示未满的情况
|
||||
@ -125,11 +126,9 @@ u8 get_vbat_percent(void)
|
||||
battery_full_value = 420;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (bat_val <= app_var.poweroff_tone_v) {
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
tmp_bat_val = remap_calculate_vbat_percent(bat_val);
|
||||
if (!tmp_bat_val) {
|
||||
tmp_bat_val = ((u32)bat_val - app_var.poweroff_tone_v) * 100 / (battery_full_value - app_var.poweroff_tone_v);
|
||||
|
@ -163,7 +163,7 @@ u32 adc_value_to_voltage(u32 adc_vbg, u32 adc_ch_val)
|
||||
tmp1 = adc_trim & 0x0f;
|
||||
tmp = (adc_trim & BIT(4)) ? VBG_CENTER - tmp1 * VBG_RES : VBG_CENTER + tmp1 * VBG_RES;
|
||||
adc_res = adc_res * tmp / adc_vbg;
|
||||
//printf("adc_res %d mv vbg:%d adc:%d adc_trim:%x\n", adc_res, adc_vbg, adc_ch_val, adc_trim);
|
||||
//printf("adc_res %d mv vbg:%d adc:%d adc_trim:%x tmp1:%d tmp:%d\n", adc_res, adc_vbg, adc_ch_val, adc_trim, tmp1, tmp);
|
||||
return adc_res;
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,6 @@ static void charge_full_detect(void *priv)
|
||||
static void ldo5v_detect(void *priv)
|
||||
{
|
||||
/* log_info("%s\n",__func__); */
|
||||
|
||||
static u16 ldo5v_on_cnt = 0;
|
||||
static u16 ldo5v_keep_cnt = 0;
|
||||
static u16 ldo5v_off_cnt = 0;
|
||||
@ -422,7 +421,6 @@ static void charge_config(void)
|
||||
CHARGE_mA_SEL(CHARGE_mA_20);
|
||||
}
|
||||
|
||||
|
||||
int charge_init(const struct dev_node *node, void *arg)
|
||||
{
|
||||
log_info("%s\n", __func__);
|
||||
@ -446,6 +444,7 @@ int charge_init(const struct dev_node *node, void *arg)
|
||||
|
||||
if (check_charge_state()) {
|
||||
if (__this->ldo5v_timer == 0) {
|
||||
|
||||
__this->ldo5v_timer = usr_timer_add(0, ldo5v_detect, 2, 1);
|
||||
}
|
||||
} else {
|
||||
@ -453,8 +452,8 @@ int charge_init(const struct dev_node *node, void *arg)
|
||||
power_exit_charge_mode();
|
||||
}
|
||||
|
||||
__this->init_ok = 1;
|
||||
|
||||
__this->init_ok = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2113,6 +2113,8 @@ obj/Release/apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_queue
|
||||
-r=obj/Release/apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_queue.o,tuya_ble_queue_decrease,pl
|
||||
-r=obj/Release/apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_queue.o,tuya_ble_queue_flush,pl
|
||||
-r=obj/Release/apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_queue.o,tuya_ble_get_queue_used,pl
|
||||
-r=obj/Release/apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_queue.o,tuya_ble_queue_isFull,pl
|
||||
-r=obj/Release/apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_queue.o,tuya_ble_queue_size,pl
|
||||
obj/Release/apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_storage.o
|
||||
-r=obj/Release/apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_storage.o,tuya_ble_storage_load_settings,pl
|
||||
-r=obj/Release/apps/common/third_party_profile/tuya_protocol/sdk/src/tuya_ble_storage.o,tuya_ble_malloc,l
|
||||
@ -2270,7 +2272,6 @@ obj/Release/apps/spp_and_le/app_main.o
|
||||
-r=obj/Release/apps/spp_and_le/app_main.o,usr_timer_del,l
|
||||
-r=obj/Release/apps/spp_and_le/app_main.o,alarm_rtc_start,l
|
||||
-r=obj/Release/apps/spp_and_le/app_main.o,user_alarm_test,l
|
||||
-r=obj/Release/apps/spp_and_le/app_main.o,alarm_isr_user_cbfun,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_main.o,user_main,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_main.o,temperature_init,l
|
||||
-r=obj/Release/apps/spp_and_le/app_main.o,app_main,pl
|
||||
@ -2297,12 +2298,21 @@ obj/Release/apps/spp_and_le/app_temperature.o
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,ble_comm_dev_get_handle,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,ble_comm_att_check_send,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,ble_gatt_server_characteristic_ccc_get,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,printf,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,ble_comm_att_send_data,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,ble_receive_callback,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,printf,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,strstr,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,memset,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,sprintf,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,strlen,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,syscfg_write,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,temperature_poweron_led_timeout,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,temperature_work_led,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,ble_led_timeout,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,usr_timer_add,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,ble_on_connect_change,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,usr_timeout_add,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,usr_timer_del,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,delay_us_by_timer0,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,clk_get,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,delay_us_by_timer0_irq,pl
|
||||
@ -2314,38 +2324,55 @@ obj/Release/apps/spp_and_le/app_temperature.o
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,gpio_set_die,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,gpio_read,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,nst1002_read_temperatura,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,get_cur_battery_level,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,get_vbat_percent,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,get_vbat_level,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,trans_client_adv_data_set_ff,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,tuya_ble_queue_isFull,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,tuya_ble_queue_decrease,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,tuya_ble_enqueue,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,tuya_ble_get_queue_used,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,temperature_update_adv_ff,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,rtc_test_demo,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,read_sys_time,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,low_battery_led_flash,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,stop_low_battery_blink,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,temperature_detect,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,temperature_charge_lowpower,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,sys_timer_del,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,sys_timer_add,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,temperature_work_led,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,temperature_poweron_led_timeout,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,device_hell,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,temperature_set_soft_poweroff,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,temperature_deinit,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,gpio_longpress_pin0_reset_config,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,btstack_ble_exit,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,sys_timeout_add,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,power_set_soft_poweroff,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,hall_isr_callback,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,hall_gpio_init,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,gpio_set_pull_up,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,gpio_wakeup0,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,temperature_charge_state,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,syscfg_read,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,ble_user_cmd_prepare,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,ble_module_enable,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,usr_timeout_add,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,temperature_ble_init,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,bt_get_vm_mac_addr,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,le_controller_set_mac,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,ble_comm_set_config_name,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,temperature_config_init,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,syscfg_read,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,syscfg_write,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,alarm_isr_user_cbfun,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,timer_sleep_callback,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,rtc_alarm_set_timer,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,temperature_init,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,get_vbat_trim,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,get_vbg_trim,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,temperature_deinit,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,tuya_ble_queue_init,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,tuya_ble_queue_flush,l
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,dev_info,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,err_code,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,charge_led_hander,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,dev_config,pl
|
||||
-r=obj/Release/apps/spp_and_le/app_temperature.o,buffer,pl
|
||||
obj/Release/apps/spp_and_le/config/lib_btctrler_config.o
|
||||
-r=obj/Release/apps/spp_and_le/config/lib_btctrler_config.o,config_btctler_modules,pl
|
||||
-r=obj/Release/apps/spp_and_le/config/lib_btctrler_config.o,CONFIG_TWS_RUN_SLOT,pl
|
||||
@ -3262,6 +3289,7 @@ obj/Release/apps/spp_and_le/examples/trans_data/ble_trans.o
|
||||
-r=obj/Release/apps/spp_and_le/examples/trans_data/ble_trans.o,get_remote_test_flag,l
|
||||
-r=obj/Release/apps/spp_and_le/examples/trans_data/ble_trans.o,little_endian_read_16,l
|
||||
-r=obj/Release/apps/spp_and_le/examples/trans_data/ble_trans.o,ble_vendor_get_peer_rssi,l
|
||||
-r=obj/Release/apps/spp_and_le/examples/trans_data/ble_trans.o,ble_on_connect_change,l
|
||||
-r=obj/Release/apps/spp_and_le/examples/trans_data/ble_trans.o,little_endian_read_32,l
|
||||
-r=obj/Release/apps/spp_and_le/examples/trans_data/ble_trans.o,ble_gatt_server_characteristic_ccc_set,l
|
||||
-r=obj/Release/apps/spp_and_le/examples/trans_data/ble_trans.o,ble_gatt_server_connetion_update_request,l
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8,10 +8,10 @@ iT12 腋温计通讯协议
|
||||
|
||||
5.指令CMD
|
||||
5.1 获取温度 :AT+TEMP=?
|
||||
回复:AT+TEMP=255,265,365 (255表示环境温度, 265表示物体温度 , 365表示体温)
|
||||
回复:AT+TEMP=255,265,365,1 (255表示环境温度, 265表示物体温度 , 365表示体温),最后一位 1表示当前温度处于稳定状态测量完成,0表示当前正在测量中温度不稳定
|
||||
|
||||
5.2 获取电池电量百分百 :AT+BATP=?
|
||||
回复:AT+BATP=80 (88表示电量为80%)
|
||||
回复:AT+BATP=88 (88表示电量为88%)
|
||||
|
||||
5.3 获取电池电压 :AT+BATT=?
|
||||
回复:AT+BATT=333 (333 表示3.33V)
|
||||
|
Loading…
x
Reference in New Issue
Block a user