keychron_qmk_firmware/keyboards/ergodox_infinity
Joakim Tufvegren 0ae20e7457
Make solo half of split keyboards (more) usable. (#13523)
* Make solo half of split keyboards (more) usable.

Using only one half of a split keyboard (that's using the split_common
framework to communicate) is not a great experience, since several read
timeouts per scan cycle cause an unusably slow scan rate.

This change blocks all split communication attempts for 500 ms
(configurable) after an error occurs, causing the scan rate to become at
least _more_ usable, but might need some tweaking to work fully on most
keyboards. One read timeout still needs to occur after the 500 ms has
passed, and if that timeout isn't low enough, some scan cycles may still
be too slow.

* Fix lint complaint.

* Require 25 consecutive comm errors to see comms as disconnected.

The number of max errors can be overridden by defining
`SPLIT_MAX_CONNECTION_ERRORS`.

* Add comments to new defines, and ability to disable disconnection check.

Also increase `SPLIT_MAX_CONNECTION_ERRORS` to 40, since it's divisible
by most relevant numbers for the description.

* Make lint happy ...again

* Only update `connection_check_timer` when needed.

* Add new defines to split keyboard documentation.

* Move connection timeout logic to transport.c, add `is_transport_connected`.

* Use split_common disconnection logic in matrix.c.

Instead of doing more or less the same thing twice.

* Move disconnection logic to `transport_master`.

Is a cleaner implementation, and causes the scan rate while disconnected
to increase instead of decrease.

* Lint fixes.

* Lower default `SERIAL_USART_TIMEOUT` to 20 ms.

The read timeout must be low enough to not cause exessively long scan
cycles when using a solo split half. 10 ms was determined from testing
to work fine even with the slowest defined baudrate of 19200 (5 ms was
too low for that case), so 20 ms should be fine for most cases.

* Remove `SERIAL_USART_TIMEOUT` from ergodox_infinity/config.h

Was somewhat mistakenly included in an earlier PR.

* Fix building with `USE_I2C`.

* Reduce built firmware size.

Not really sure why this works, the idea was taken from tzarc's work on
split disconnection.

* Tweak and improve opt-out for split disconnection logic.

There are now two ways to opt out from this feature:
* Set `SPLIT_MAX_CONNECTION_ERRORS` to 0. This will completely disable
  the connection status checks (also affects the slave matrix reset logic in
  matrix.c, though).
* Set `SPLIT_CONNECTION_CHECK_TIMEOUT` to 0. This will only disable the
  communication throttling while disconnected. Will make the firmware
  smaller.

* Make split disconnection logic work with custom transports.

Includes a fallback implementation for keyboards using a custom
split_util.c but not a custom matrix.c (currently no such keyboard seems
to be merged, though).

* Remove unnecessary include of timer.h

Co-authored-by: Joel Challis <git@zvecr.com>

Co-authored-by: Joel Challis <git@zvecr.com>
2021-08-22 10:51:17 +10:00
..
keymaps Remove Full Bootmagic (#13846) 2021-08-06 23:59:56 -07:00
board_is31fl3731c.h
board_st7565.h
chconf.h
config.h Make solo half of split keyboards (more) usable. (#13523) 2021-08-22 10:51:17 +10:00
ergodox_infinity.c __flash? (#13799) 2021-07-31 14:35:30 +01:00
ergodox_infinity.h
gfxconf.h
halconf.h
info.json
mcuconf.h
MEMO.txt
readme.md
rules.mk Remove MIDI Configuration boilerplate (#11151) 2021-08-16 06:51:13 +10:00
simple_visualizer.h
visualizer.c Switch Ergodox Infinity over to split_common (#13481) 2021-07-19 18:54:32 -07:00

ErgoDox Infinity

The Infinity is two completely independent keyboards, and needs to be flashed for the left and right halves seperately. To flash them:

  • Make sure you are in the top-level qmk_firmware directory

  • Build the firmware with make ergodox_infinity:keymapname

  • Plug in the left hand keyboard only.

  • Press the program button (back of keyboard, above thumb pad).

  • Install the firmware with sudo make ergodox_infinity:keymapname:dfu-util

  • Build right hand firmware with make ergodox_infinity:keymapname MASTER=right

  • Plug in the right hand keyboard only.

  • Press the program button (back of keyboard, above thumb pad).

  • Install the firmware with sudo make ergodox_infinity:keymapname:dfu-util MASTER=right

More information on the Infinity firmware is available in the TMK/chibios for Input Club Infinity Ergodox

Infinity Master/Two Halves

The Infinity is two completely independent keyboards, that can connect together. You have a few options in how you flash the firmware:

  • Add #define EE_HANDS to your config.h, initialize the EEPROM values (see below), and then flash the same firmware to both halves.

  • Flash the left half, rebuild the firmware with "MASTER=right" and then flash the right half. This allows you to plug in either half directly to the computer and is what the above instructions do.

  • Flash the left half, then flash the same firmware on the right. This only works when the left half is plugged directly to the computer and the keymap is mirrored. It saves the small extra step of rebuilding with "MASTER=right".

  • The same as the previous one but with "MASTER=right" when you build the firmware, then flash the same firmware to both halves. You just have to directly connect the right half to the computer.

  • For minor changes such as changing only the keymap without having updated any part of the firmware code itself, you can program only the MASTER half, but it is safest to program both halves.

EE_HANDS initialization

To initialize the EEPROM values for EE_HANDS to work properly, these steps should work. They only need to be done once, unless you reset the EEPROM later.

  • Plug in the left keyboard half to the computer, and press its program button.

  • Flash the left half with make ergodox_infinity:default:dfu-util-split-left (If you need to use a different method to flash your keyboard, still run this command, and abort it with Ctrl+C when the flashing attempts starts to print errors, then flash the built firmware).

  • On the left half, press the top vertical 1.5U key (second from the top in the rightmost column) once, then the 1U key at the bottom in the opposite corner (bottom left corner).

  • Plug in the right keyboard half to the computer, and press its program button.

  • Flash the right half with make ergodox_infinity:default:dfu-util-split-right

  • On the right half, press the top vertical 1.5U key (second from the top in the leftmost column) once, then the 1U key at the bottom in the opposite corner (bottom right corner).

  • Add #define EE_HANDS to the config.h file of your keymap, and build your firmware using make ergodox_infinity:keymapname.

  • After this, you can flash both halves with the same firmware, without having to rebuild with "MASTER=right" or risking a mirrored keyboard when connected the wrong way. If you reset your EEPROM later, you'll have to follow these steps again, though.