添加不开机充电功能
This commit is contained in:
parent
5c1f5d9971
commit
ee5fcf0ad2
@ -26,6 +26,7 @@
|
||||
#include "kt_battery.h"
|
||||
#include "asm/adc_api.h"
|
||||
#include "system/timer.h"
|
||||
#include "user_cfg_id.h"
|
||||
|
||||
/* 采样周期 ms;周期 × 缓冲长度 = 平滑窗口 */
|
||||
#define KT_BAT_SAMPLE_MS 200u
|
||||
@ -52,6 +53,15 @@
|
||||
#define KT_BAT_CC_CV_THRESHOLD 80u
|
||||
#define KT_BAT_CC_BUMP_TICKS ((u16)(KT_BAT_CC_BUMP_SEC * 1000u / KT_BAT_SAMPLE_MS))
|
||||
#define KT_BAT_CV_BUMP_TICKS ((u16)(KT_BAT_CV_BUMP_SEC * 1000u / KT_BAT_SAMPLE_MS))
|
||||
/* VM 写入策略: 百分比变化至少 2%,且间隔至少 10 分钟 */
|
||||
#define KT_BAT_VM_SAVE_DELTA_PERCENT 2u
|
||||
#define KT_BAT_VM_SAVE_MIN_SEC 600u
|
||||
#define KT_BAT_VM_SAVE_MIN_TICKS ((u16)(KT_BAT_VM_SAVE_MIN_SEC * 1000u / KT_BAT_SAMPLE_MS))
|
||||
/* 首次无历史记录时,插电开机随机起点 65~75% */
|
||||
#define KT_BAT_BOOT_FALLBACK_MIN 65u
|
||||
#define KT_BAT_BOOT_FALLBACK_MAX 75u
|
||||
/* VM 数据校验 */
|
||||
#define KT_BAT_VM_TAG 0xA5u
|
||||
|
||||
static u16 vbat_buf[KT_BAT_FILTER_N];
|
||||
static u8 vbat_buf_idx;
|
||||
@ -61,8 +71,71 @@ static u8 vbat_percent_cached = 100u;
|
||||
static u8 vbat_charging;
|
||||
static u8 vbat_recovery_ticks; /* > 0 表示处于"极化消退期",期间不更新 % */
|
||||
static u16 vbat_charge_bump_cnt; /* 充电中累计的 200ms tick 数,达到阈值就 +1% */
|
||||
static u16 vbat_vm_save_ticks;
|
||||
static u8 vbat_vm_last_saved_percent = 0xFFu;
|
||||
static u16 vbat_timer_id;
|
||||
|
||||
struct kt_bat_vm_record {
|
||||
u8 tag;
|
||||
u8 percent;
|
||||
u8 checksum;
|
||||
};
|
||||
|
||||
static u8 kt_battery_vm_checksum(u8 tag, u8 percent)
|
||||
{
|
||||
return (u8)(tag ^ percent ^ 0x5Au);
|
||||
}
|
||||
|
||||
static u8 kt_battery_random_percent_fallback(void)
|
||||
{
|
||||
u8 rnd = 0;
|
||||
get_random_number(&rnd, 1);
|
||||
return (u8)(KT_BAT_BOOT_FALLBACK_MIN
|
||||
+ (rnd % (KT_BAT_BOOT_FALLBACK_MAX - KT_BAT_BOOT_FALLBACK_MIN + 1u)));
|
||||
}
|
||||
|
||||
static u8 kt_battery_vm_load_percent(u8 *percent)
|
||||
{
|
||||
struct kt_bat_vm_record rec;
|
||||
if (!percent) {
|
||||
return 0u;
|
||||
}
|
||||
|
||||
if (syscfg_read(VM_KT_BAT_LAST_PERCENT, &rec, sizeof(rec)) != sizeof(rec)) {
|
||||
return 0u;
|
||||
}
|
||||
if (rec.tag != KT_BAT_VM_TAG) {
|
||||
return 0u;
|
||||
}
|
||||
if (rec.checksum != kt_battery_vm_checksum(rec.tag, rec.percent)) {
|
||||
return 0u;
|
||||
}
|
||||
if ((rec.percent == 0u) || (rec.percent >= 100u)) {
|
||||
return 0u;
|
||||
}
|
||||
|
||||
*percent = rec.percent;
|
||||
return 1u;
|
||||
}
|
||||
|
||||
static void kt_battery_vm_save_percent(u8 percent)
|
||||
{
|
||||
struct kt_bat_vm_record rec;
|
||||
|
||||
if ((percent == 0u) || (percent >= 100u)) {
|
||||
return;
|
||||
}
|
||||
|
||||
rec.tag = KT_BAT_VM_TAG;
|
||||
rec.percent = percent;
|
||||
rec.checksum = kt_battery_vm_checksum(rec.tag, rec.percent);
|
||||
if (syscfg_write(VM_KT_BAT_LAST_PERCENT, &rec, sizeof(rec)) == sizeof(rec)) {
|
||||
vbat_vm_last_saved_percent = percent;
|
||||
vbat_vm_save_ticks = 0;
|
||||
printf("kt_battery: vm save percent=%d\n", percent);
|
||||
}
|
||||
}
|
||||
|
||||
static u16 kt_battery_read_raw_mv(void)
|
||||
{
|
||||
/* SDK adc_get_voltage 返回引脚电压 (mV),× 分压系数 = 电池电压 (mV) */
|
||||
@ -132,6 +205,8 @@ static void kt_battery_sample_cb(void *priv)
|
||||
if (vbat_recovery_ticks == 0) {
|
||||
kt_battery_reseed(raw);
|
||||
vbat_percent_cached = kt_battery_mv_to_percent(raw);
|
||||
/* 恢复期结束后从 0 重新计时,避免立刻写 VM */
|
||||
vbat_vm_save_ticks = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -162,6 +237,19 @@ static void kt_battery_sample_cb(void *priv)
|
||||
} else if ((u16)new_p + KT_BAT_HYSTERESIS <= vbat_percent_cached) {
|
||||
vbat_percent_cached = new_p;
|
||||
}
|
||||
|
||||
if (vbat_vm_save_ticks < 0xFFFFu) {
|
||||
vbat_vm_save_ticks++;
|
||||
}
|
||||
if ((vbat_percent_cached > 0u)
|
||||
&& (vbat_percent_cached < 100u)
|
||||
&& (vbat_vm_last_saved_percent != 0xFFu)
|
||||
&& ((u8)((vbat_vm_last_saved_percent > vbat_percent_cached)
|
||||
? (vbat_vm_last_saved_percent - vbat_percent_cached)
|
||||
: (vbat_percent_cached - vbat_vm_last_saved_percent)) >= KT_BAT_VM_SAVE_DELTA_PERCENT)
|
||||
&& (vbat_vm_save_ticks >= KT_BAT_VM_SAVE_MIN_TICKS)) {
|
||||
kt_battery_vm_save_percent(vbat_percent_cached);
|
||||
}
|
||||
}
|
||||
|
||||
u8 kt_get_vbat_percent(void)
|
||||
@ -197,24 +285,33 @@ void kt_set_charging(u8 charging)
|
||||
|
||||
void kt_battery_init(void)
|
||||
{
|
||||
u8 vm_percent = 0;
|
||||
u8 have_vm_percent = kt_battery_vm_load_percent(&vm_percent);
|
||||
|
||||
/* 用一次即时采样把环形缓冲全部种子化,避免开机瞬间百分比从 100% 跳到真实值 */
|
||||
u16 seed = kt_battery_read_raw_mv();
|
||||
kt_battery_reseed(seed);
|
||||
vbat_recovery_ticks = 0;
|
||||
vbat_charge_bump_cnt = 0;
|
||||
|
||||
/* 开机就用电压算一个起点 %。开机即在充电时,这个值会偏高(电池端电压被充电 IC
|
||||
* 拉到 CC/CV 阶段的水平),但作为"起点"展示无伤大雅——后续充电模拟爬升会让它
|
||||
* 单调向 100% 增长,用户看到的就是"开机当前 N%、慢慢涨到 100%"的自然反馈。
|
||||
* 拔掉充电器后,极化消退期结束会用真实 OCV 重新校准 %。 */
|
||||
vbat_percent_cached = kt_battery_mv_to_percent(seed);
|
||||
vbat_vm_save_ticks = 0;
|
||||
|
||||
if (gpio_read(KT_CFG_USB_PLUG_DET_PIN)) {
|
||||
vbat_charging = 1u;
|
||||
printf("kt_battery_init: USB inserted at boot, charging from %d%%, seed_mv=%d\n",
|
||||
vbat_percent_cached, vbat_avg_mv);
|
||||
if (have_vm_percent) {
|
||||
vbat_percent_cached = vm_percent;
|
||||
printf("kt_battery_init: USB inserted, use vm percent=%d%%, seed_mv=%d\n",
|
||||
vbat_percent_cached, vbat_avg_mv);
|
||||
} else {
|
||||
vbat_percent_cached = kt_battery_random_percent_fallback();
|
||||
printf("kt_battery_init: USB inserted, vm empty, random percent=%d%%, seed_mv=%d\n",
|
||||
vbat_percent_cached, vbat_avg_mv);
|
||||
}
|
||||
vbat_vm_last_saved_percent = vbat_percent_cached;
|
||||
printf("kt_battery_init: charging from %d%%\n", vbat_percent_cached);
|
||||
} else {
|
||||
vbat_charging = 0u;
|
||||
vbat_percent_cached = kt_battery_mv_to_percent(seed);
|
||||
vbat_vm_last_saved_percent = vbat_percent_cached;
|
||||
printf("kt_battery_init: seed_mv=%d init_percent=%d\n",
|
||||
vbat_avg_mv, vbat_percent_cached);
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include "system/includes.h"
|
||||
#include "system/timer.h"
|
||||
#include "app_power_manage.h"
|
||||
#include "app_main.h"
|
||||
#include "kt_battery.h"
|
||||
|
||||
struct ui_led7_env
|
||||
@ -586,7 +587,11 @@ void kt_led7_init(void)
|
||||
led7_ui_1s_timer_armed = 1;
|
||||
}
|
||||
}
|
||||
/* 欢迎画面 5s,结束后由 kt_led7_ui_1s_tick 切回电量显示 */
|
||||
kt_led7_temp_show_string((const u8 *)"HI", 5);
|
||||
/* 正常开机保留欢迎字 HI;插电唤醒场景直接显示电量 */
|
||||
if (app_var.poweron_charge) {
|
||||
kt_led7_battery_show_restart();
|
||||
} else {
|
||||
kt_led7_temp_show_string((const u8 *)"HI", 5);
|
||||
}
|
||||
sys_s_hi_timer_add(NULL, kt_led7_scan, 2); /* 2ms */
|
||||
}
|
||||
@ -801,6 +801,14 @@ struct port_wakeup port0 = {
|
||||
.iomap = IO_PORTB_01, //唤醒口选择
|
||||
};
|
||||
|
||||
/* USB VBUS 插入唤醒 */
|
||||
struct port_wakeup port1 = {
|
||||
.pullup_down_enable = ENABLE, //配置I/O 内部上下拉是否使能
|
||||
.edge = LEADING_EDGE, //唤醒方式选择,可选:上升沿\下降沿
|
||||
.attribute = BLUETOOTH_RESUME, //保留参数
|
||||
.iomap = IO_PORTB_03, //唤醒口选择
|
||||
};
|
||||
|
||||
/* RTC PR0 PR1 唤醒 */
|
||||
/* struct port_wakeup rtc_port0 = { */
|
||||
/* .pullup_down_enable = ENABLE, //配置I/O 内部上下拉是否使能 */
|
||||
@ -826,6 +834,7 @@ const struct charge_wakeup charge_wkup = {
|
||||
|
||||
const struct wakeup_param wk_param = {
|
||||
.port[1] = &port0,
|
||||
.port[2] = &port1,
|
||||
/* .rtc_port[0] = &rtc_port0, */
|
||||
/* .rtc_port[1] = &rtc_port1, */
|
||||
.sub = &sub_wkup,
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
|
||||
#include "kt.h"
|
||||
|
||||
|
||||
extern void setup_arch();
|
||||
extern int audio_dec_init();
|
||||
extern int audio_enc_init();
|
||||
@ -43,27 +42,27 @@ static void do_module_initcall()
|
||||
|
||||
void __attribute__((weak)) board_init()
|
||||
{
|
||||
|
||||
}
|
||||
void __attribute__((weak)) board_early_init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int eSystemConfirmStopStatus(void)
|
||||
{
|
||||
/* 系统进入在未来时间里,无任务超时唤醒,可根据用户选择系统停止,或者系统定时唤醒(100ms) */
|
||||
//1:Endless Sleep
|
||||
//0:100 ms wakeup
|
||||
if (get_charge_full_flag()) {
|
||||
// 1:Endless Sleep
|
||||
// 0:100 ms wakeup
|
||||
if (get_charge_full_flag())
|
||||
{
|
||||
log_i("Endless Sleep");
|
||||
power_set_soft_poweroff();
|
||||
return 1;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
log_i("100 ms wakeup");
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void check_power_on_key(void)
|
||||
@ -71,24 +70,38 @@ static void check_power_on_key(void)
|
||||
u32 delay_10ms_cnt = 0;
|
||||
u32 delay_10msp_cnt = 0;
|
||||
|
||||
while (1) {
|
||||
while (1)
|
||||
{
|
||||
clr_wdt();
|
||||
os_time_dly(2);
|
||||
|
||||
extern u8 get_power_on_status(void);
|
||||
if (get_power_on_status()) {
|
||||
if (get_power_on_status())
|
||||
{
|
||||
putchar('+');
|
||||
delay_10msp_cnt = 0;
|
||||
delay_10ms_cnt++;
|
||||
if (delay_10ms_cnt > 70) {
|
||||
if (delay_10ms_cnt > 70)
|
||||
{
|
||||
printf("power on key\n");
|
||||
app_var.poweron_charge = 0;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (app_var.poweron_charge)
|
||||
{
|
||||
printf("this plug wakeup......,no need check power on key\n");
|
||||
return;
|
||||
}
|
||||
|
||||
putchar('-');
|
||||
delay_10ms_cnt = 0;
|
||||
|
||||
delay_10msp_cnt++;
|
||||
if (delay_10msp_cnt > 20) {
|
||||
if (delay_10msp_cnt > 20)
|
||||
{
|
||||
puts("enter softpoweroff\n");
|
||||
power_set_soft_poweroff();
|
||||
}
|
||||
@ -99,6 +112,10 @@ static void check_power_on_key(void)
|
||||
static void app_init()
|
||||
{
|
||||
int update;
|
||||
app_var.poweron_charge = 0;
|
||||
// if (gpio_read(IO_PORTB_03)) {
|
||||
// app_var.poweron_charge = 1;
|
||||
// }
|
||||
|
||||
do_early_initcall();
|
||||
do_platform_initcall();
|
||||
@ -111,28 +128,39 @@ static void app_init()
|
||||
do_module_initcall();
|
||||
do_late_initcall();
|
||||
|
||||
|
||||
audio_enc_init();
|
||||
audio_dec_init();
|
||||
|
||||
if (!UPDATE_SUPPORT_DEV_IS_NULL()) {
|
||||
if (gpio_read(IO_PORTB_03))
|
||||
{
|
||||
printf("USB VBUS insert\n");
|
||||
app_var.poweron_charge = 1;
|
||||
}
|
||||
|
||||
if (!UPDATE_SUPPORT_DEV_IS_NULL())
|
||||
{
|
||||
update = update_result_deal();
|
||||
}
|
||||
|
||||
app_var.play_poweron_tone = 1;
|
||||
|
||||
if (!get_charge_online_flag()) {
|
||||
if (!get_charge_online_flag())
|
||||
{
|
||||
check_power_on_voltage();
|
||||
|
||||
#if TCFG_POWER_ON_NEED_KEY
|
||||
/*充电拔出,CPU软件复位, 不检测按键,直接开机*/
|
||||
#if TCFG_CHARGE_OFF_POWERON_NE
|
||||
if ((!update && cpu_reset_by_soft()) || is_ldo5v_wakeup()) {
|
||||
if ((!update && cpu_reset_by_soft()) || is_ldo5v_wakeup())
|
||||
{
|
||||
#else
|
||||
if (!update && cpu_reset_by_soft()) {
|
||||
if (!update && cpu_reset_by_soft())
|
||||
{
|
||||
#endif
|
||||
app_var.play_poweron_tone = 0;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
check_power_on_key();
|
||||
}
|
||||
#endif
|
||||
@ -147,29 +175,20 @@ static void app_init()
|
||||
*2.power_on_reset(BIT0:上电复位)
|
||||
*3.pin reset(BIT4:长按复位)
|
||||
*/
|
||||
if (update || (power_reset_src & BIT(0)) || (power_reset_src & BIT(4))) {
|
||||
//log_info("reset_flag:0x%x",power_reset_src);
|
||||
if (update || (power_reset_src & BIT(0)) || (power_reset_src & BIT(4)))
|
||||
{
|
||||
// log_info("reset_flag:0x%x",power_reset_src);
|
||||
cur_por_flag = 0xA5;
|
||||
}
|
||||
int ret = syscfg_read(CFG_POR_FLAG, &por_flag, 1);
|
||||
if ((cur_por_flag == 0xA5) && (por_flag != cur_por_flag)) {
|
||||
//log_info("update POR flag");
|
||||
if ((cur_por_flag == 0xA5) && (por_flag != cur_por_flag))
|
||||
{
|
||||
// log_info("update POR flag");
|
||||
ret = syscfg_write(CFG_POR_FLAG, &cur_por_flag, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (TCFG_CHARGE_ENABLE && TCFG_CHARGE_POWERON_ENABLE)
|
||||
if (is_ldo5v_wakeup()) { //LDO5V唤醒
|
||||
extern u8 get_charge_online_flag(void);
|
||||
if (get_charge_online_flag()) { //关机时,充电插入
|
||||
|
||||
} else { //关机时,充电拔出
|
||||
power_set_soft_poweroff();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if(TCFG_CHARGE_BOX_ENABLE)
|
||||
#if (TCFG_CHARGE_BOX_ENABLE)
|
||||
/* clock_add_set(CHARGE_BOX_CLK); */
|
||||
chgbox_init_app();
|
||||
#endif
|
||||
@ -190,10 +209,9 @@ __attribute__((used)) int *__errno()
|
||||
int main()
|
||||
{
|
||||
|
||||
#if (CONFIG_CPU_BR25)
|
||||
|
||||
#if(CONFIG_CPU_BR25)
|
||||
|
||||
#if (TCFG_DEC2TWS_ENABLE ||RECORDER_MIX_EN || TCFG_DRC_ENABLE || TCFG_USER_BLE_ENABLE || TCFG_DEC_APE_ENABLE || TCFG_DEC_FLAC_ENABLE || TCFG_DEC_DTS_ENABLE || TCFG_USER_EMITTER_ENABLE)
|
||||
#if (TCFG_DEC2TWS_ENABLE || RECORDER_MIX_EN || TCFG_DRC_ENABLE || TCFG_USER_BLE_ENABLE || TCFG_DEC_APE_ENABLE || TCFG_DEC_FLAC_ENABLE || TCFG_DEC_DTS_ENABLE || TCFG_USER_EMITTER_ENABLE)
|
||||
clock_set_sfc_max_freq(100 * 1000000, 100 * 1000000);
|
||||
#else
|
||||
|
||||
@ -221,10 +239,10 @@ int main()
|
||||
|
||||
local_irq_enable();
|
||||
|
||||
while (1) {
|
||||
while (1)
|
||||
{
|
||||
asm("idle");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -55,6 +55,7 @@
|
||||
//
|
||||
//
|
||||
#define VM_TWS_ROLE 38
|
||||
#define VM_KT_BAT_LAST_PERCENT 39
|
||||
|
||||
#if (VM_ITEM_MAX_NUM > 128)
|
||||
|
||||
|
||||
@ -28,6 +28,8 @@
|
||||
#include "user_cfg.h"
|
||||
#include "ui/ui_api.h"
|
||||
#include "key_event_deal.h"
|
||||
#include "kt_led7.h"
|
||||
#include "kt.h"
|
||||
|
||||
#define LOG_TAG_CONST APP_IDLE
|
||||
#define LOG_TAG "[APP_IDLE]"
|
||||
@ -43,11 +45,13 @@ static int timer_printf_1sec = 0;
|
||||
static u8 is_idle_flag = 0;
|
||||
static u8 goto_poweron_cnt = 0;
|
||||
static u8 goto_poweron_flag = 0;
|
||||
static u16 idle_plug_unplug_timer = 0;
|
||||
|
||||
extern u8 get_power_on_status(void);
|
||||
|
||||
static void idle_key_poweron_deal(u8 step);
|
||||
static void idle_app_open_module();
|
||||
static void idle_plug_unplug_check(void *priv);
|
||||
|
||||
#define POWER_ON_CNT 10
|
||||
/// idle 是否关闭不用的模块,减少功耗
|
||||
@ -254,6 +258,7 @@ static void idle_key_poweron_deal(u8 step)
|
||||
goto_poweron_cnt = 0;
|
||||
goto_poweron_flag = 0;
|
||||
app_var.goto_poweroff_flag = 0;
|
||||
app_task_switch_to(APP_BT_TASK);
|
||||
#if LOW_POWER_IN_IDLE
|
||||
idle_app_open_module();
|
||||
#endif
|
||||
@ -338,6 +343,10 @@ static int idle_sys_event_handler(struct sys_event *event)
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static void idle_task_close()
|
||||
{
|
||||
if (idle_plug_unplug_timer) {
|
||||
sys_timer_del(idle_plug_unplug_timer);
|
||||
idle_plug_unplug_timer = 0;
|
||||
}
|
||||
UI_HIDE_CURR_WINDOW();
|
||||
}
|
||||
|
||||
@ -468,6 +477,11 @@ static void idle_app_start()
|
||||
#endif
|
||||
|
||||
UI_SHOW_WINDOW(ID_WINDOW_IDLE);
|
||||
kt_led7_battery_show_restart();
|
||||
|
||||
if (!idle_plug_unplug_timer) {
|
||||
idle_plug_unplug_timer = sys_timer_add(NULL, idle_plug_unplug_check, 50);
|
||||
}
|
||||
|
||||
#if (TCFG_CHARGE_ENABLE && !TCFG_CHARGE_POWERON_ENABLE)
|
||||
|
||||
@ -476,6 +490,20 @@ static void idle_app_start()
|
||||
#endif
|
||||
}
|
||||
|
||||
static void idle_plug_unplug_check(void *priv)
|
||||
{
|
||||
(void)priv;
|
||||
|
||||
/* 插电唤醒进 idle 后,若 PB3 变低(拔线)则直接关机,不走提示音流程 */
|
||||
if (app_var.poweron_charge && (gpio_read(KT_CFG_USB_PLUG_DET_PIN) == 0)) {
|
||||
app_var.play_poweron_tone = 0;
|
||||
app_var.goto_poweroff_flag = 1;
|
||||
app_var.poweron_charge = 0;
|
||||
printf("idle: plug-wakeup unplug on PB3, poweroff now\n");
|
||||
power_set_soft_poweroff();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//*----------------------------------------------------------------------------*/
|
||||
/**@brief idle 主任务
|
||||
@ -508,6 +536,7 @@ void app_idle_task()
|
||||
idle_task_close();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -63,7 +63,15 @@ static int power_on_init(void)
|
||||
#endif
|
||||
|
||||
#if TCFG_APP_BT_EN
|
||||
app_task_switch_to(APP_BT_TASK);
|
||||
//if (app_var.poweron_charge)
|
||||
//{
|
||||
// app_task_switch_to(APP_IDLE_TASK);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
app_task_switch_to(APP_BT_TASK);
|
||||
//}
|
||||
|
||||
#else
|
||||
|
||||
#if TCFG_USB_APPLE_DOCK_EN //苹果iap协议使用pc模式
|
||||
@ -129,13 +137,26 @@ static void tone_play_end_callback(void *priv, int flag)
|
||||
|
||||
void app_poweron_task()
|
||||
{
|
||||
printf("app_poweron_task poweron_charge: %d\n", app_var.poweron_charge);
|
||||
int msg[32];
|
||||
kt_init();
|
||||
|
||||
|
||||
UI_SHOW_MENU(MENU_POWER_UP, 0, 0, NULL);
|
||||
|
||||
int err = tone_play_with_callback_by_name(tone_table[IDEX_TONE_POWER_ON], 1, tone_play_end_callback, (void *)IDEX_TONE_POWER_ON);
|
||||
|
||||
|
||||
if (app_var.poweron_charge == 1)
|
||||
{
|
||||
app_task_switch_to(APP_IDLE_TASK);
|
||||
//int err = tone_play_with_callback_by_name(tone_table[IDEX_TONE_POWER_ON], 1, tone_play_end_callback, (void *)IDEX_TONE_POWER_ON);
|
||||
}
|
||||
else
|
||||
{
|
||||
int err = tone_play_with_callback_by_name(tone_table[IDEX_TONE_POWER_ON], 1, tone_play_end_callback, (void *)IDEX_TONE_POWER_ON);
|
||||
}
|
||||
|
||||
//int err = tone_play_with_callback_by_name(tone_table[IDEX_TONE_POWER_ON], 1, tone_play_end_callback, (void *)IDEX_TONE_POWER_ON);
|
||||
/* if (err) { //提示音没有,播放失败,直接init流程 */
|
||||
/* power_on_init(); */
|
||||
/* } */
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
cpu/br23/tools/download/standard/update_HTFAN03_917E.ufw
Normal file
BIN
cpu/br23/tools/download/standard/update_HTFAN03_917E.ufw
Normal file
Binary file not shown.
@ -1722,6 +1722,7 @@ objs/apps/kaotings/kt_led7.c.o
|
||||
-r=objs/apps/kaotings/kt_led7.c.o,kt_get_vbat_percent,l
|
||||
-r=objs/apps/kaotings/kt_led7.c.o,puts,l
|
||||
-r=objs/apps/kaotings/kt_led7.c.o,led7_pin,pl
|
||||
-r=objs/apps/kaotings/kt_led7.c.o,app_var,l
|
||||
objs/apps/kaotings/kt_fan_ac.c.o
|
||||
-r=objs/apps/kaotings/kt_fan_ac.c.o,kt_fan_ac_init,pl
|
||||
-r=objs/apps/kaotings/kt_fan_ac.c.o,mcpwm_init,l
|
||||
@ -1757,7 +1758,10 @@ objs/apps/kaotings/kt_battery.c.o
|
||||
-r=objs/apps/kaotings/kt_battery.c.o,kt_battery_init,pl
|
||||
-r=objs/apps/kaotings/kt_battery.c.o,gpio_read,l
|
||||
-r=objs/apps/kaotings/kt_battery.c.o,sys_timer_add,l
|
||||
-r=objs/apps/kaotings/kt_battery.c.o,syscfg_read,l
|
||||
-r=objs/apps/kaotings/kt_battery.c.o,adc_get_voltage,l
|
||||
-r=objs/apps/kaotings/kt_battery.c.o,get_random_number,l
|
||||
-r=objs/apps/kaotings/kt_battery.c.o,syscfg_write,l
|
||||
objs/apps/soundbox/app_main.c.o
|
||||
-r=objs/apps/soundbox/app_main.c.o,app_entry_idle,pl
|
||||
-r=objs/apps/soundbox/app_main.c.o,app_task_switch_to,l
|
||||
@ -1905,6 +1909,7 @@ objs/apps/soundbox/board/br23/board_ac695x_demo/board_ac695x_demo.c.o
|
||||
-r=objs/apps/soundbox/board/br23/board_ac695x_demo/board_ac695x_demo.c.o,device_table,pl
|
||||
-r=objs/apps/soundbox/board/br23/board_ac695x_demo/board_ac695x_demo.c.o,power_param,pl
|
||||
-r=objs/apps/soundbox/board/br23/board_ac695x_demo/board_ac695x_demo.c.o,port0,pl
|
||||
-r=objs/apps/soundbox/board/br23/board_ac695x_demo/board_ac695x_demo.c.o,port1,pl
|
||||
-r=objs/apps/soundbox/board/br23/board_ac695x_demo/board_ac695x_demo.c.o,sub_wkup,pl
|
||||
-r=objs/apps/soundbox/board/br23/board_ac695x_demo/board_ac695x_demo.c.o,charge_wkup,pl
|
||||
-r=objs/apps/soundbox/board/br23/board_ac695x_demo/board_ac695x_demo.c.o,wk_param,pl
|
||||
@ -2041,6 +2046,7 @@ objs/apps/soundbox/common/init.c.o
|
||||
-r=objs/apps/soundbox/common/init.c.o,kt_boot_init,l
|
||||
-r=objs/apps/soundbox/common/init.c.o,audio_enc_init,l
|
||||
-r=objs/apps/soundbox/common/init.c.o,audio_dec_init,l
|
||||
-r=objs/apps/soundbox/common/init.c.o,gpio_read,l
|
||||
-r=objs/apps/soundbox/common/init.c.o,update_result_deal,l
|
||||
-r=objs/apps/soundbox/common/init.c.o,get_charge_online_flag,l
|
||||
-r=objs/apps/soundbox/common/init.c.o,check_power_on_voltage,l
|
||||
@ -2052,8 +2058,8 @@ objs/apps/soundbox/common/init.c.o
|
||||
-r=objs/apps/soundbox/common/init.c.o,get_power_on_status,l
|
||||
-r=objs/apps/soundbox/common/init.c.o,putchar,l
|
||||
-r=objs/apps/soundbox/common/init.c.o,puts,l
|
||||
-r=objs/apps/soundbox/common/init.c.o,config_update_mode,l
|
||||
-r=objs/apps/soundbox/common/init.c.o,app_var,l
|
||||
-r=objs/apps/soundbox/common/init.c.o,config_update_mode,l
|
||||
-r=objs/apps/soundbox/common/init.c.o,power_reset_src,l
|
||||
-r=objs/apps/soundbox/common/init.c.o,early_initcall_begin,
|
||||
-r=objs/apps/soundbox/common/init.c.o,early_initcall_end,
|
||||
@ -3430,10 +3436,17 @@ objs/apps/soundbox/task_manager/idle/idle.c.o
|
||||
-r=objs/apps/soundbox/task_manager/idle/idle.c.o,app_task_get_msg,l
|
||||
-r=objs/apps/soundbox/task_manager/idle/idle.c.o,app_default_event_deal,l
|
||||
-r=objs/apps/soundbox/task_manager/idle/idle.c.o,app_task_exitting,l
|
||||
-r=objs/apps/soundbox/task_manager/idle/idle.c.o,kt_led7_battery_show_restart,l
|
||||
-r=objs/apps/soundbox/task_manager/idle/idle.c.o,sys_timer_add,l
|
||||
-r=objs/apps/soundbox/task_manager/idle/idle.c.o,sys_key_event_enable,l
|
||||
-r=objs/apps/soundbox/task_manager/idle/idle.c.o,gpio_read,l
|
||||
-r=objs/apps/soundbox/task_manager/idle/idle.c.o,power_set_soft_poweroff,l
|
||||
-r=objs/apps/soundbox/task_manager/idle/idle.c.o,log_print,l
|
||||
-r=objs/apps/soundbox/task_manager/idle/idle.c.o,log_tag_const_i_APP_IDLE,l
|
||||
-r=objs/apps/soundbox/task_manager/idle/idle.c.o,app_task_switch_to,l
|
||||
-r=objs/apps/soundbox/task_manager/idle/idle.c.o,sys_timer_del,l
|
||||
-r=objs/apps/soundbox/task_manager/idle/idle.c.o,puts,l
|
||||
-r=objs/apps/soundbox/task_manager/idle/idle.c.o,app_var,l
|
||||
-r=objs/apps/soundbox/task_manager/idle/idle.c.o,log_tag_const_i_APP_IDLE,l
|
||||
objs/apps/soundbox/task_manager/linein/linein.c.o
|
||||
-r=objs/apps/soundbox/task_manager/linein/linein.c.o,linein_app_check,pl
|
||||
-r=objs/apps/soundbox/task_manager/linein/linein.c.o,app_linein_task,pl
|
||||
@ -3466,15 +3479,17 @@ objs/apps/soundbox/task_manager/power_off/power_off.c.o
|
||||
-r=objs/apps/soundbox/task_manager/power_off/power_off.c.o,tone_table,l
|
||||
objs/apps/soundbox/task_manager/power_on/power_on.c.o
|
||||
-r=objs/apps/soundbox/task_manager/power_on/power_on.c.o,app_poweron_task,pl
|
||||
-r=objs/apps/soundbox/task_manager/power_on/power_on.c.o,printf,l
|
||||
-r=objs/apps/soundbox/task_manager/power_on/power_on.c.o,kt_init,l
|
||||
-r=objs/apps/soundbox/task_manager/power_on/power_on.c.o,app_task_switch_to,l
|
||||
-r=objs/apps/soundbox/task_manager/power_on/power_on.c.o,tone_play_with_callback_by_name,l
|
||||
-r=objs/apps/soundbox/task_manager/power_on/power_on.c.o,app_task_get_msg,l
|
||||
-r=objs/apps/soundbox/task_manager/power_on/power_on.c.o,app_default_event_deal,l
|
||||
-r=objs/apps/soundbox/task_manager/power_on/power_on.c.o,app_task_exitting,l
|
||||
-r=objs/apps/soundbox/task_manager/power_on/power_on.c.o,app_get_curr_task,l
|
||||
-r=objs/apps/soundbox/task_manager/power_on/power_on.c.o,log_print,l
|
||||
-r=objs/apps/soundbox/task_manager/power_on/power_on.c.o,app_task_switch_to,l
|
||||
-r=objs/apps/soundbox/task_manager/power_on/power_on.c.o,tone_play_stop,l
|
||||
-r=objs/apps/soundbox/task_manager/power_on/power_on.c.o,app_var,l
|
||||
-r=objs/apps/soundbox/task_manager/power_on/power_on.c.o,tone_table,l
|
||||
-r=objs/apps/soundbox/task_manager/power_on/power_on.c.o,log_tag_const_e_APP_IDLE,l
|
||||
objs/apps/soundbox/task_manager/record/record.c.o
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -21,8 +21,8 @@
|
||||
#define WKUP_SHORT_KEY 0x80
|
||||
|
||||
|
||||
#define LEADING_EDGE 0
|
||||
#define FALLING_EDGE 1
|
||||
#define LEADING_EDGE 0 //上升沿
|
||||
#define FALLING_EDGE 1 //下降沿
|
||||
|
||||
|
||||
struct rtc_dev_data {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user