6 Commits

Author SHA1 Message Date
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
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
László Monda
a22dfdd917 Update version to 8.5.1, changelog, package.json and versions.h 2018-10-04 23:10:58 +02:00
László Monda
8b69a25dda Reset UsbReportUpdateSemaphore if it gets stuck for 100ms. This should fix occasional freezes. 2018-10-04 23:04:13 +02:00
7 changed files with 29 additions and 16 deletions

View File

@@ -5,6 +5,18 @@ 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/) 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. and this project adheres to the [UHK Versioning](VERSIONING.md) conventions.
## [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
- Reset UsbReportUpdateSemaphore if it gets stuck for 100ms. This should fix occasional freezes.
## [8.5.0] - 2018-10-04 ## [8.5.0] - 2018-10-04
Device Protocol: 4.**5.0** | Module Protocol: 4.0.0 | User Config: 4.1.0 | Hardware Config: 1.0.0 Device Protocol: 4.**5.0** | Module Protocol: 4.0.0 | User Config: 4.1.0 | Hardware Config: 1.0.0

View File

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

View File

@@ -25,8 +25,7 @@ static uint16_t DoubleTapSwitchLayerReleaseTimeout = 200;
static bool activeMouseStates[ACTIVE_MOUSE_STATES_COUNT]; static bool activeMouseStates[ACTIVE_MOUSE_STATES_COUNT];
bool TestUsbStack = false; bool TestUsbStack = false;
bool KeymapChanged = false; static key_action_t actionCache[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE];
static uint8_t layerCache[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE];
volatile uint8_t UsbReportUpdateSemaphore = 0; volatile uint8_t UsbReportUpdateSemaphore = 0;
@@ -335,8 +334,6 @@ static void updateActiveUsbReports(void)
if (layerChanged) { if (layerChanged) {
stickyModifiers = 0; stickyModifiers = 0;
} }
bool keymapChangedLastCycle = KeymapChanged;
KeymapChanged = false;
LedDisplay_SetLayer(activeLayer); LedDisplay_SetLayer(activeLayer);
if (TestUsbStack) { if (TestUsbStack) {
@@ -383,16 +380,14 @@ static void updateActiveUsbReports(void)
secondaryRoleState = SecondaryRoleState_Triggered; secondaryRoleState = SecondaryRoleState_Triggered;
keyState->current = false; keyState->current = false;
} else { } 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 (keyState->current) {
if ((KeymapChanged || keymapChangedLastCycle) && keyState->previous) { if (action->type == KeyActionType_Keystroke && action->keystroke.secondaryRole) {
keyState->suppressed = true;
} else if (action->type == KeyActionType_Keystroke && action->keystroke.secondaryRole) {
// Press released secondary role key. // Press released secondary role key.
if (!keyState->previous && secondaryRoleState == SecondaryRoleState_Released) { if (!keyState->previous && secondaryRoleState == SecondaryRoleState_Released) {
secondaryRoleState = SecondaryRoleState_Pressed; secondaryRoleState = SecondaryRoleState_Pressed;
@@ -440,14 +435,21 @@ uint32_t UsbReportUpdateCounter;
void UpdateUsbReports(void) void UpdateUsbReports(void)
{ {
static uint32_t lastUpdateTime;
for (uint8_t keyId = 0; keyId < RIGHT_KEY_MATRIX_KEY_COUNT; keyId++) { for (uint8_t keyId = 0; keyId < RIGHT_KEY_MATRIX_KEY_COUNT; keyId++) {
KeyStates[SlotId_RightKeyboardHalf][keyId].current = RightKeyMatrix.keyStates[keyId]; KeyStates[SlotId_RightKeyboardHalf][keyId].current = RightKeyMatrix.keyStates[keyId];
} }
if (UsbReportUpdateSemaphore && !SleepModeActive) { if (UsbReportUpdateSemaphore && !SleepModeActive) {
return; if (Timer_GetElapsedTime(&lastUpdateTime) < USB_SEMAPHORE_TIMEOUT) {
return;
} else {
UsbReportUpdateSemaphore = 0;
}
} }
lastUpdateTime = CurrentTime;
UsbReportUpdateCounter++; UsbReportUpdateCounter++;
ResetActiveUsbBasicKeyboardReport(); ResetActiveUsbBasicKeyboardReport();

View File

@@ -14,6 +14,8 @@
#define SECONDARY_ROLE_MODIFIER_TO_HID_MODIFIER(secondaryRoleModifier) (1 << ((secondaryRoleModifier) - 1)) #define SECONDARY_ROLE_MODIFIER_TO_HID_MODIFIER(secondaryRoleModifier) (1 << ((secondaryRoleModifier) - 1))
#define SECONDARY_ROLE_LAYER_TO_LAYER_ID(secondaryRoleLayer) ((secondaryRoleLayer) - SecondaryRole_RightSuper) #define SECONDARY_ROLE_LAYER_TO_LAYER_ID(secondaryRoleLayer) ((secondaryRoleLayer) - SecondaryRole_RightSuper)
#define USB_SEMAPHORE_TIMEOUT 100 // ms
// Typedefs: // Typedefs:
typedef enum { typedef enum {
@@ -72,7 +74,6 @@
extern uint32_t UsbReportUpdateCounter; extern uint32_t UsbReportUpdateCounter;
extern volatile uint8_t UsbReportUpdateSemaphore; extern volatile uint8_t UsbReportUpdateSemaphore;
extern bool TestUsbStack; extern bool TestUsbStack;
extern bool KeymapChanged;
// Functions: // Functions:

View File

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

View File

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