5 Commits

Author SHA1 Message Date
László Monda
6ab0c2eb72 Bump version to 8.5.4, update changelog, package.json and versions.h 2019-01-05 16:16:37 +01:00
László Monda
2e73bb9ea1 Merge pull request #203 from UltimateHackingKeyboard/sticky-modifiers
Adjust the behavior of sticky modifiers
2018-12-26 03:42:47 +01:00
Eric Tang
e5ac605b4c Adjust the behavior of sticky modiifers 2018-12-25 16:08:10 -08:00
László Monda
fb220038b7 Merge pull request #200 from kareltucek/origin_master
Feature firmware forks in readme
2018-11-18 14:44:46 +01:00
Karel Tuček
464c56f599 Feature firmware forks in Readme 2018-11-18 12:36:34 +01:00
15 changed files with 143 additions and 265 deletions

View File

@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is loosely based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to the [UHK Versioning](VERSIONING.md) conventions.
## [8.5.4] - 2018-01-05
Device Protocol: 4.5.0 | Module Protocol: 4.0.0 | User Config: 4.1.0 | Hardware Config: 1.0.0
- Make the modifiers of shortcut keys stick only as long as the layer switcher key of a shortcut key is being held.
## [8.5.3] - 2018-10-20
Device Protocol: 4.5.0 | Module Protocol: 4.0.0 | User Config: 4.1.0 | Hardware Config: 1.0.0

View File

@@ -25,3 +25,10 @@ Going forward, it's easier to flash the firmware of your choice by using the dow
## Contributing
Want to contribute? Let us show you [how](/CONTRIBUTING.md).
## Custom Firmwares
The following list contains unofficial forks of the firmware. These forks provide functionality unavailable in the official firmware, but come without guarantees of any kind:
- [https://github.com/kareltucek/firmware](https://github.com/kareltucek/firmware) - firmware featuring macro engine extended by a set of custom commands, allowing more advanced configurations including custom layer switching logic, doubletap bindings, alternative secondary roles etc.

View File

@@ -146,6 +146,8 @@ parser_error_t ParseConfig(config_buffer_t *buffer)
AlphanumericSegmentsBrightness = alphanumericSegmentsBrightness;
KeyBacklightBrightness = keyBacklightBrightness;
LedSlaveDriver_UpdateLeds();
// Update mouse key speeds
MouseMoveState.initialSpeed = mouseMoveInitialSpeed;

View File

@@ -13,7 +13,6 @@
uint8_t timestamp;
bool previous : 1;
bool current : 1;
bool suppressed : 1;
bool debouncing : 1;
} key_state_t;

View File

@@ -15,7 +15,7 @@ void updateLayerStates(void)
for (uint8_t slotId=0; slotId<SLOT_COUNT; slotId++) {
for (uint8_t keyId=0; keyId<MAX_KEY_COUNT_PER_MODULE; keyId++) {
key_state_t *keyState = &KeyStates[slotId][keyId];
if (keyState->current && !keyState->suppressed) {
if (keyState->current) {
key_action_t action = CurrentKeymap[LayerId_Base][slotId][keyId];
if (action.type == KeyActionType_SwitchLayer) {
if (action.switchLayer.mode != SwitchLayerMode_Toggle) {
@@ -70,3 +70,14 @@ layer_id_t GetActiveLayer()
return heldLayer;
}
bool IsLayerHeld(void)
{
for (layer_id_t layerId = LayerId_Mod; layerId <= LayerId_Mouse; layerId++) {
if (heldLayers[layerId]) {
return true;
}
}
return false;
}

View File

@@ -25,6 +25,7 @@
// Functions:
layer_id_t GetActiveLayer();
layer_id_t GetActiveLayer(void);
bool IsLayerHeld(void);
#endif

View File

@@ -84,7 +84,6 @@ void LedDisplay_SetText(uint8_t length, const char* text)
}
allSegmentSets >>= 5;
}
LedSlaveDriver_UpdateLeds(LedDriverId_Left);
}
void LedDisplay_SetLayer(layer_id_t layerId)
@@ -96,7 +95,6 @@ void LedDisplay_SetLayer(layer_id_t layerId)
if (layerId >= LayerId_Mod && layerId <= LayerId_Mouse) {
LedDriverValues[LedDriverId_Left][16 * layerId - 3] = IconsAndLayerTextsBrightness;
}
LedSlaveDriver_UpdateLeds(LedDriverId_Left);
}
bool LedDisplay_GetIcon(led_display_icon_t icon)
@@ -108,7 +106,6 @@ void LedDisplay_SetIcon(led_display_icon_t icon, bool isEnabled)
{
ledIconStates[icon] = isEnabled;
LedDriverValues[LedDriverId_Left][icon + 8] = isEnabled ? IconsAndLayerTextsBrightness : 0;
LedSlaveDriver_UpdateLeds(LedDriverId_Left);
}
void LedDisplay_UpdateIcons(void)

View File

@@ -16,13 +16,8 @@
#define LED_DRIVER_SDB_CLOCK kCLOCK_PortA
#define LED_DRIVER_SDB_PIN 2
#define LED_DRIVER_REGISTER_SHUTDOWN 0x0A
#define LED_DRIVER_REGISTER_FRAME 0xFD
#define LED_DRIVER_REGISTER_CONFIGURATION 0x00
#define LED_DRIVER_REGISTER_AUTO_PLAY_CONTROL_1 0x02
#define LED_DRIVER_REGISTER_AUTO_PLAY_CONTROL_2 0x03
#define LED_DRIVER_REGISTER_BREATH_CONTROL_1 0x08
#define LED_DRIVER_REGISTER_BREATH_CONTROL_2 0x09
#define LED_DRIVER_REGISTER_SHUTDOWN 0x0A
#define LED_DRIVER_REGISTER_FRAME 0xFD
#define LED_DRIVER_FRAME_1 0
#define LED_DRIVER_FRAME_2 1
@@ -47,25 +42,6 @@
#define SHUTDOWN_MODE_SHUTDOWN 0
#define SHUTDOWN_MODE_NORMAL 1
#define DISPLAY_MODE_AUTO_FRAME_PLAY 0b01
#define DISPLAY_MODE_SHIFT 3
#define FRAME_START_1 0b000
#define FRAME_START_8 0b111
#define PLAY_LOOP_NUMBER_1 0b001
#define PLAY_LOOP_NUMBER_SHIFT 4
#define PLAY_FRAME_NUMBER_1 0b001
#define FRAME_DELAY_TIME 1
#define FADE_OUT_TIME 5
#define FADE_OUT_TIME_SHIFT 4
#define FADE_IN_TIME 5
#define BREATH_ENABLE 1
#define BREATH_ENABLE_SHIFT 4
#define EXTINGUISH_TIME 0
// Functions:
void InitLedDriver(void);

View File

@@ -60,48 +60,22 @@ static led_driver_state_t ledDriverStates[LED_DRIVER_MAX_COUNT] = {
static uint8_t setFunctionFrameBuffer[] = {LED_DRIVER_REGISTER_FRAME, LED_DRIVER_FRAME_FUNCTION};
static uint8_t setShutdownModeNormalBuffer[] = {LED_DRIVER_REGISTER_SHUTDOWN, SHUTDOWN_MODE_NORMAL};
static uint8_t setFrame1Buffer[] = {LED_DRIVER_REGISTER_FRAME, LED_DRIVER_FRAME_1};
static uint8_t setFrame2Buffer[] = {LED_DRIVER_REGISTER_FRAME, LED_DRIVER_FRAME_2};
static uint8_t setFrame8Buffer[] = {LED_DRIVER_REGISTER_FRAME, LED_DRIVER_FRAME_8};
static uint8_t initLedControlRegistersZeroBuffer[19] = { FRAME_REGISTER_LED_CONTROL_FIRST };
static uint8_t setConfigurationRegisterFadeInBuffer[] = {
LED_DRIVER_REGISTER_CONFIGURATION,
DISPLAY_MODE_AUTO_FRAME_PLAY << DISPLAY_MODE_SHIFT | FRAME_START_8
};
static uint8_t setConfigurationRegisterFadeOutBuffer[] = {
LED_DRIVER_REGISTER_CONFIGURATION,
DISPLAY_MODE_AUTO_FRAME_PLAY << DISPLAY_MODE_SHIFT | FRAME_START_1
};
static uint8_t initAutoPlayControlRegister1Buffer[] = {
LED_DRIVER_REGISTER_AUTO_PLAY_CONTROL_1,
PLAY_LOOP_NUMBER_1 << PLAY_LOOP_NUMBER_SHIFT | PLAY_FRAME_NUMBER_1
};
static uint8_t initAutoPlayControlRegister2Buffer[] = {
LED_DRIVER_REGISTER_AUTO_PLAY_CONTROL_2,
FRAME_DELAY_TIME
};
static uint8_t initBreathControlRegister1Buffer[] = {
LED_DRIVER_REGISTER_BREATH_CONTROL_1,
FADE_OUT_TIME << FADE_OUT_TIME_SHIFT | FADE_IN_TIME
};
static uint8_t initBreathControlRegister2Buffer[] = {
LED_DRIVER_REGISTER_BREATH_CONTROL_2,
BREATH_ENABLE << BREATH_ENABLE_SHIFT | EXTINGUISH_TIME
};
static uint8_t updatePwmRegistersBuffer[PWM_REGISTER_BUFFER_LENGTH];
void LedSlaveDriver_DisableLeds(uint8_t ledDriverId)
void LedSlaveDriver_DisableLeds(void)
{
ledDriverStates[ledDriverId].requests[LedDriverRequest_DisableLeds] = true;
for (uint8_t ledDriverId=0; ledDriverId<=LedDriverId_Last; ledDriverId++) {
memset(LedDriverValues[ledDriverId], 0, LED_DRIVER_LED_COUNT);
}
}
void LedSlaveDriver_EnableLeds(uint8_t ledDriverId)
void LedSlaveDriver_UpdateLeds(void)
{
ledDriverStates[ledDriverId].requests[LedDriverRequest_EnableLeds] = true;
}
for (uint8_t ledDriverId=0; ledDriverId<=LedDriverId_Last; ledDriverId++) {
memset(LedDriverValues[ledDriverId], KeyBacklightBrightness, LED_DRIVER_LED_COUNT);
}
void LedSlaveDriver_UpdateLeds(uint8_t ledDriverId)
{
ledDriverStates[ledDriverId].requests[LedDriverRequest_UpdateLeds] = true;
LedDisplay_UpdateAll();
}
void LedSlaveDriver_Init(uint8_t ledDriverId)
@@ -111,9 +85,13 @@ void LedSlaveDriver_Init(uint8_t ledDriverId)
}
led_driver_state_t *currentLedDriverState = ledDriverStates + ledDriverId;
currentLedDriverState->phase = LedDriverPhase_SetFunctionFrame;
currentLedDriverState->ledIndex = 0;
memset(LedDriverValues[ledDriverId], KeyBacklightBrightness, LED_DRIVER_LED_COUNT);
ledDriverStates[ledDriverId].requests[LedDriverRequest_Init] = true;
if (ledDriverId == LedDriverId_Left) {
LedDisplay_UpdateAll();
}
}
status_t LedSlaveDriver_Update(uint8_t ledDriverId)
@@ -121,62 +99,31 @@ status_t LedSlaveDriver_Update(uint8_t ledDriverId)
status_t status = kStatus_Uhk_IdleSlave;
uint8_t *ledValues = LedDriverValues[ledDriverId];
led_driver_state_t *currentLedDriverState = ledDriverStates + ledDriverId;
uint8_t *ledDriverPhase = &currentLedDriverState->phase;
uint8_t ledDriverAddress = currentLedDriverState->i2cAddress;
uint8_t *ledIndex = &currentLedDriverState->ledIndex;
switch (currentLedDriverState->phase) {
case LedDriverPhase_SetFunctionFrameInit:
switch (*ledDriverPhase) {
case LedDriverPhase_SetFunctionFrame:
if (ledDriverId == LedDriverId_Left && !Slaves[SlaveId_LeftKeyboardHalf].isConnected) {
break;
}
status = I2cAsyncWrite(ledDriverAddress, setFunctionFrameBuffer, sizeof(setFunctionFrameBuffer));
currentLedDriverState->phase = LedDriverPhase_SetShutdownModeNormalInit;
*ledDriverPhase = LedDriverPhase_SetShutdownModeNormal;
break;
case LedDriverPhase_SetShutdownModeNormalInit:
case LedDriverPhase_SetShutdownModeNormal:
status = I2cAsyncWrite(ledDriverAddress, setShutdownModeNormalBuffer, sizeof(setShutdownModeNormalBuffer));
currentLedDriverState->phase = LedDriverPhase_InitAutoPlayControlRegister1Init;
*ledDriverPhase = LedDriverPhase_SetFrame1;
break;
case LedDriverPhase_InitAutoPlayControlRegister1Init:
status = I2cAsyncWrite(ledDriverAddress, initAutoPlayControlRegister1Buffer, sizeof(initAutoPlayControlRegister1Buffer));
currentLedDriverState->phase = LedDriverPhase_InitAutoPlayControlRegister2Init;
break;
case LedDriverPhase_InitAutoPlayControlRegister2Init:
status = I2cAsyncWrite(ledDriverAddress, initAutoPlayControlRegister2Buffer, sizeof(initAutoPlayControlRegister2Buffer));
currentLedDriverState->phase = LedDriverPhase_InitBreathControlRegister1Init;
break;
case LedDriverPhase_InitBreathControlRegister1Init:
status = I2cAsyncWrite(ledDriverAddress, initBreathControlRegister1Buffer, sizeof(initBreathControlRegister1Buffer));
currentLedDriverState->phase = LedDriverPhase_InitBreathControlRegister2Init;
break;
case LedDriverPhase_InitBreathControlRegister2Init:
status = I2cAsyncWrite(ledDriverAddress, initBreathControlRegister2Buffer, sizeof(initBreathControlRegister2Buffer));
currentLedDriverState->phase = LedDriverPhase_SetFrame2Init;
break;
case LedDriverPhase_SetFrame2Init:
status = I2cAsyncWrite(ledDriverAddress, setFrame2Buffer, sizeof(setFrame2Buffer));
currentLedDriverState->phase = LedDriverPhase_InitLedControlRegistersZero1Init;
break;
case LedDriverPhase_InitLedControlRegistersZero1Init:
status = I2cAsyncWrite(ledDriverAddress, initLedControlRegistersZeroBuffer, sizeof(initLedControlRegistersZeroBuffer));
currentLedDriverState->phase = LedDriverPhase_SetFrame8Init;
break;
case LedDriverPhase_SetFrame8Init:
status = I2cAsyncWrite(ledDriverAddress, setFrame8Buffer, sizeof(setFrame8Buffer));
currentLedDriverState->phase = LedDriverPhase_InitLedControlRegistersZero2Init;
break;
case LedDriverPhase_InitLedControlRegistersZero2Init:
status = I2cAsyncWrite(ledDriverAddress, initLedControlRegistersZeroBuffer, sizeof(initLedControlRegistersZeroBuffer));
currentLedDriverState->phase = LedDriverPhase_SetFrame1Init;
break;
case LedDriverPhase_SetFrame1Init:
case LedDriverPhase_SetFrame1:
status = I2cAsyncWrite(ledDriverAddress, setFrame1Buffer, sizeof(setFrame1Buffer));
currentLedDriverState->phase = LedDriverPhase_InitLedControlRegistersInit;
*ledDriverPhase = LedDriverPhase_InitLedControlRegisters;
break;
case LedDriverPhase_InitLedControlRegistersInit:
case LedDriverPhase_InitLedControlRegisters:
status = I2cAsyncWrite(ledDriverAddress, currentLedDriverState->setupLedControlRegistersCommand, LED_CONTROL_REGISTERS_COMMAND_LENGTH);
currentLedDriverState->phase = LedDriverPhase_InitLedValuesInit;
*ledDriverPhase = LedDriverPhase_InitLedValues;
break;
case LedDriverPhase_InitLedValuesInit:
case LedDriverPhase_InitLedValues:
updatePwmRegistersBuffer[0] = FRAME_REGISTER_PWM_FIRST + *ledIndex;
uint8_t chunkSize = MIN(LED_DRIVER_LED_COUNT - *ledIndex, PMW_REGISTER_UPDATE_CHUNK_SIZE);
memcpy(updatePwmRegistersBuffer+1, ledValues + *ledIndex, chunkSize);
@@ -185,35 +132,10 @@ status_t LedSlaveDriver_Update(uint8_t ledDriverId)
if (*ledIndex >= LED_DRIVER_LED_COUNT) {
*ledIndex = 0;
memcpy(currentLedDriverState->targetLedValues, ledValues, LED_DRIVER_LED_COUNT);
currentLedDriverState->phase = LedDriverPhase_Idle;
*ledDriverPhase = LedDriverPhase_UpdateChangedLedValues;
}
break;
case LedDriverPhase_Idle: {
uint8_t i;
for (i = 0; i <= LedDriverRequest_Last; i++) {
if (currentLedDriverState->requests[i]) {
currentLedDriverState->requests[i] = false;
break;
}
}
switch (i) {
case LedDriverRequest_Init:
currentLedDriverState->phase = LedDriverPhase_SetFunctionFrameInit;
break;
case LedDriverRequest_EnableLeds:
currentLedDriverState->phase = LedDriverPhase_SetFunctionFrameEnableLeds;
break;
case LedDriverRequest_DisableLeds:
currentLedDriverState->phase = LedDriverPhase_SetFunctionFrameDisableLeds;
break;
case LedDriverRequest_UpdateLeds:
currentLedDriverState->phase = LedDriverPhase_UpdateChangedLedValuesUpdateLeds;
break;
}
break;
}
case LedDriverPhase_UpdateChangedLedValuesUpdateLeds: {
case LedDriverPhase_UpdateChangedLedValues: {
uint8_t *targetLedValues = currentLedDriverState->targetLedValues;
uint8_t lastLedChunkStartIndex = LED_DRIVER_LED_COUNT - PMW_REGISTER_UPDATE_CHUNK_SIZE;
@@ -233,7 +155,6 @@ status_t LedSlaveDriver_Update(uint8_t ledDriverId)
bool foundStartIndex = count < LED_DRIVER_LED_COUNT;
if (!foundStartIndex) {
*ledIndex = 0;
currentLedDriverState->phase = LedDriverPhase_Idle;
break;
}
@@ -254,34 +175,9 @@ status_t LedSlaveDriver_Update(uint8_t ledDriverId)
*ledIndex += length;
if (*ledIndex >= LED_DRIVER_LED_COUNT) {
*ledIndex = 0;
currentLedDriverState->phase = LedDriverPhase_Idle;
}
break;
}
case LedDriverPhase_SetFunctionFrameDisableLeds:
status = I2cAsyncWrite(ledDriverAddress, setFunctionFrameBuffer, sizeof(setFunctionFrameBuffer));
currentLedDriverState->phase = LedDriverPhase_SetConfigurationRegisterDisableLeds;
break;
case LedDriverPhase_SetConfigurationRegisterDisableLeds:
status = I2cAsyncWrite(ledDriverAddress, setConfigurationRegisterFadeOutBuffer, sizeof(setConfigurationRegisterFadeOutBuffer));
currentLedDriverState->phase = LedDriverPhase_SetFrame1DisableLeds;
break;
case LedDriverPhase_SetFrame1DisableLeds:
status = I2cAsyncWrite(ledDriverAddress, setFrame1Buffer, sizeof(setFrame1Buffer));
currentLedDriverState->phase = LedDriverPhase_Idle;
break;
case LedDriverPhase_SetFunctionFrameEnableLeds:
status = I2cAsyncWrite(ledDriverAddress, setFunctionFrameBuffer, sizeof(setFunctionFrameBuffer));
currentLedDriverState->phase = LedDriverPhase_SetConfigurationRegisterEnableLeds;
break;
case LedDriverPhase_SetConfigurationRegisterEnableLeds:
status = I2cAsyncWrite(ledDriverAddress, setConfigurationRegisterFadeInBuffer, sizeof(setConfigurationRegisterFadeInBuffer));
currentLedDriverState->phase = LedDriverPhase_SetFrame1EnableLeds;
break;
case LedDriverPhase_SetFrame1EnableLeds:
status = I2cAsyncWrite(ledDriverAddress, setFrame1Buffer, sizeof(setFrame1Buffer));
currentLedDriverState->phase = LedDriverPhase_Idle;
break;
}
return status;

View File

@@ -20,14 +20,6 @@
// Typedefs:
enum {
LedDriverRequest_Init,
LedDriverRequest_EnableLeds,
LedDriverRequest_DisableLeds,
LedDriverRequest_UpdateLeds,
LedDriverRequest_Last = LedDriverRequest_UpdateLeds
};
typedef enum {
LedDriverId_Right,
LedDriverId_Left,
@@ -35,31 +27,15 @@
} led_driver_id_t;
typedef enum {
LedDriverPhase_Idle,
LedDriverPhase_SetFunctionFrameInit,
LedDriverPhase_SetFunctionFrameDisableLeds,
LedDriverPhase_SetFunctionFrameEnableLeds,
LedDriverPhase_SetShutdownModeNormalInit,
LedDriverPhase_SetFrame1Init,
LedDriverPhase_SetFrame1EnableLeds,
LedDriverPhase_SetFrame1DisableLeds,
LedDriverPhase_SetFrame2Init,
LedDriverPhase_SetFrame8Init,
LedDriverPhase_InitAutoPlayControlRegister1Init,
LedDriverPhase_InitAutoPlayControlRegister2Init,
LedDriverPhase_InitBreathControlRegister1Init,
LedDriverPhase_InitBreathControlRegister2Init,
LedDriverPhase_InitLedControlRegistersZero1Init,
LedDriverPhase_InitLedControlRegistersZero2Init,
LedDriverPhase_InitLedValuesInit,
LedDriverPhase_UpdateChangedLedValuesUpdateLeds,
LedDriverPhase_SetConfigurationRegisterDisableLeds,
LedDriverPhase_SetConfigurationRegisterEnableLeds,
LedDriverPhase_InitLedControlRegistersInit
LedDriverPhase_SetFunctionFrame,
LedDriverPhase_SetShutdownModeNormal,
LedDriverPhase_SetFrame1,
LedDriverPhase_InitLedControlRegisters,
LedDriverPhase_InitLedValues,
LedDriverPhase_UpdateChangedLedValues,
} led_driver_phase_t;
typedef struct {
bool requests[LedDriverRequest_Last + 1];
led_driver_phase_t phase;
uint8_t targetLedValues[LED_DRIVER_LED_COUNT];
uint8_t ledIndex;
@@ -74,9 +50,8 @@
// Functions:
void LedSlaveDriver_DisableLeds(uint8_t ledDriverId);
void LedSlaveDriver_EnableLeds(uint8_t ledDriverId);
void LedSlaveDriver_UpdateLeds(uint8_t ledDriverId);
void LedSlaveDriver_DisableLeds(void);
void LedSlaveDriver_UpdateLeds(void);
void LedSlaveDriver_Init(uint8_t ledDriverId);
status_t LedSlaveDriver_Update(uint8_t ledDriverId);

View File

@@ -168,16 +168,12 @@ static volatile bool wakeUpHostAllowed;
static void suspendUhk(void) {
SleepModeActive = true;
for (uint8_t i = 0; i <= LedDriverId_Last; i++) {
LedSlaveDriver_DisableLeds(i);
}
LedSlaveDriver_DisableLeds();
}
static void wakeUpUhk(void) {
SleepModeActive = false;
for (uint8_t i = 0; i <= LedDriverId_Last; i++) {
LedSlaveDriver_EnableLeds(i);
}
LedSlaveDriver_UpdateLeds();
}
void WakeUpHost(void) {

View File

@@ -237,72 +237,84 @@ static void handleSwitchLayerAction(key_state_t *keyState, key_action_t *action)
static uint8_t basicScancodeIndex = 0;
static uint8_t mediaScancodeIndex = 0;
static uint8_t systemScancodeIndex = 0;
static uint8_t stickyModifiers;
static uint8_t stickyModifiers, stickySlotId, stickyKeyId;
static uint8_t secondaryRoleState = SecondaryRoleState_Released;
static uint8_t secondaryRoleSlotId;
static uint8_t secondaryRoleKeyId;
static secondary_role_t secondaryRole;
static void applyKeyAction(key_state_t *keyState, key_action_t *action)
static void applyKeyAction(key_state_t *keyState, key_action_t *action, uint8_t slotId, uint8_t keyId)
{
if (keyState->suppressed) {
return;
}
if (keyState->current) {
handleSwitchLayerAction(keyState, action);
handleSwitchLayerAction(keyState, action);
switch (action->type) {
case KeyActionType_Keystroke:
if (action->keystroke.scancode) {
if (!keyState->previous) {
stickyModifiers = action->keystroke.modifiers;
switch (action->type) {
case KeyActionType_Keystroke:
if (action->keystroke.scancode) {
if (!keyState->previous) {
stickyModifiers = action->keystroke.modifiers;
stickySlotId = slotId;
stickyKeyId = keyId;
}
} else {
ActiveUsbBasicKeyboardReport->modifiers |= action->keystroke.modifiers;
}
} else {
ActiveUsbBasicKeyboardReport->modifiers |= action->keystroke.modifiers;
}
switch (action->keystroke.keystrokeType) {
case KeystrokeType_Basic:
if (basicScancodeIndex >= USB_BASIC_KEYBOARD_MAX_KEYS || action->keystroke.scancode == 0) {
switch (action->keystroke.keystrokeType) {
case KeystrokeType_Basic:
if (basicScancodeIndex >= USB_BASIC_KEYBOARD_MAX_KEYS || action->keystroke.scancode == 0) {
break;
}
ActiveUsbBasicKeyboardReport->scancodes[basicScancodeIndex++] = action->keystroke.scancode;
break;
}
ActiveUsbBasicKeyboardReport->scancodes[basicScancodeIndex++] = action->keystroke.scancode;
break;
case KeystrokeType_Media:
if (mediaScancodeIndex >= USB_MEDIA_KEYBOARD_MAX_KEYS) {
case KeystrokeType_Media:
if (mediaScancodeIndex >= USB_MEDIA_KEYBOARD_MAX_KEYS) {
break;
}
ActiveUsbMediaKeyboardReport->scancodes[mediaScancodeIndex++] = action->keystroke.scancode;
break;
}
ActiveUsbMediaKeyboardReport->scancodes[mediaScancodeIndex++] = action->keystroke.scancode;
break;
case KeystrokeType_System:
if (systemScancodeIndex >= USB_SYSTEM_KEYBOARD_MAX_KEYS) {
case KeystrokeType_System:
if (systemScancodeIndex >= USB_SYSTEM_KEYBOARD_MAX_KEYS) {
break;
}
ActiveUsbSystemKeyboardReport->scancodes[systemScancodeIndex++] = action->keystroke.scancode;
break;
}
break;
case KeyActionType_Mouse:
if (!keyState->previous) {
stickyModifiers = 0;
}
activeMouseStates[action->mouseAction] = true;
break;
case KeyActionType_SwitchLayer:
// Handled by handleSwitchLayerAction()
break;
case KeyActionType_SwitchKeymap:
if (!keyState->previous) {
stickyModifiers = 0;
secondaryRoleState = SecondaryRoleState_Released;
SwitchKeymapById(action->switchKeymap.keymapId);
}
break;
case KeyActionType_PlayMacro:
if (!keyState->previous) {
stickyModifiers = 0;
Macros_StartMacro(action->playMacro.macroId);
}
break;
}
} else {
switch (action->type) {
case KeyActionType_Keystroke:
if (keyState->previous) {
if (slotId == stickySlotId && keyId == stickyKeyId) {
if (!IsLayerHeld() && !(secondaryRoleState == SecondaryRoleState_Triggered && IS_SECONDARY_ROLE_LAYER_SWITCHER(secondaryRole))) {
stickyModifiers = 0;
}
}
ActiveUsbSystemKeyboardReport->scancodes[systemScancodeIndex++] = action->keystroke.scancode;
break;
}
break;
case KeyActionType_Mouse:
if (!keyState->previous) {
stickyModifiers = 0;
}
activeMouseStates[action->mouseAction] = true;
break;
case KeyActionType_SwitchLayer:
// Handled by handleSwitchLayerAction()
break;
case KeyActionType_SwitchKeymap:
if (!keyState->previous) {
stickyModifiers = 0;
secondaryRoleState = SecondaryRoleState_Released;
SwitchKeymapById(action->switchKeymap.keymapId);
}
break;
case KeyActionType_PlayMacro:
if (!keyState->previous) {
stickyModifiers = 0;
Macros_StartMacro(action->playMacro.macroId);
}
break;
}
break;
}
}
}
@@ -394,22 +406,22 @@ static void updateActiveUsbReports(void)
secondaryRoleSlotId = slotId;
secondaryRoleKeyId = keyId;
secondaryRole = action->keystroke.secondaryRole;
keyState->suppressed = true;
}
} else {
applyKeyAction(keyState, action);
applyKeyAction(keyState, action, slotId, keyId);
}
} else {
keyState->suppressed = false;
// Release secondary role key.
if (keyState->previous && secondaryRoleSlotId == slotId && secondaryRoleKeyId == keyId) {
if (keyState->previous && secondaryRoleSlotId == slotId && secondaryRoleKeyId == keyId && secondaryRoleState != SecondaryRoleState_Released) {
// Trigger primary role.
if (secondaryRoleState == SecondaryRoleState_Pressed) {
keyState->previous = false;
applyKeyAction(keyState, action);
keyState->current = true;
applyKeyAction(keyState, action, slotId, keyId);
}
secondaryRoleState = SecondaryRoleState_Released;
} else {
applyKeyAction(keyState, action, slotId, keyId);
}
}

View File

@@ -15,7 +15,7 @@
"commander": "^2.11.0",
"shelljs": "^0.7.8"
},
"firmwareVersion": "8.5.3",
"firmwareVersion": "8.5.4",
"deviceProtocolVersion": "4.5.0",
"moduleProtocolVersion": "4.0.0",
"userConfigVersion": "4.1.0",

View File

@@ -20,7 +20,7 @@
#define FIRMWARE_MAJOR_VERSION 8
#define FIRMWARE_MINOR_VERSION 5
#define FIRMWARE_PATCH_VERSION 3
#define FIRMWARE_PATCH_VERSION 4
#define DEVICE_PROTOCOL_MAJOR_VERSION 4
#define DEVICE_PROTOCOL_MINOR_VERSION 5