Archived
1
0

DPH controller now working with the kishsaver and macros

- Earlier RAM optimizations uncovered a bunch of layer/macro bugs
This commit is contained in:
Jacob Alexander 2014-09-16 22:14:01 -07:00
parent ac98d86762
commit 37b36fe011
2 changed files with 14 additions and 13 deletions

View File

@ -98,7 +98,7 @@ set( DefaultMap "colemak kishsaver_unix1 stdFuncMap" )
##| 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" )

View File

@ -315,7 +315,7 @@ nat_ptr_t *Macro_layerLookup( uint8_t scanCode )
// 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 *Macro_layerLookup( uint8_t scanCode )
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 @@ inline TriggerMacroEval Macro_evalTriggerMacro( var_uint_t triggerMacroIndex )
{
// 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 @@ inline TriggerMacroEval Macro_evalTriggerMacro( var_uint_t triggerMacroIndex )
}
}
}
// 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 @@ inline ResultMacroEval Macro_evalResultMacro( var_uint_t resultMacroIndex )
// If the ResultMacro is finished, remove
if ( macro->guide[ comboItem ] == 0 )
{
macro->pos = 0;
return ResultMacroEval_Remove;
}