Skip to content

Commit

Permalink
Merge pull request UltimateHackingKeyboard#623 from kareltucek/fix_ch…
Browse files Browse the repository at this point in the history
…ording_secondary_race

Fix race condition on chording delay and secondary role.
  • Loading branch information
mondalaci authored Jun 28, 2023
2 parents a6567aa + 46d6884 commit a086660
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion right/src/postponer.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ static void chording()
postponer_buffer_record_type_t* b = &buffer[POS(i+1)];
uint8_t pa = priority(a->key, a->active);
uint8_t pb = priority(b->key, b->active);
if ( (a->active && !b->active) || (a->active && b->active && pa < pb) ) {
// Originally, this also swapped releases to go before presses.
// Not sure why anymore, but it caused race condition on secondary role.
if ( a->active && b->active && pa < pb ) {
if (a->key != b->key && b->time - a->time < ChordingDelay) {
postponer_buffer_record_type_t tmp = *a;
*a = *b;
Expand Down

0 comments on commit a086660

Please sign in to comment.