]> git.donarmstrong.com Git - kiibohd-controller.git/blobdiff - Scan/DPH/scan_loop.c
Fixing RAM calculator and reduced actual SRAM usage
[kiibohd-controller.git] / Scan / DPH / scan_loop.c
index c4d4284e46f1ff974968a9d0c6469e912f25208c..324c4c92b311bb2c653e3d7bf93e7a049e4f640b 100644 (file)
@@ -149,8 +149,8 @@ volatile uint8_t KeyIndex_BufferUsed;
 
 
 // Scan Module command dictionary
-char*       scanCLIDictName = "DPH Module Commands";
-CLIDictItem scanCLIDict[] = {
+const char scanCLIDictName[] = "DPH Module Commands";
+const CLIDictItem scanCLIDict[] = {
        { "echo",        "Example command, echos the arguments.", cliFunc_echo },
        { "avgDebug",    "Enables/Disables averaging results." NL "\t\tDisplays each average, starting from Key 0x00, ignoring 0 valued averages.", cliFunc_avgDebug },
        { "keyDebug",    "Enables/Disables long debug for each keypress." NL "\t\tkeycode - [strobe:mux] : sense val : threshold+delta=total : margin", cliFunc_keyDebug },
@@ -803,10 +803,13 @@ void testColumn( uint8_t strobe )
                                                print(" ");
                                        }
 
-                                       // Only add the key to the buffer once
-                                       // NOTE: Buffer can easily handle multiple adds, just more efficient
-                                       //        and nicer debug messages :P
-                                       Macro_bufferAdd( key );
+                                       // Initial Keypress
+                                       Macro_keyState( key, 0x01 );
+                               }
+                               else if ( keys_debounce[key] >= DEBOUNCE_THRESHOLD )
+                               {
+                                       // Held Key
+                                       Macro_keyState( key, 0x02 );
                                }
 
                                keys_debounce[key]++;
@@ -840,10 +843,10 @@ void testColumn( uint8_t strobe )
                // Clear debounce entry if no keypress detected
                else
                {
-                       // If the key was previously pressed, remove from the buffer
+                       // Release Key
                        if ( KeyIndex_BufferUsed > 0 && keys_debounce[key] >= DEBOUNCE_THRESHOLD )
                        {
-                               Macro_bufferRemove( key );
+                               Macro_keyState( key, 0x03 );
                        }
 
                        // Clear debounce entry