From 585485496a82e9647927dbb3924cc930949d8298 Mon Sep 17 00:00:00 2001 From: ntietz Date: Sun, 9 Oct 2016 20:15:50 -0400 Subject: [PATCH] Added logic to avoid layer shifts causing a layer to be stuck on. --- Macro/PartialMap/macro.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Macro/PartialMap/macro.c b/Macro/PartialMap/macro.c index 68eb42a..777010a 100644 --- a/Macro/PartialMap/macro.c +++ b/Macro/PartialMap/macro.c @@ -314,6 +314,14 @@ void Macro_layerShift_capability( uint8_t state, uint8_t stateType, uint8_t *arg // Cast pointer to uint8_t to uint16_t then access that memory location uint16_t layer = *(uint16_t*)(&args[0]); + // Only set the layer if it is disabled + if ( LayerState[ layer ] != 0x00 && state == 0x01 ) + return; + + // Only unset the layer if it is enabled + if ( LayerState[ layer ] == 0x00 && state == 0x03 ) + return; + Macro_layerState( state, stateType, layer, 0x01 ); } @@ -1356,4 +1364,3 @@ void cliFunc_macroStep( char* args ) // Set the macro step counter, negative int's are cast to uint macroStepCounter = count; } -