From e6266b19be46c1340209bdd0a6c519452d5b9f2a Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Mon, 27 Jul 2020 14:46:39 -0700 Subject: Initialize Layer State on startup (#8318) * Initialize Layer State on startup Right now, on startup, the default layer state gets called and set, triggering the callback functions for the default layer state. However, the normal layer state never actually gets initialized. It's set to 0 directly, by default, but the callback functions are never actually called. This creates some inconsistency in the behavior for end users. This adds a simple "clear" that triggers the callback on startup. This should produce more consisten behavior between the two functions and layer masks. * Stupid hack * Fix type casting? * Fix compile issues with magic is disabled --- tmk_core/common/magic.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tmk_core/common/magic.c') diff --git a/tmk_core/common/magic.c b/tmk_core/common/magic.c index d8ab52573..e14994164 100644 --- a/tmk_core/common/magic.c +++ b/tmk_core/common/magic.c @@ -33,4 +33,7 @@ void magic(void) { uint8_t default_layer = 0; default_layer = eeconfig_read_default_layer(); default_layer_set((layer_state_t)default_layer); + + /* Also initialize layer state to trigger callback functions for layer_state */ + layer_state_set_kb((layer_state_t)layer_state); } -- cgit v1.2.3