Mercurial > louis > kiibohd-controller
changeset 216:738445f38639
DPH controller now working with the kishsaver and macros
- Earlier RAM optimizations uncovered a bunch of layer/macro bugs
author | Jacob Alexander <haata@kiibohd.com> |
---|---|
date | Tue, 16 Sep 2014 22:14:01 -0700 |
parents | 00a8c7f491d4 |
children | 8ceb1a0582ee |
files | CMakeLists.txt Macro/PartialMap/macro.c |
diffstat | 2 files changed, 14 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Tue Sep 16 17:21:41 2014 -0700 +++ b/CMakeLists.txt Tue Sep 16 22:14:01 2014 -0700 @@ -98,7 +98,7 @@ ##| ParitalMaps available on top of the BaseMap. See above for syntax on specifying multiple layers vs. layering ##| Can be set to "" -#set( PartialMaps "hhkbpro2_slim" ) +set( PartialMaps "hhkbpro2" )
--- a/Macro/PartialMap/macro.c Tue Sep 16 17:21:41 2014 -0700 +++ b/Macro/PartialMap/macro.c Tue Sep 16 22:14:01 2014 -0700 @@ -315,7 +315,7 @@ // Only use layer, if state is valid // XOR each of the state bits // If only two are enabled, do not use this state - if ( (LayerState[ layerIndex ] & 0x01) ^ (latch>>1) ^ ((LayerState[ layerIndex ] & 0x04)>>2) ) + if ( (LayerState[ macroLayerIndexStack[ layerIndex ] ] & 0x01) ^ (latch>>1) ^ ((LayerState[ macroLayerIndexStack[ layerIndex ] ] & 0x04)>>2) ) { // Lookup layer nat_ptr_t **map = (nat_ptr_t**)layer->triggerMap; @@ -336,7 +336,7 @@ nat_ptr_t **map = (nat_ptr_t**)LayerIndex[0].triggerMap; // Lookup default layer - const Layer *layer = &LayerIndex[ macroLayerIndexStack[ 0 ] ]; + const Layer *layer = &LayerIndex[0]; // Make sure scanCode is between layer first and last scancodes if ( map != 0 @@ -689,6 +689,16 @@ { // Just doing nothing :) } + // If ready for transition and in Press state, set to Waiting and increment combo position + // Position is incremented (and possibly remove the macro from the pending list) on the next iteration + else if ( overallVote & TriggerMacroVote_Release && macro->state == TriggerMacro_Press ) + { + macro->state = TriggerMacro_Release; + + // If this is the last combo in the sequence, remove from the pending list + if ( macro->guide[ macro->pos + macro->guide[ macro->pos ] * TriggerGuideSize + 1 ] == 0 ) + return TriggerMacroEval_DoResultAndRemove; + } // If passing and in Waiting state, set macro state to Press else if ( overallVote & TriggerMacroVote_Pass && ( macro->state == TriggerMacro_Waiting || macro->state == TriggerMacro_Press ) ) @@ -726,16 +736,6 @@ } } } - // If ready for transition and in Press state, set to Waiting and increment combo position - // Position is incremented (and possibly remove the macro from the pending list) on the next iteration - else if ( overallVote & TriggerMacroVote_Release && macro->state == TriggerMacro_Press ) - { - macro->state = TriggerMacro_Release; - - // If this is the last combo in the sequence, remove from the pending list - if ( macro->guide[ macro->pos + macro->guide[ macro->pos ] * TriggerGuideSize + 1 ] == 0 ) - return TriggerMacroEval_Remove; - } // Otherwise, just remove the macro on key release // One more result has to be called to indicate to the ResultMacro that the key transitioned to the release state else if ( overallVote & TriggerMacroVote_Release ) @@ -793,6 +793,7 @@ // If the ResultMacro is finished, remove if ( macro->guide[ comboItem ] == 0 ) { + macro->pos = 0; return ResultMacroEval_Remove; }