Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

PowerState not initialized from actual power source — spurious backhaul on backup battery at first boot

未关闭 适合新手
#5 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

NorthernWidget/Okapi_Library 的其他 Issue

查看 NorthernWidget/Okapi_Library 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。