Mercurial > louis > kiibohd-controller
diff Macro/PartialMap/macro.c @ 197:1ebb6fb5f74f
All basic macros tested and working!
Tested
------
Single : Single
Single : Combo
Single : Sequence
Combo : Single
Combo : Combo
Combo : Sequence
Sequence : Single
Sequence : Combo
Sequence : Sequence
author | Jacob Alexander <haata@kiibohd.com> |
---|---|
date | Sat, 23 Aug 2014 10:49:13 -0700 |
parents | 8ecfdaa27234 |
children | 559a467f6d57 |
line wrap: on
line diff
--- a/Macro/PartialMap/macro.c Wed Aug 20 10:53:22 2014 -0700 +++ b/Macro/PartialMap/macro.c Sat Aug 23 10:49:13 2014 -0700 @@ -56,12 +56,13 @@ // Bit positions are important, passes (correct key) always trump incorrect key votes typedef enum TriggerMacroVote { - TriggerMacroVote_Release = 0x8, // Correct key - TriggerMacroVote_PassRelease = 0xC, // Correct key (both pass and release) - TriggerMacroVote_Pass = 0x4, // Correct key - TriggerMacroVote_DoNothing = 0x2, // Incorrect key - TriggerMacroVote_Fail = 0x1, // Incorrect key - TriggerMacroVote_Invalid = 0x0, // Invalid state + TriggerMacroVote_Release = 0x10, // Correct key + TriggerMacroVote_PassRelease = 0x18, // Correct key (both pass and release) + TriggerMacroVote_Pass = 0x8, // Correct key + TriggerMacroVote_DoNothingRelease = 0x4, // Incorrect key + TriggerMacroVote_DoNothing = 0x2, // Incorrect key + TriggerMacroVote_Fail = 0x1, // Incorrect key + TriggerMacroVote_Invalid = 0x0, // Invalid state } TriggerMacroVote; typedef enum TriggerMacroEval { @@ -450,10 +451,13 @@ case 0x01: return TriggerMacroVote_Fail; - // Wrong key, held or released, do not pass (no effect) + // Wrong key, held, do not pass (no effect) case 0x02: + return TriggerMacroVote_DoNothing; + + // Wrong key released, fail out if pos == 0 case 0x03: - return TriggerMacroVote_DoNothing; + return TriggerMacroVote_DoNothing | TriggerMacroVote_DoNothingRelease; } } @@ -572,6 +576,11 @@ overallVote |= vote; } + // If no pass vote was found after scanning the entire combo + // And this is the first position in the combo, just remove it (nothing important happened) + if ( longMacro && overallVote & TriggerMacroVote_DoNothingRelease && pos == 0 ) + overallVote |= TriggerMacroVote_Fail; + // Decide new state of macro after voting // Fail macro, remove from pending list if ( overallVote & TriggerMacroVote_Fail ) @@ -780,22 +789,18 @@ case TriggerMacroEval_DoResult: // Append ResultMacro to PendingList Macro_appendResultMacroToPendingList( &TriggerMacroList[ macroTriggerMacroPendingList[ macro ] ] ); - print("D"); default: macroTriggerMacroPendingList[ macroTriggerMacroPendingListTail++ ] = macroTriggerMacroPendingList[ macro ]; - print("A"); break; // Trigger Result Macro and Remove (purposely falling through) case TriggerMacroEval_DoResultAndRemove: // Append ResultMacro to PendingList Macro_appendResultMacroToPendingList( &TriggerMacroList[ macroTriggerMacroPendingList[ macro ] ] ); - print("&"); // Remove Macro from Pending List, nothing to do, removing by default case TriggerMacroEval_Remove: - print("R"); break; } }