Fix missed shutdown callbacks (#22549)

master
Drashna Jaelre 2023-11-26 20:39:17 -08:00 committed by GitHub
parent cc4a52eb93
commit 094357c403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 16 deletions

View File

@ -123,10 +123,3 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
};
// clang-format on
#endif // ENCODER_MAP_ENABLE
void shutdown_user(void) {
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_sethsv_noeeprom(HSV_RED);
rgb_matrix_update_pwm_buffers();
#endif // RGB_MATRIX_ENABLE
}

View File

@ -97,12 +97,15 @@ void keyboard_post_init_kb(void) {
loop10hz_token = defer_exec(LOOP_10HZ_PERIOD, loop_10Hz, NULL);
}
__attribute__((weak)) void shutdown_user(void) {
bool shutdown_kb(bool jump_to_bootloader) {
if (shutdown_user(jump_to_bootloader)) {
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_set_suspend_state(true);
#endif // RGB_MATRIX_ENABLE
wait_ms(10);
}
ws2812_poweroff();
return true;
}
#ifdef DIP_SWITCH_ENABLE
@ -113,7 +116,7 @@ bool dip_switch_update_mask_kb(uint32_t state) {
led_suspend();
usbDisconnectBus(&USB_DRIVER);
usbStop(&USB_DRIVER);
shutdown_user();
shutdown_user(true);
setPinInputHigh(POWER_SWITCH_PIN);
palEnableLineEvent(POWER_SWITCH_PIN, PAL_EVENT_MODE_RISING_EDGE);
POWER_EnterSleep();