feat: 完成弹力魔盒初版固件

This commit is contained in:
2026-08-31 20:15:19 +08:00
parent 026d6d5da7
commit b63a928b92
34 changed files with 1320 additions and 781 deletions
+5
View File
@@ -35,6 +35,7 @@
#define BAT_UPDATE_MS (BAT_SAMPLE_MS * BAT_AVG_N) /**< 凑够一次新均值的真实耗时,喂给 app_battery */
#define BAT_BOOT_MS 3000 /* 上电 3s 内不因低电深睡 */
#define BAT_LOG_MS 10000
#define BAT_PERIODIC_LOG_ENABLE 0 /* Production standby must not wake UART periodically. */
#define BAT_LOW_WIN 3 /* 连续约 2.4s 才进低电告警(仅闪灯,不关机) */
/** 充电检测:CHG/VPWR 消抖后的结果 */
@@ -401,6 +402,7 @@ static void power_battery_check_low(uint16_t mv)
*/
static void power_battery_periodic_log(uint16_t dt)
{
#if BAT_PERIODIC_LOG_ENABLE
AppBatterySample_t *s = &s_power.sample;
s->log_ms = app_add_ms(s->log_ms, dt);
@@ -408,6 +410,9 @@ static void power_battery_periodic_log(uint16_t dt)
s->log_ms = 0;
log_info("bat %d%% %dmV alm=%d\n", s->pct, s->mv, s_power.alarm.low_bat);
}
#else
(void)dt;
#endif
}
/**