kanru / hhkb-zmk

HHKB Pro 2 with ZMK firmware
MIT License
47 stars 19 forks source link

Wake up from deep sleep does not work #9

Closed bgkoh closed 10 months ago

bgkoh commented 10 months ago

On HHKB2 Pro custom build,

with

CONFIG_ZMK_IDLE_TIMEOUT=5000
CONFIG_ZMK_SLEEP=y
CONFIG_ZMK_IDLE_SLEEP_TIMEOUT=900000
CONFIG_ZMK_BLE=y
CONFIG_ZMK_EXT_POWER=n
CONFIG_ZMK_BATTERY_REPORT_INTERVAL=3600

,

hhkb_pro2_connector: hhkb_pro2_connector {
        compatible = "zmk,hhkb-pro2-header";            compatible = "zmk,hhkb-pro2-header";
        #gpio-cells = <2>;          #gpio-cells = <2>;
        gpio-map-mask = <0xffffffff 0xffffffc0>;            gpio-map-mask = <0xffffffff 0xffffffc0>;
        gpio-map-pass-thru = <0 0x3f>;          gpio-map-pass-thru = <0 0x3f>;
        gpio-map = <0 0 &gpio1 6 NRF_GPIO_DRIVE_S0H1>,          gpio-map = <0 0 &gpio1 6 NRF_GPIO_DRIVE_S0H1>,
                   <1 0 &gpio1 4 0>,                       <1 0 &gpio1 4 0>,
                   <2 0 &gpio0 11 0>,                      <2 0 &gpio0 11 0>,
                   <3 0 &gpio1 0 0>,                       <3 0 &gpio1 0 0>,
                   <4 0 &gpio0 24 0>,                      <4 0 &gpio0 24 0>,
                   <5 0 &gpio0 22 0>,                      <5 0 &gpio0 22 0>,
                   <6 0 &gpio0 20 0>,                      <6 0 &gpio0 20 0>,
                   <7 0 &gpio0 17 0>,                      <7 0 &gpio0 17 0>,
                   <8 0 &gpio0 8 0>,                       <8 0 &gpio0 8 0>,
                   <9 0 &gpio0 6 0>;                       <9 0 &gpio0 6 0>,
                   <10 0 &gpio0 9 0>,     /* D10/A10 */
                   <19 0 &gpio0 2 0>;     /* D19/A1 */
    };      };

, and

pm_wake_sensor {
        compatible = "zmk,pm-wake-sensor";
        status = "okay";
        power-gpios = <&hhkb_pro2_connector 19 GPIO_ACTIVE_HIGH>;
        sensor-gpios = <&hhkb_pro2_connector 10 (GPIO_ACTIVE_LOW|GPIO_PULL_DOWN)>;
    };

It doesn't wake up hhkb from sleep.

kanru commented 10 months ago

Did you connect anything to pin 19 and 10?

Something like a button or vibration sensor is needed.

bgkoh commented 10 months ago

image I've done just like this.

Hmm. Ok. If the code is right, my sw-420 sensor could be a problem.

kanru commented 10 months ago

Well, the code might be buggy. I haven't tested the integration after last update.

config PM_WAKE_SENSOR is default n for that reason. Please check if you have enabled it in your .config.

Your pm_wake_sensor device tree node looks correct. The hhkb_pro2_connector node doesn't need to define D10 and D19 because it is only used to discover the wiring of the JST connector.

bgkoh commented 9 months ago

Yes, you are right. The problem was CONFIG_PM_WAKE_SENSOR. After set it up, it works. Thanks a lot.