From 3eece241155841c079b357a880bb332094e09de2 Mon Sep 17 00:00:00 2001 From: Jacob Alexander Date: Sun, 4 Oct 2015 16:19:20 -0700 Subject: [PATCH] Fix Latching bug (introduced when fixing shift and lock recently) - Also conditionally refresh the lcd screen if enabled /w interconnect (Not the ideal way to update, but the only way with the current KLL version) --- .gitignore | 1 + Macro/PartialMap/macro.c | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e404153..7a86e68 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ .Trashes ehthumbs.db Thumbs.db +*.attr # Editor generated files # ########################## diff --git a/Macro/PartialMap/macro.c b/Macro/PartialMap/macro.c index 690231c..8f1d1b8 100644 --- a/Macro/PartialMap/macro.c +++ b/Macro/PartialMap/macro.c @@ -422,7 +422,22 @@ nat_ptr_t *Macro_layerLookup( TriggerGuide *guide, uint8_t latch_expire ) nat_ptr_t **map = (nat_ptr_t**)LayerIndex[ cachedLayer ].triggerMap; const Layer *layer = &LayerIndex[ cachedLayer ]; - return map[ scanCode - layer->first ]; + // Cache trigger list before attempting to expire latch + nat_ptr_t *trigger_list = map[ scanCode - layer->first ]; + + // Check if latch has been pressed for this layer + uint8_t latch = LayerState[ cachedLayer ] & 0x02; + if ( latch && latch_expire ) + { + Macro_layerState( 0, 0, cachedLayer, 0x02 ); +#if defined(ConnectEnabled_define) && defined(LCDEnabled_define) + // Evaluate the layerStack capability if available (LCD + Interconnect) + extern void LCD_layerStack_capability( uint8_t state, uint8_t stateType, uint8_t *args ); + LCD_layerStack_capability( 0, 0, 0 ); +#endif + } + + return trigger_list; } // If no trigger macro is defined at the given layer, fallthrough to the next layer -- 2.39.2