Merge remote-tracking branch 'upstream/develop' into xap

This commit is contained in:
Nick Brassel 2025-01-21 09:01:32 +11:00
commit 0c0d620165
No known key found for this signature in database
6 changed files with 66 additions and 106 deletions

View File

@ -655,6 +655,10 @@ ifeq ($(strip $(XAP_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/xap/xap.c $(QUANTUM_DIR)/xap/xap_handlers.c
endif
ifeq ($(strip $(DYNAMIC_KEYMAP_ENABLE)), yes)
SEND_STRING_ENABLE := yes
endif
VALID_CUSTOM_MATRIX_TYPES:= yes lite no
CUSTOM_MATRIX ?= no

View File

@ -20,13 +20,13 @@ If you own a board from one of the following vendors already, consider asking th
| Vendor | Reason |
|------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| BBB Keyboard | Selling tri-mode boards based on QMK without sources, attempted upstreaming crippled firmware without wireless. |
| Chillkey | |
| CIDOO | Selling wired boards based on QMK without sources, just `via.json` provided. |
| Darmoshark | Selling wired boards based on QMK without sources, just `via.json` provided. |
| Epomaker | Lots of historical keyboards with `via.json` but no corresponding sources. Wireless code for a small handful provided, pending core cleanup for QMK upstreaming. Most other boards have source nowhere to be seen. |
| Ergokbd (IFKB) | At least their crkbd clone ships with QMK+Vial, seemingly refuses to disclose sources despite multiple customers requesting them. |
| iLovBee | Official 30-day copyright source code request issued Sep 11 2024 due to deception on PR, no response received. Ambiguity on PRs -- marketing says wireless, PR author said wired-only, then included wireless code anyway. Seemingly intentionally deceptive. |
| KiiBOOM | Seems to use the same OEM as Epomaker, same problems. |
| kprepublic | Makes no attempt to release source code, all boards in QMK are reverse-engineered, created, and supported by the community. New board variants magically appear without telling customers they're incompatible with existing QMK versions, in some cases bricking boards or requiring ISP flashing. |
| Luminkey | Selling tri-mode boards based on QMK without sources, just `via.json` provided. |
| Meletrix | Selling tri-mode boards based on QMK without sources, just `via.json` provided. |
| mmd / Smartmmd / i-game.tech | Ambiguity on PRs -- marketing says wireless, PR author said wired-only, then included wireless code anyway. Seemingly intentionally deceptive. |
@ -36,13 +36,13 @@ If you own a board from one of the following vendors already, consider asking th
| Redragon | Selling tri-mode boards based on QMK without sources, attempted upstreaming crippled firmware without wireless. |
| Royal Kludge | PRs for fake boards in order to attain VIA compatibility identified. Lots of other keyboards with `via.json` but no corresponding sources, attempted upstreaming crippled firmware without wireless. Wireless code for some provided, pending core cleanup for QMK upstreaming. PRs including different manufacturer names as well. |
| Shenzhen Hangsheng | PR submissions with crippled firmware, debating with maintainers about wireless despite marketing material clearly stating tri-mode. |
| Shortcut Studio | Selling tri-mode boards based on QMK without sources, just `via.json` provided. |
| Tacworks | Selling tri-mode boards based on QMK, crippled firmware already merged into QMK without wireless without QMK team realising. |
| TKD / Vertex | Selling tri-mode boards based on QMK without sources, attempted upstreaming crippled firmware without wireless. |
| WOBKEY | Selling tri-mode boards based on QMK without sources, attempted upstreaming crippled firmware without wireless. |
| Weikav | Selling tri-mode boards based on QMK without sources, just `via.json` provided. |
| Womier | Selling tri-mode boards based on QMK without sources, attempted upstreaming crippled firmware without wireless. |
| Wuque Studio | Selling wired and tri-mode boards based on QMK without sources, just `via.json` provided. |
| XVX | Ambiguity on PRs -- marketing says wireless, PR author said wired-only. Seemingly intentionally deceptive. |
| Zuoya | Selling tri-mode boards based on QMK without sources, just `via.json` provided. |
::: danger Violations

View File

@ -1,3 +1 @@
WS2812_DRIVER_REQUIRED = yes
DEFAULT_FOLDER = rgbkb/pan/rev1

View File

@ -294,6 +294,17 @@ void dynamic_keymap_macro_set_buffer(uint16_t offset, uint16_t size, uint8_t *da
}
}
typedef struct send_string_eeprom_state_t {
const uint8_t *ptr;
} send_string_eeprom_state_t;
char send_string_get_next_eeprom(void *arg) {
send_string_eeprom_state_t *state = (send_string_eeprom_state_t *)arg;
char ret = eeprom_read_byte(state->ptr);
state->ptr++;
return ret;
}
void dynamic_keymap_macro_reset(void) {
void *p = (void *)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR);
void *end = (void *)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE);
@ -333,57 +344,6 @@ void dynamic_keymap_macro_send(uint8_t id) {
++p;
}
// 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) {
data[0] = eeprom_read_byte(p++);
data[1] = 0;
// Stop at the null terminator of this macro string
if (data[0] == 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);
}
send_string_eeprom_state_t state = {p};
send_string_with_delay_impl(send_string_get_next_eeprom, &state, DYNAMIC_KEYMAP_MACRO_DELAY);
}

View File

@ -150,48 +150,65 @@ void send_string(const char *string) {
send_string_with_delay(string, TAP_CODE_DELAY);
}
void send_string_with_delay(const char *string, uint8_t interval) {
void send_string_with_delay_impl(char (*getter)(void *), void *arg, uint8_t interval) {
while (1) {
char ascii_code = *string;
char ascii_code = getter(arg);
if (!ascii_code) break;
if (ascii_code == SS_QMK_PREFIX) {
ascii_code = *(++string);
ascii_code = getter(arg);
if (ascii_code == SS_TAP_CODE) {
// tap
uint8_t keycode = *(++string);
uint8_t keycode = getter(arg);
tap_code(keycode);
} else if (ascii_code == SS_DOWN_CODE) {
// down
uint8_t keycode = *(++string);
uint8_t keycode = getter(arg);
register_code(keycode);
} else if (ascii_code == SS_UP_CODE) {
// up
uint8_t keycode = *(++string);
uint8_t keycode = getter(arg);
unregister_code(keycode);
} else if (ascii_code == SS_DELAY_CODE) {
// delay
int ms = 0;
uint8_t keycode = *(++string);
int ms = 0;
ascii_code = getter(arg);
while (isdigit(keycode)) {
while (isdigit(ascii_code)) {
ms *= 10;
ms += keycode - '0';
keycode = *(++string);
ms += ascii_code - '0';
ascii_code = getter(arg);
}
wait_ms(ms);
}
wait_ms(interval);
// if we had a delay that terminated with a null, we're done
if (ascii_code == 0) break;
} else {
send_char_with_delay(ascii_code, interval);
}
++string;
}
}
typedef struct send_string_memory_state_t {
const char *string;
} send_string_memory_state_t;
char send_string_get_next_ram(void *arg) {
send_string_memory_state_t *state = (send_string_memory_state_t *)arg;
char ret = *state->string;
state->string++;
return ret;
}
void send_string_with_delay(const char *string, uint8_t interval) {
send_string_memory_state_t state = {string};
send_string_with_delay_impl(send_string_get_next_ram, &state, interval);
}
void send_char(char ascii_code) {
send_char_with_delay(ascii_code, TAP_CODE_DELAY);
}
@ -297,42 +314,15 @@ void send_string_P(const char *string) {
send_string_with_delay_P(string, TAP_CODE_DELAY);
}
char send_string_get_next_progmem(void *arg) {
send_string_memory_state_t *state = (send_string_memory_state_t *)arg;
char ret = pgm_read_byte(state->string);
state->string++;
return ret;
}
void send_string_with_delay_P(const char *string, uint8_t interval) {
while (1) {
char ascii_code = pgm_read_byte(string);
if (!ascii_code) break;
if (ascii_code == SS_QMK_PREFIX) {
ascii_code = pgm_read_byte(++string);
if (ascii_code == SS_TAP_CODE) {
// tap
uint8_t keycode = pgm_read_byte(++string);
tap_code(keycode);
} else if (ascii_code == SS_DOWN_CODE) {
// down
uint8_t keycode = pgm_read_byte(++string);
register_code(keycode);
} else if (ascii_code == SS_UP_CODE) {
// up
uint8_t keycode = pgm_read_byte(++string);
unregister_code(keycode);
} else if (ascii_code == SS_DELAY_CODE) {
// delay
int ms = 0;
uint8_t keycode = pgm_read_byte(++string);
while (isdigit(keycode)) {
ms *= 10;
ms += keycode - '0';
keycode = pgm_read_byte(++string);
}
wait_ms(ms);
}
} else {
send_char_with_delay(ascii_code, interval);
}
++string;
}
send_string_memory_state_t state = {string};
send_string_with_delay_impl(send_string_get_next_progmem, &state, interval);
}
#endif

View File

@ -161,4 +161,12 @@ void send_string_with_delay_P(const char *string, uint8_t interval);
*/
#define SEND_STRING_DELAY(string, interval) send_string_with_delay_P(PSTR(string), interval)
/**
* \brief Actual implementation function that iterates and sends the string returned by the getter function.
*
* The getter assumes that the next byte is available to be read, and returns it. `arg` is passed in and can be whatever
* makes most sense for the getter -- each invocation of `getter` must advance its position in the source.
*/
void send_string_with_delay_impl(char (*getter)(void *), void *arg, uint8_t interval);
/** \} */