ESP32-C3 PinAlarm not firing in light_sleep on level high

未關閉
#11,680 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
52/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
c, embedded-iot, python
領域
embedded-iot

研究方向

Start by tracing ESP32-C3 light-sleep PinAlarm handling and how it configures the pin for a high-level wake condition; the issue does not name source files or tests. Compare the low-level alarm behavior with the reported high-level case and the three short-sleep workaround. Done when releasing the button wakes light sleep promptly without requiring the workaround.

由索引模型根據 Issue 內容生成。

描述

alarms and sleep bug esp32-c3
CircuitPython version and board name
Adafruit CircuitPython 10.3.1 on 2026-09-14; Maker Go ESP32C3 Supermini with ESP32-C3
Board ID:makergo_esp32c3_supermini
Code/REPL
...
wake = alarm.light_sleep_until_alarms(
    alarm.time.TimeAlarm(monotonic_time=deadline),
    alarm.pin.PinAlarm(
          pin=board.IO21,
            value=True,
            pull=False,
        )
    )
Behavior

When the (active-low) button is not pressed, I add the alarm:

alarm.pin.PinAlarm(
          pin=board.IO21,
            value=False,
            pull=True,
        )

Then the light_sleep returns immediately with the PinAlarm as soon as the button is pressed.

But after that, I call the light sleep again, this time adding:

alarm.pin.PinAlarm(
          pin=board.IO21,
            value=True,
            pull=False,
        )

But this time, releasing the button has no effect, and the sleep returns later with a TimerAlarm once the time_monotonic deadline is reached.

I have a workaround: call the light_sleep 3 times with very short deadlines (time_monotonic 10ms in future). After this, I call light_sleep with a much longer timer expiry, and releasing the button has immediate effect.

The electrical wiring has the button pulling the pin to earth, with no other components such as pull-ups.

This issue is asymmetrical, because a PinAlarm waiting for a logic low (button pressed) always returns instantly from the sleep. It's just waiting for logic high that's giving me problems.

Fortunately the workaround has proven effective. But I'd like to find a cleaner solution.

For context, I'm executing the light_sleep in a scheduler run loop, where the scheduler is feeding off a jobs queue, executing jobs that are due to run, and otherwise light_sleeping until the next job is due.

Description

No response

Additional information

No response

主要語言
C
星號
4.6k
分支
1.4k
平均合併
1 天 8 小時
30 天內合併 PR
183

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

adafruit/circuitpython 的其他 Issue

查看 adafruit/circuitpython 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。