]> git.donarmstrong.com Git - kiibohd-controller.git/commitdiff
Fix Latching bug (introduced when fixing shift and lock recently)
authorJacob Alexander <haata@kiibohd.com>
Sun, 4 Oct 2015 23:19:20 +0000 (16:19 -0700)
committerJacob Alexander <haata@kiibohd.com>
Sun, 4 Oct 2015 23:19:20 +0000 (16:19 -0700)
- 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
Macro/PartialMap/macro.c

index e4041538aeb470fe682bc29d4d3f232a9ed1ac3e..7a86e68bf37ca18b64b5f880f0561fb0872e603d 100644 (file)
@@ -41,6 +41,7 @@
 .Trashes
 ehthumbs.db
 Thumbs.db
+*.attr
 
 # Editor generated files #
 ##########################
index 690231cc889628b158ca6dac33ab86be0509318b..8f1d1b826e78a2bc16bc3daef114695dee0e0604 100644 (file)
@@ -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