15 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
László Monda
a59b43b433 Bump version to 8.5.3, update package.json, changelog, versions.h and reference the latest Agent. 2018-10-20 01:20:31 +02:00
László Monda
ceb2f3de00 Re-enable the I2C watchdog of the left keyboard half which was accidentally disabled starting from firmware 8.4.3. This should fix the freezes of the left keyboard half. 2018-10-20 01:11:36 +02:00
László Monda
5cd4030a93 Merge branch 'master' of github.com:UltimateHackingKeyboard/firmware 2018-10-06 21:33:16 +02:00
László Monda
21ae72dd9e Bump version to 8.5.2, update changelog, package.json, versions.h, and Agent. 2018-10-06 21:31:32 +02:00
László Monda
dba61c6a42 Merge pull request #186 from UltimateHackingKeyboard/action-cache
Extend the behavior of keys upon layer changes to keymap changes
2018-10-06 20:56:06 +02:00
László Monda
f61acc483b Update ISSUE_TEMPLATE 2018-10-06 20:26:47 +02:00
László Monda
fb38e4099b Update ISSUE_TEMPLATE 2018-10-06 20:03:51 +02:00
László Monda
5fe19abe06 Merge branch 'master' into action-cache 2018-10-06 19:44:08 +02:00
Eric Tang
06e34fdcbc Convert the layer cache to an action cache 2018-10-06 10:02:46 -05:00
Eric Tang
cc6666b96d Don't suppress keys upon keymap changes 2018-10-06 10:02:23 -05:00
13 changed files with 126 additions and 81 deletions

View File

@@ -5,6 +5,24 @@ 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
- Re-enable the I2C watchdog of the left keyboard half which was accidentally disabled starting from firmware 8.4.3. This should fix the freezes of the left keyboard half.
## [8.5.2] - 2018-10-06
Device Protocol: 4.5.0 | Module Protocol: 4.0.0 | User Config: 4.1.0 | Hardware Config: 1.0.0
- Don't suppress keys upon keymap change.
## [8.5.1] - 2018-10-04
Device Protocol: 4.5.0 | Module Protocol: 4.0.0 | User Config: 4.1.0 | Hardware Config: 1.0.0

View File

@@ -1 +1,8 @@
If you're using Karabiner Elements on your Mac, then stop here! Make sure to close Karabiner Elements, then try to reproduce the issue again, even if you think that Karabiner Elements shouldn't be the cause. Karabiner Elements is the source of numerous problems, and we don't want to receive any more reports it causes.
Before submitting a new issue, make sure to do the following:
1. If you're using Karabiner Elements on your Mac, close it!
2. Install the latest Agent:
https://github.com/UltimateHackingKeyboard/agent/releases/latest
3. Use Agent to update to the latest firmware:
https://github.com/UltimateHackingKeyboard/firmware/releases/latest
4. Try to reproduce the issue, and only report it if it still persists.

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

@@ -5,9 +5,7 @@
void KEY_SCANNER_HANDLER(void)
{
KeyMatrix_ScanRow(&keyMatrix);
#ifdef I2C_WATCHDOG
RunWatchdog();
#endif
LPTMR_ClearStatusFlags(KEY_SCANNER_LPTMR_BASEADDR, kLPTMR_TimerCompareFlag);
}

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

@@ -5,7 +5,6 @@
#include "config_parser/parse_keymap.h"
#include "config_parser/config_globals.h"
#include "macros.h"
#include "usb_report_updater.h"
keymap_reference_t AllKeymaps[MAX_KEYMAP_NUM] = {
{
@@ -25,7 +24,6 @@ void SwitchKeymapById(uint8_t index)
ValidatedUserConfigBuffer.offset = AllKeymaps[index].offset;
ParseKeymap(&ValidatedUserConfigBuffer, index, AllKeymapsCount, AllMacrosCount);
LedDisplay_UpdateText();
KeymapChanged = true;
}
bool SwitchKeymapByAbbreviation(uint8_t length, char *abbrev)

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

@@ -25,8 +25,7 @@ static uint16_t DoubleTapSwitchLayerReleaseTimeout = 200;
static bool activeMouseStates[ACTIVE_MOUSE_STATES_COUNT];
bool TestUsbStack = false;
bool KeymapChanged = false;
static uint8_t layerCache[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE];
static key_action_t actionCache[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE];
volatile uint8_t UsbReportUpdateSemaphore = 0;
@@ -238,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;
}
}
}
@@ -335,8 +346,6 @@ static void updateActiveUsbReports(void)
if (layerChanged) {
stickyModifiers = 0;
}
bool keymapChangedLastCycle = KeymapChanged;
KeymapChanged = false;
LedDisplay_SetLayer(activeLayer);
if (TestUsbStack) {
@@ -383,38 +392,36 @@ static void updateActiveUsbReports(void)
secondaryRoleState = SecondaryRoleState_Triggered;
keyState->current = false;
} else {
layerCache[slotId][keyId] = activeLayer;
actionCache[slotId][keyId] = CurrentKeymap[activeLayer][slotId][keyId];
}
}
action = &CurrentKeymap[layerCache[slotId][keyId]][slotId][keyId];
action = &actionCache[slotId][keyId];
if (keyState->current) {
if ((KeymapChanged || keymapChangedLastCycle) && keyState->previous) {
keyState->suppressed = true;
} else if (action->type == KeyActionType_Keystroke && action->keystroke.secondaryRole) {
if (action->type == KeyActionType_Keystroke && action->keystroke.secondaryRole) {
// Press released secondary role key.
if (!keyState->previous && secondaryRoleState == SecondaryRoleState_Released) {
secondaryRoleState = SecondaryRoleState_Pressed;
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

@@ -74,7 +74,6 @@
extern uint32_t UsbReportUpdateCounter;
extern volatile uint8_t UsbReportUpdateSemaphore;
extern bool TestUsbStack;
extern bool KeymapChanged;
// Functions:

View File

@@ -15,7 +15,7 @@
"commander": "^2.11.0",
"shelljs": "^0.7.8"
},
"firmwareVersion": "8.5.1",
"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 1
#define FIRMWARE_PATCH_VERSION 4
#define DEVICE_PROTOCOL_MAJOR_VERSION 4
#define DEVICE_PROTOCOL_MINOR_VERSION 5