1
0
Fork 0

VIA V3 - The Custom UI Update (#18222)

This commit is contained in:
Wilba 2022-11-10 07:46:44 +11:00 committed by GitHub
parent 575b0e33fa
commit bc6f8dc8b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
68 changed files with 751 additions and 886 deletions

View file

@ -279,9 +279,8 @@ void dynamic_keymap_macro_send(uint8_t id) {
p = (void *)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR);
void *end = (void *)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE);
while (id > 0) {
// If we are past the end of the buffer, then the buffer
// contents are garbage, i.e. there were not DYNAMIC_KEYMAP_MACRO_COUNT
// nulls in the buffer.
// If we are past the end of the buffer, then there is
// no Nth macro in the buffer.
if (p == end) {
return;
}
@ -291,9 +290,8 @@ void dynamic_keymap_macro_send(uint8_t id) {
++p;
}
// Send the macro string one or three chars at a time
// by making temporary 1 or 3 char strings
char data[4] = {0, 0, 0, 0};
// Send the macro string by making a temporary string.
char data[8] = {0};
// We already checked there was a null at the end of
// the buffer, so this cannot go past the end
while (1) {
@ -303,14 +301,44 @@ void dynamic_keymap_macro_send(uint8_t id) {
if (data[0] == 0) {
break;
}
// If the char is magic (tap, down, up),
// add the next char (key to use) and send a 3 char string.
if (data[0] == SS_TAP_CODE || data[0] == SS_DOWN_CODE || data[0] == SS_UP_CODE) {
data[1] = data[0];
data[0] = SS_QMK_PREFIX;
data[2] = eeprom_read_byte(p++);
if (data[2] == 0) {
break;
if (data[0] == SS_QMK_PREFIX) {
// Get the code
data[1] = eeprom_read_byte(p++);
// Unexpected null, abort.
if (data[1] == 0) {
return;
}
if (data[1] == SS_TAP_CODE || data[1] == SS_DOWN_CODE || data[1] == SS_UP_CODE) {
// Get the keycode
data[2] = eeprom_read_byte(p++);
// Unexpected null, abort.
if (data[2] == 0) {
return;
}
// Null terminate
data[3] = 0;
} else if (data[1] == SS_DELAY_CODE) {
// Get the number and '|'
// At most this is 4 digits plus '|'
uint8_t i = 2;
while (1) {
data[i] = eeprom_read_byte(p++);
// Unexpected null, abort
if (data[i] == 0) {
return;
}
// Found '|', send it
if (data[i] == '|') {
data[i + 1] = 0;
break;
}
// If haven't found '|' by i==6 then
// number too big, abort
if (i == 6) {
return;
}
++i;
}
}
}
send_string_with_delay(data, DYNAMIC_KEYMAP_MACRO_DELAY);