From 862e7ea39d05660b740941c9ea72b1bc4e7ccaff Mon Sep 17 00:00:00 2001 From: Kevin Frei Date: Sat, 2 Jan 2016 17:43:05 -0800 Subject: [PATCH] Fix a handful of infinite loops that occur if you have more than 254 macros --- Macro/PartialMap/macro.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Macro/PartialMap/macro.c b/Macro/PartialMap/macro.c index e861f0e..dc51751 100644 --- a/Macro/PartialMap/macro.c +++ b/Macro/PartialMap/macro.c @@ -135,7 +135,7 @@ uint16_t macroStepCounter = 0; // Key Trigger List Buffer and Layer Cache // The layer cache is set on press only, hold and release events refer to the value set on press TriggerGuide macroTriggerListBuffer[ MaxScanCode ]; -uint8_t macroTriggerListBufferSize = 0; +var_uint_t macroTriggerListBufferSize = 0; var_uint_t macroTriggerListLayerCache[ MaxScanCode ]; // Pending Trigger Macro Index List @@ -557,7 +557,7 @@ inline void Macro_interconnectAdd( void *trigger_ptr ) // Add trigger to the Interconnect Cache // During each processing loop, a scancode may be re-added depending on it's state - for ( uint8_t c = 0; c < macroInterconnectCacheSize; c++ ) + for ( var_uint_t c = 0; c < macroInterconnectCacheSize; c++ ) { // Check if the same ScanCode if ( macroInterconnectCache[ c ].scanCode == trigger->scanCode ) @@ -699,7 +699,7 @@ inline void Macro_appendResultMacroToPendingList( const TriggerMacro *triggerMac uint8_t scanCode = ((TriggerGuide*)&triggerMacro->guide[ pos - TriggerGuideSize ])->scanCode; // Lookup scanCode in buffer list for the current state and stateType - for ( uint8_t keyIndex = 0; keyIndex < macroTriggerListBufferSize; keyIndex++ ) + for ( var_uint_t keyIndex = 0; keyIndex < macroTriggerListBufferSize; keyIndex++ ) { if ( macroTriggerListBuffer[ keyIndex ].scanCode == scanCode ) { @@ -905,7 +905,7 @@ TriggerMacroEval Macro_evalTriggerMacro( var_uint_t triggerMacroIndex ) TriggerMacroVote vote = TriggerMacroVote_Invalid; // Iterate through the key buffer, comparing to each key in the combo - for ( uint8_t key = 0; key < macroTriggerListBufferSize; key++ ) + for ( var_uint_t key = 0; key < macroTriggerListBufferSize; key++ ) { // Lookup key information TriggerGuide *keyInfo = ¯oTriggerListBuffer[ key ]; @@ -1065,7 +1065,7 @@ inline ResultMacroEval Macro_evalResultMacro( var_uint_t resultMacroIndex ) inline void Macro_updateTriggerMacroPendingList() { // Iterate over the macroTriggerListBuffer to add any new Trigger Macros to the pending list - for ( uint8_t key = 0; key < macroTriggerListBufferSize; key++ ) + for ( var_uint_t key = 0; key < macroTriggerListBufferSize; key++ ) { // TODO LED States // TODO Analog Switches @@ -1586,7 +1586,7 @@ void cliFunc_macroList( char* args ) info_msg("Pending Key Events: "); printInt16( (uint16_t)macroTriggerListBufferSize ); print(" : "); - for ( uint8_t key = 0; key < macroTriggerListBufferSize; key++ ) + for ( var_uint_t key = 0; key < macroTriggerListBufferSize; key++ ) { printHex( macroTriggerListBuffer[ key ].scanCode ); print(" "); -- 2.39.2