diff --git a/Macro/PartialMap/macro.c b/Macro/PartialMap/macro.c index 06c5d41..072ce8d 100644 --- a/Macro/PartialMap/macro.c +++ b/Macro/PartialMap/macro.c @@ -202,6 +202,12 @@ void Macro_layerState_capability( uint8_t state, uint8_t stateType, uint8_t *arg return; } + // Only use capability on press or release + // TODO Analog + // XXX This may cause issues, might be better to implement state table here to decide -HaaTa + if ( stateType == 0x00 && state == 0x02 ) // Hold condition + return; + // Get layer index from arguments // Cast pointer to uint8_t to unsigned int then access that memory location uint16_t layer = *(uint16_t*)(&args[0]); @@ -224,6 +230,12 @@ void Macro_layerLatch_capability( uint8_t state, uint8_t stateType, uint8_t *arg return; } + // Only use capability on press + // TODO Analog + // XXX To make sense, this code be on press or release. Or it could even be a sticky shift (why? dunno) -HaaTa + if ( stateType == 0x00 && state != 0x01 ) // All normal key conditions except press + return; + // Get layer index from arguments // Cast pointer to uint8_t to unsigned int then access that memory location uint16_t layer = *(uint16_t*)(&args[0]); @@ -243,6 +255,12 @@ void Macro_layerLock_capability( uint8_t state, uint8_t stateType, uint8_t *args return; } + // Only use capability on press + // TODO Analog + // XXX Could also be on release, but that's sorta dumb -HaaTa + if ( stateType == 0x00 && state != 0x01 ) // All normal key conditions except press + return; + // Get layer index from arguments // Cast pointer to uint8_t to unsigned int then access that memory location uint16_t layer = *(uint16_t*)(&args[0]); @@ -262,6 +280,13 @@ void Macro_layerShift_capability( uint8_t state, uint8_t stateType, uint8_t *arg return; } + // Only use capability on press or release + // TODO Analog + if ( stateType == 0x00 && ( state == 0x00 || state == 0x02 ) ) // Only pass press or release conditions + return; + + print("YAY"); + // Get layer index from arguments // Cast pointer to uint8_t to unsigned int then access that memory location uint16_t layer = *(uint16_t*)(&args[0]); @@ -704,10 +729,10 @@ inline TriggerMacroEval Macro_evalTriggerMacro( unsigned int triggerMacroIndex ) return TriggerMacroEval_Remove; } // Otherwise, just remove the macro on key release - // XXX Might cause some issues + // 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 ) { - return TriggerMacroEval_Remove; + return TriggerMacroEval_DoResultAndRemove; } // If this is a short macro, just remove it diff --git a/Output/pjrcUSB/output_com.c b/Output/pjrcUSB/output_com.c index 6336a40..35e0603 100644 --- a/Output/pjrcUSB/output_com.c +++ b/Output/pjrcUSB/output_com.c @@ -110,6 +110,11 @@ void Output_usbCodeSend_capability( uint8_t state, uint8_t stateType, uint8_t *a return; } + // TODO Analog inputs + // Only send keypresses if press or hold state + if ( stateType == 0x00 && state == 0x03 ) // Release state + return; + // Get the keycode from arguments uint8_t key = args[0];