优化充电逻辑 LED显示逻辑,优化传感器概率读取不成功

This commit is contained in:
helloyifa 2025-04-10 20:22:15 +08:00
parent b79043acf2
commit 9cdd799881
2 changed files with 14 additions and 3 deletions

View File

@ -13,6 +13,12 @@
#define BLE_TEMPERATURE_DEVICE_NST1002 1002 #define BLE_TEMPERATURE_DEVICE_NST1002 1002
#define BLE_TEMPERATURE_DEVICE_NTC 0 #define BLE_TEMPERATURE_DEVICE_NTC 0
#define BLE_TEMPERATURE_WORK_LED IO_PORTA_07
#define BLE_TEMPERATURE_CHARGE_STATE_CHARGING 1
#define BLE_TEMPERATURE_CHARGE_STATE_FULL 2
#define BLE_TEMPERATURE_CHARGE_STATE_IDLE 3
struct app_dev_info_t struct app_dev_info_t
{ {
u16 temperature_sensor; u16 temperature_sensor;
@ -34,4 +40,7 @@ void temperature_ble_init();
void temperature_init(void); void temperature_init(void);
void ble_receive_callback(u8* data,u16 len); void ble_receive_callback(u8* data,u16 len);
void temperature_work_led(u8 on);
void temperature_charge_led(u8 on);
void temperature_charge_state(int state);
#endif //_APP_TEMPERATURE_H_ #endif //_APP_TEMPERATURE_H_

View File

@ -9,7 +9,7 @@
#include "app_main.h" #include "app_main.h"
#include "app_power_manage.h" #include "app_power_manage.h"
#include "app_handshake.h" #include "app_handshake.h"
#include "app_temperature.h"
#define LOG_TAG_CONST APP_CHARGE #define LOG_TAG_CONST APP_CHARGE
#define LOG_TAG "[APP_CHARGE]" #define LOG_TAG "[APP_CHARGE]"
#define LOG_ERROR_ENABLE #define LOG_ERROR_ENABLE
@ -52,8 +52,8 @@ void charge_full_deal(void)
//power_set_soft_poweroff(); //power_set_soft_poweroff();
//extern spple_set_soft_poweroff(); //extern spple_set_soft_poweroff();
//spple_set_soft_poweroff(); //spple_set_soft_poweroff();
spple_power_event_to_user(POWER_EVENT_POWER_SOFTOFF); temperature_charge_state(BLE_TEMPERATURE_CHARGE_STATE_FULL);
log_info("!!!!!!!!!!!!!! POWER OFF!!!!!!!!!!!!!!!!\n");
} }
void charge_close_deal(void) void charge_close_deal(void)
@ -69,6 +69,7 @@ void charge_ldo5v_in_deal(void)
#else #else
charge_start(); charge_start();
#endif #endif
temperature_charge_state(BLE_TEMPERATURE_CHARGE_STATE_CHARGING);
} }
void charge_ldo5v_off_deal(void) void charge_ldo5v_off_deal(void)
@ -82,6 +83,7 @@ void charge_ldo5v_off_deal(void)
#if TCFG_SYS_LVD_EN #if TCFG_SYS_LVD_EN
vbat_check_init(); vbat_check_init();
#endif #endif
temperature_charge_state(BLE_TEMPERATURE_CHARGE_STATE_IDLE);
} }
int app_charge_event_handler(struct device_event *dev) int app_charge_event_handler(struct device_event *dev)