Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#5 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
cpp
Lĩnh vực
embedded-iot

Hướng nghiên cứu

Bắt đầu trong begin(), khoảng dòng 74, và lần theo kết quả bị loại bỏ của PowerAuto() cùng member PowerState. Sau đó kiểm tra Run() và turnOnSDcard() để xác minh rằng cổng backhaul của chu kỳ đầu tiên sử dụng nguồn điện được phát hiện. Được xem là hoàn tất khi PowerState phản ánh nguồn thực tế trước sự kiện log đầu tiên, bao gồm cả khi khởi động bằng pin dự phòng hoặc pin phụ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
C++
Star
1
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của NorthernWidget/Okapi_Library

Tất cả issue của NorthernWidget/Okapi_Library

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.