PowerState not initialized from actual power source — spurious backhaul on backup battery at first boot
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- cpp
- 领域
- embedded-iot
调研方向
从 begin() 的第 74 行附近开始,跟踪被丢弃的 PowerAuto() 结果和 PowerState 成员。然后检查 Run() 和 turnOnSDcard(),确认首个周期的 backhaul gate 使用检测到的电源。完成的标准是:在第一个日志事件之前,PowerState 反映实际电源,包括使用备用电池或辅助电池启动的情况。
由索引模型根据 Issue 内容生成。
描述
Bug
PowerState (a float member, initialized to 0) is only updated inside turnOnSDcard(), which is called from sleepNow(). Before the device sleeps for the first time, PowerState remains 0 regardless of actual power source.
The backhaul gate in Run() is:
if(LogCount >= LogCountPush && PowerState == 0) {
IO.DigitalWrite(FeatherEN, HIGH, MCP23018::Ports::B); // turn on Feather
PowerAuto() is called in begin() (line ~74) but its return value is discarded — PowerState is not updated there.
Failure scenario
Device starts on backup/aux battery (PowerAuto() would return 1 or 2). For the entire first duty cycle (before the first sleep), PowerState is still 0, so the backhaul guard evaluates true. The Feather fires on backup power, potentially browning out the radio and draining the backup supply prematurely.
Fix
Store PowerAuto() return value into PowerState at the end of begin(), so power state is known from the first log event onward.
Severity
Medium — affects first-boot behavior only; corrects itself after the first sleep/wake cycle.
🤖 Generated with Claude Code
- 主要语言
- C++
- 星标
- 1
- 派生
- 0
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NorthernWidget/Okapi_Library 的其他 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 1/5 1 小时以内 新手友好度 88/100
-
难度 3/5 1-2 天 新手友好度 56/100
-
难度 4/5 3-5 天 新手友好度 48/100
-
难度 4/5 3-5 天 新手友好度 45/100
查看 NorthernWidget/Okapi_Library 的全部 Issue
相似的 Issue
-
backlog bug
难度 2/5 1-3 小时 新手友好度 75/100
EchoTools/nevr-runtime#653 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
InfiniTimeOrg/InfiniTime#2492 ·
-
accessibility good first issue hacktoberfest help wanted
难度 2/5 1-3 小时 新手友好度 74/100
OpenChemistry/avogadrolibs#3184 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
Tracktion/tracktion_engine#475 ·
维护者通常 1 天内回复