From 530e9ac7f135bc1e5752ef24633f132acfcca251 Mon Sep 17 00:00:00 2001 From: csc Date: Mon, 27 Jul 2026 00:53:32 +0800 Subject: [PATCH] fix: enable rlcd battery sensing by default --- CMakeLists.txt | 2 +- README.md | 4 ++-- docs/current-progress.md | 18 +++++++++++++++++- docs/hardware.md | 4 ++-- main/Kconfig.projbuild | 9 +++++---- main/app_config.h | 4 ++-- scripts/check_firmware_regressions.py | 14 +++++++++++++- sdkconfig.release.defaults | 1 + 8 files changed, 43 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d73e29..1d31c7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16) -set(PROJECT_VER "0.1.92") +set(PROJECT_VER "0.1.93") include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(weclawbot) diff --git a/README.md b/README.md index 0ac6872..bf11757 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ when all local user state should be removed. | Target | Display | Environment | Navigation | | --- | --- | --- | --- | -| Waveshare ESP32-S3-RLCD-4.2 | 400 x 300 monochrome reflective LCD | onboard SHTC3 | KEY/left: previous and clear text; BOOT/right: next and full clear | +| Waveshare ESP32-S3-RLCD-4.2 | 400 x 300 monochrome reflective LCD | onboard SHTC3 and battery status | KEY/left: previous and clear text; BOOT/right: next and full clear | | Zectrix Note 4 | 400 x 300 monochrome e-paper, SSD2683 | cloud weather, onboard battery status | up: previous and clear text; down: next/hardware power; voice: calendar and full clear | Both targets use ESP32-S3 and 16 MB flash. The visible set stays intentionally @@ -185,7 +185,7 @@ BUILD_DIR="$PWD/build-note4" OUT_DIR="$PWD/web/firmware-note4" ./scripts/prepare ``` Both hardware targets and both build channels render the same versioned -upper-left title, for example `微笺 v0.1.92`. The title is derived from +upper-left title, for example `微笺 v0.1.93`. The title is derived from `WEC_FIRMWARE_VERSION`; there is no separate development-build label. ## Repository Map diff --git a/docs/current-progress.md b/docs/current-progress.md index 4cc0d77..179b306 100644 --- a/docs/current-progress.md +++ b/docs/current-progress.md @@ -68,7 +68,7 @@ WeClawBot / 微笺屏是基于 Waveshare ESP32-S3-RLCD-4.2 的开源固件项目 已知版本问题: -- 公开 `main` 的当前固件源码版本为 `0.1.92`,正式 Release/安装资产仍为 +- 公开 `main` 的当前固件源码版本为 `0.1.93`,正式 Release/安装资产仍为 `v0.1.78`;Web 安装页连接真机后显示设备上报版本。 - `scripts/prepare_web_firmware.sh` 已重新生成 `web/firmware/`。 - 下一次正式发布前仍必须核对 release 产物和安装页 manifest。 @@ -1331,3 +1331,19 @@ weclawbotctl clear external_power_connected=true / ok=true`,Note 4 为 `present=true / percent=69~70 / usb_host_connected=true / external_power_connected=true / ok=true`。最终图标的物理像素外观仍需现场目视确认。 + +## 2026-07-27 RLCD 默认启用电池检测 + +- 用户确认微雪 RLCD 真机已安装电池,因此 `0.1.92` 继续按无电池监测配置对待 RLCD + 是板级能力默认值错误,而不是硬件限制。`0.1.93` 将源码默认改为已安装电池: + `CONFIG_WEC_BATTERY_INSTALLED` 的 Kconfig 默认值、无 Kconfig 编译 fallback 和公开 + release defaults 均为启用;未来确有无电池治具时需要显式关闭该配置。 +- 固件回归、diff 检查与 ESP-IDF 5.5.2 双目标隔离公开构建通过:微雪 `0x623e70` + (应用分区余 23%),Note 4 `0x633b10`(余 22%);生成的两份 `sdkconfig.public` + 均确认 `CONFIG_WEC_BATTERY_INSTALLED=y`。两台 USB 真机已保留 NVS 自动刷入 + `0.1.93`,镜像哈希校验通过,清除下载态后由 watchdog reset 回应用态。串口 + `WEC:GET` 确认两台运行版本均为 `0.1.93`;供电事件确认微雪 RLCD 为 + `present=true / percent=62 / voltage=3.81 / usb_host_connected=true / + external_power_connected=true / ok=true`,Note 4 为 + `present=true / percent=69 / voltage=3.85 / usb_host_connected=true / + external_power_connected=true / ok=true`。最终图标的物理像素外观仍需现场目视确认。 diff --git a/docs/hardware.md b/docs/hardware.md index 10baaf3..e62c0d1 100644 --- a/docs/hardware.md +++ b/docs/hardware.md @@ -67,14 +67,14 @@ This startup retry rule is shared firmware behavior, while boards without an SHTC3 continue to use their board-specific environment source. Both hardware targets render the firmware version in the upper-left header, -for example `微笺 v0.1.92`. Development and public builds use the same title; +for example `微笺 v0.1.93`. Development and public builds use the same title; the visible version comes from `WEC_FIRMWARE_VERSION`. Battery sensing: | Signal | GPIO / ADC | Notes | WeClawBot use | | --- | --- | --- | --- | -| Battery voltage | GPIO4 / ADC1_CH3 | Board example documents battery voltage through a 3x divider. USB power can still make this rail look like a lithium cell, so `CONFIG_WEC_BATTERY_INSTALLED` gates whether the UI treats it as a real battery. | Top status battery/no-battery icon | +| Battery voltage | GPIO4 / ADC1_CH3 | Production WeClawBot targets are treated as battery-equipped by default. Board examples document this input through a divider; USB power can still make this rail look like a lithium cell on no-battery fixtures, so `CONFIG_WEC_BATTERY_INSTALLED` exists only as an explicit fixture override. | Top status battery icon and level | The top status bar uses one power model on both hardware targets. The battery glyph means that an installed battery is available and its fill means battery diff --git a/main/Kconfig.projbuild b/main/Kconfig.projbuild index e5cbc40..eec77c0 100644 --- a/main/Kconfig.projbuild +++ b/main/Kconfig.projbuild @@ -82,11 +82,12 @@ config WEC_REPLY_ON_TEXT config WEC_BATTERY_INSTALLED bool "Device has an installed 18650 battery" - default n + default y help - BAT_ADC reads the board power path through a divider. On USB power it - can still report a lithium-like voltage even when no 18650 cell is - installed, so keep this disabled for boards running without a battery. + Production WeClawBot targets are treated as battery-equipped by + default. BAT_ADC reads the board power path through a divider; on USB + power it can still report a lithium-like voltage even when no 18650 + cell is installed, so disable this only for known no-battery fixtures. config WEC_TEMPERATURE_OFFSET_DECIC int "SHTC3 temperature offset in 0.1 Celsius" diff --git a/main/app_config.h b/main/app_config.h index e753f79..f75f0f5 100644 --- a/main/app_config.h +++ b/main/app_config.h @@ -3,7 +3,7 @@ #include #include -#define WEC_FIRMWARE_VERSION "0.1.92" +#define WEC_FIRMWARE_VERSION "0.1.93" #define WEC_PRODUCT_URL "https://weclawbot.link" #define WEC_PRODUCT_HOST "weclawbot.link" @@ -12,7 +12,7 @@ #endif #ifndef CONFIG_WEC_BATTERY_INSTALLED -#define CONFIG_WEC_BATTERY_INSTALLED 0 +#define CONFIG_WEC_BATTERY_INSTALLED 1 #endif #define WEC_SCREEN_TITLE "微笺 v" WEC_FIRMWARE_VERSION diff --git a/scripts/check_firmware_regressions.py b/scripts/check_firmware_regressions.py index dc71c7c..6cea648 100755 --- a/scripts/check_firmware_regressions.py +++ b/scripts/check_firmware_regressions.py @@ -702,9 +702,12 @@ def check_shared_power_contract() -> None: ui_header = read("main/ui.h") app = read("main/app_main.cc") defaults = read("sdkconfig.zectrix.defaults") + release_defaults = read("sdkconfig.release.defaults") + kconfig = read("main/Kconfig.projbuild") for required in [ "#define WEC_BOARD_HAS_INSTALLED_BATTERY 1", "CONFIG_WEC_BATTERY_INSTALLED=y", + "#define CONFIG_WEC_BATTERY_INSTALLED 1", "constexpr float kDividerRatio = 2.0f;", "!battery_status_known_ && WEC_BOARD_HAS_INSTALLED_BATTERY", "UpdatePowerIndicatorsLocked();", @@ -717,8 +720,17 @@ def check_shared_power_contract() -> None: '\\"external_power_connected\\":%s', '\\"battery_monitor_enabled\\":%s', ]: - if required not in "\n".join([config, battery, ui, ui_header, app, defaults]): + if required not in "\n".join( + [config, battery, ui, ui_header, app, defaults, release_defaults, kconfig] + ): fail(f"shared power contract is missing {required}") + battery_config = kconfig.split("config WEC_BATTERY_INSTALLED", 1)[1].split( + "\nconfig ", 1 + )[0] + if "default y" not in battery_config: + fail("RLCD source default must treat the product as battery-equipped") + if "CONFIG_WEC_BATTERY_INSTALLED=y" not in release_defaults: + fail("public RLCD release defaults must enable battery sensing") if "plug_parts_[5]" in ui_header or "usb_power_parts_[4]" in ui_header: fail("hardware targets must not use separate external-power glyphs") if app.index("ui.SetUsbHostPowerStatus(UsbHostPowerConnected());") > app.index( diff --git a/sdkconfig.release.defaults b/sdkconfig.release.defaults index 1ffeb7e..4f5db1a 100644 --- a/sdkconfig.release.defaults +++ b/sdkconfig.release.defaults @@ -1,2 +1,3 @@ # Public release overrides belong in this file. The screen title always uses # the firmware version and does not vary by build channel. +CONFIG_WEC_BATTERY_INSTALLED=y