Added instructions for Gemini PR support

Added comments and updated the readme to explain how to get Gemini PR to work. Also added a YouTube link showing how to flash the ecosteno.
This commit is contained in:
Nathan Olivares 2021-10-07 21:22:20 -04:00
parent 9185ad707d
commit 9de2f5ff59
3 changed files with 98 additions and 3 deletions

View file

@ -0,0 +1,91 @@
diff --git a/quantum/process_keycode/process_steno.c b/quantum/process_keycode/process_steno.c
index 57e279f21..de610d02e 100644
--- a/quantum/process_keycode/process_steno.c
+++ b/quantum/process_keycode/process_steno.c
@@ -61,9 +61,6 @@
static uint8_t state[MAX_STATE_SIZE] = {0};
static uint8_t chord[MAX_STATE_SIZE] = {0};
static int8_t pressed = 0;
-static steno_mode_t mode;
-
-static const uint8_t boltmap[64] PROGMEM = {TXB_NUL, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_S_L, TXB_S_L, TXB_T_L, TXB_K_L, TXB_P_L, TXB_W_L, TXB_H_L, TXB_R_L, TXB_A_L, TXB_O_L, TXB_STR, TXB_STR, TXB_NUL, TXB_NUL, TXB_NUL, TXB_STR, TXB_STR, TXB_E_R, TXB_U_R, TXB_F_R, TXB_R_R, TXB_P_R, TXB_B_R, TXB_L_R, TXB_G_R, TXB_T_R, TXB_S_R, TXB_D_R, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_NUM, TXB_Z_R};
static void steno_clear_state(void) {
memset(state, 0, sizeof(state));
@@ -81,16 +78,9 @@ static void send_steno_state(uint8_t size, bool send_empty) {
}
void steno_init() {
- if (!eeconfig_is_enabled()) {
- eeconfig_init();
- }
- mode = eeprom_read_byte(EECONFIG_STENOMODE);
}
void steno_set_mode(steno_mode_t new_mode) {
- steno_clear_state();
- mode = new_mode;
- eeprom_update_byte(EECONFIG_STENOMODE, mode);
}
/* override to intercept chords right before they get sent.
@@ -103,19 +93,9 @@ __attribute__((weak)) bool postprocess_steno_user(uint16_t keycode, keyrecord_t
__attribute__((weak)) bool process_steno_user(uint16_t keycode, keyrecord_t *record) { return true; }
static void send_steno_chord(void) {
- if (send_steno_chord_user(mode, chord)) {
- switch (mode) {
- case STENO_MODE_BOLT:
- send_steno_state(BOLT_STATE_SIZE, false);
-#ifdef VIRTSER_ENABLE
- virtser_send(0); // terminating byte
-#endif
- break;
- case STENO_MODE_GEMINI:
- chord[0] |= 0x80; // Indicate start of packet
- send_steno_state(GEMINI_STATE_SIZE, true);
- break;
- }
+ if (send_steno_chord_user(STENO_MODE_GEMINI, chord)) {
+ chord[0] |= 0x80; // Indicate start of packet
+ send_steno_state(GEMINI_STATE_SIZE, true);
}
steno_clear_state();
}
@@ -124,17 +104,6 @@ uint8_t *steno_get_state(void) { return &state[0]; }
uint8_t *steno_get_chord(void) { return &chord[0]; }
-static bool update_state_bolt(uint8_t key, bool press) {
- uint8_t boltcode = pgm_read_byte(boltmap + key);
- if (press) {
- state[TXB_GET_GROUP(boltcode)] |= boltcode;
- chord[TXB_GET_GROUP(boltcode)] |= boltcode;
- } else {
- state[TXB_GET_GROUP(boltcode)] &= ~boltcode;
- }
- return false;
-}
-
static bool update_state_gemini(uint8_t key, bool press) {
int idx = key / 7;
uint8_t bit = 1 << (6 - (key % 7));
@@ -171,16 +140,9 @@ bool process_steno(uint16_t keycode, keyrecord_t *record) {
if (!process_steno_user(keycode, record)) {
return false;
}
- switch (mode) {
- case STENO_MODE_BOLT:
- update_state_bolt(keycode - QK_STENO, IS_PRESSED(record->event));
- break;
- case STENO_MODE_GEMINI:
- update_state_gemini(keycode - QK_STENO, IS_PRESSED(record->event));
- break;
- }
+ update_state_gemini(keycode - QK_STENO, IS_PRESSED(record->event));
// allow postprocessing hooks
- if (postprocess_steno_user(keycode, record, mode, chord, pressed)) {
+ if (postprocess_steno_user(keycode, record, STENO_MODE_GEMINI, chord, pressed)) {
if (IS_PRESSED(record->event)) {
++pressed;
} else {

View file

@ -469,8 +469,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
void matrix_init_user(void) {
steno_set_mode(STENO_MODE_BOLT); // STENO_MODE_GEMINI or STENO_MODE_BOLT
//steno_set_mode(STENO_MODE_GEMINI);
// STENO_MODE_GEMINI only works if you remove all references to STENO_MODE_BOLT and then some in QMK.
// This is a QMK problem
// STENO_MODE_GEMINI only works if you remove references to TX Bolt in QMK
// follow ecosteno-geminipr.diff to do this (thanks to dnaq in the Plover discord)
};
layer_state_t layer_state_set_user(layer_state_t state) {

View file

@ -15,4 +15,8 @@ Flashing example for this keyboard:
dfu-util.exe -d 1eaf:0003 -a 2 -D "noll_ecosteno_default.bin"
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). You might still need more info (WIP)
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
[Here's a quick video demonstrating how to flash firmware onto the ecosteno](https://youtu.be/dqeZ40PPEW4)
The steno protocol currently included in this project is TX Bolt. I'm not entirely sure why getting Gemini PR to work isn't as simple as changing steno_set_mode(STENO_MODE_GEMINI) in keymap.c, but for now, if you want to compile ecosteno firmware that works with Gemini PR, you'll need to remove some references to TX Bolt by following ecosteno-geminipr.diff in EcoSteno-Firmware/keyboards/noll/ (thanks to dnaq in the Plover discord).