Make secondary role layer switching work.

This commit is contained in:
László Monda
2017-11-07 00:30:40 +01:00
parent 31fa1a0d5e
commit e3d4eb50db
2 changed files with 8 additions and 1 deletions

View File

@@ -132,7 +132,13 @@ void UpdateActiveUsbReports(void)
KeyStates[SlotId_RightKeyboardHalf][keyId].current = RightKeyMatrix.keyStates[keyId];
}
layer_id_t activeLayer = GetActiveLayer();
layer_id_t activeLayer = LayerId_Base;
if (secondaryRoleState == SecondaryRoleState_Triggered && IS_SECONDARY_ROLE_LAYER_SWITCHER(secondaryRole)) {
activeLayer = SECONDARY_ROLE_LAYER_TO_LAYER_ID(secondaryRole);
}
if (activeLayer == LayerId_Base) {
activeLayer = GetActiveLayer();
}
LedDisplay_SetLayer(activeLayer);
if (MacroPlaying) {

View File

@@ -6,6 +6,7 @@
#define IS_SECONDARY_ROLE_MODIFIER(secondaryRole) (SecondaryRole_LeftCtrl <= (secondaryRole) && (secondaryRole) <= SecondaryRole_RightSuper)
#define IS_SECONDARY_ROLE_LAYER_SWITCHER(secondaryRole) (SecondaryRole_Mod <= (secondaryRole) && (secondaryRole) <= SecondaryRole_Mouse)
#define SECONDARY_ROLE_MODIFIER_TO_HID_MODIFIER(secondaryRoleModifier) (1 << ((secondaryRoleModifier) - 1))
#define SECONDARY_ROLE_LAYER_TO_LAYER_ID(secondaryRoleLayer) ((secondaryRoleLayer) - SecondaryRole_RightSuper)
// Typedefs: