Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helix: add split_common option #26

Conversation

mtei
Copy link

@mtei mtei commented Dec 15, 2019

Description

This PR adds the option to use split_common for Helix keyboard compilation.

  • Compiling as follows will compile with the current Helix custom code.

    make helix:default
    make helix/pico:default
    
  • Compiling as follows will compile with split_common code.

    make helix/rev2/sc:default
    make helix/pico/sc:default
    

You can also specify the use of split_common by adding the following in rules.mk for each keymap:

SPLIT_KEYBOARD = yes

All keymaps have been tested and verified to work.

What is split_common different from current Helix custom code

  • Due to the current limitation of split_common, the current layer information cannot be obtained on the slave side, so the layer information cannot be displayed correctly on OLED etc.

  • split_common scans the matrix a bit slower.

    scan cycle/second
    Helix custom code 1590
    split_common 1190

Keymaps source file compatibility

All keymaps 'keymap.c' and 'config.h' are unchanged. There is no need to change.
The 'rules.mk' of all keymaps except 'xulkal' have not changed.

In the 'xulkal' keymap rules.mk, SPLIT_KEYBOARD = yes was added to always use the split_common code, and the following code in 'users/xulkal/custom_oled.c' was removed.

#if KEYBOARD_helix_rev2
extern uint8_t is_master;
bool is_keyboard_master(void) { return is_master; }
#endif

All compile option patterns

  • build helix/pico (HelixPico) with helix current codes

    $ make helix/pico:KEY_MAP
    $ make helix/pico/back:KEY_MAP
    $ make helix/pico/under:KEY_MAP
    
  • build helix/rev2 (Helix or Helix beta) with helix current codes

    $ make helix:KEY_MAP
    $ make helix/rev2/back:KEY_MAP
    $ make helix/rev2/under:KEY_MAP
    $ make helix/rev2/oled:KEY_MAP
    $ make helix/rev2/oled/back:KEY_MAP
    $ make helix/rev2/oled/under:KEY_MAP
    
  • build helix/pico (HelixPico) with split_common codes

    $ make helix/pico/sc:KEY_MAP
    $ make helix/pico/sc/back:KEY_MAP
    $ make helix/pico/sc/under:KEY_MAP
    
  • build helix/rev2 (Helix) with split_common codes

    $ make helix/rev2/sc:KEY_MAP
    $ make helix/rev2/sc/back:KEY_MAP
    $ make helix/rev2/sc/under:KEY_MAP
    $ make helix/rev2/sc/oled:KEY_MAP
    $ make helix/rev2/sc/oledback:KEY_MAP
    $ make helix/rev2/sc/oledunder:KEY_MAP
    

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

mtei added 7 commits December 9, 2019 20:14
helix/pico/matrix.c: remove 'is_master'
helix/pico/pico.c: add 'is_master'
helix/pico/pico.h: add 'has_usb()' macro
helix/pico/split_util.c: remove 'setup_handedness()' 'has_usb()', add 'is_helix_master()' etc
Made DEBUG_MATRIX_SCAN_RATE easy to use.
how to build:
 ### build helix/pico (HelixPico) with helix current codes
  $ make helix/pico:KEY_MAP
  $ make helix/pico/back:KEY_MAP

 ### build helix/rev2 (Helix or Helix beta) with helix current codes
  $ make helix:KEY_MAP
  $ make helix/rev2/back:KEY_MAP
  $ make helix/rev2/under:KEY_MAP
  $ make helix/rev2/oled:KEY_MAP
  $ make helix/rev2/oled/back:KEY_MAP
  $ make helix/rev2/oled/under:KEY_MAP

 ### build helix/pico (HelixPico) with split_common codes
  $ make helix/pico/sc:KEY_MAP
  $ make helix/pico/sc/back:KEY_MAP
  $ make helix/pico/sc/under:KEY_MAP

 ### build helix/rev2 (Helix) with split_common codes
  $ make helix/rev2/sc:KEY_MAP
  $ make helix/rev2/sc/back:KEY_MAP
  $ make helix/rev2/sc/under:KEY_MAP
  $ make helix/rev2/sc/oled:KEY_MAP
  $ make helix/rev2/sc/oledback:KEY_MAP
  $ make helix/rev2/sc/oledunder:KEY_MAP
…code.

Added the following line to 'helix/rev2/keymaps/xulkal/rules.mk':

        SPLIT_KEYBOARD = yes

Removed the following ad hoc code from 'users/xulkal/custom_oled.c':

        #if KEYBOARD_helix_rev2
        extern uint8_t is_master;
        bool is_keyboard_master(void) { return is_master; }
        #endif
@mtei
Copy link
Author

mtei commented Dec 15, 2019

先日クローズした #24 のやりなおし版です。

今回は、OLED ドライバには触らず、split_common を使用するオプションの追加だけを行ないました。

上の英文で書いてあるように、split_common を使うと機能制限が 1つ(スレーブ側で現在のレイヤー情報が得られない)と 性能の若干の劣化があります。
(先日、お会いしたときもちょっと話したとおりです)

それもあって、split_common への無条件の切り替えはひかえて、お試し版のつもりで、split_common も使えるようにオプション追加ですませました。
今後おいおい split_common 側のコードを整備して全面切り替えできるように持っていきたいなと思っています。

テストとプルリクの処理手順

私の手元の PC で、以下のようにブランチを作りました。

$ cd qmk_firmware
$ git checkout -b helix_add_split_common_option 0.7.100

前回と同様に以下の手順を実行すれば、qmk へのpullreq が綺麗に出来るはずです。

まずないんさんの PC と Github リポジトリに qmk の最新をとりこみます。

次にないんさんの PC で、以下を実行

$ cd qmk_firmware
$ git checkout -b helix_add_split_common_option 0.7.100
$ git push origin helix_add_split_common_option

ないんさんの GitHub リポジトリで、この PR のタイトルの右にある編集ボタンを押して
マージ先のブランチを、helix_add_split_common_option に変更します。(まだマージはしません。)

ないんさんの PC で、以下を実行すれば、私のところの helix_add_split_common_option とまったく同じ内容のブランチが test_split_common という名前で出来上がるので、内容の確認と動作の確認をします。

$ cd qmk_firmware
$ git fetch origin pull/24/head:test_split_common
$ git checkout test_split_common

確認が終了したら、ないんさんの GitHub リポジトリで、マージをします。

最後に helix_add_split_common_option ブランチを qmk に PullRequest すれば、綺麗な PR になると思われます。

@MakotoKurauchi MakotoKurauchi changed the base branch from master to helix_add_split_common_option December 25, 2019 00:33
@MakotoKurauchi
Copy link
Owner

ありがとうございます。
今まで通りのオプションの時に

$ make helix/rev2/oled/back:avrdude

スレーブ側のOLEDのレイヤー表示が

Layer: Raiselt

となってしまうようです。ご確認頂けますか?

@mtei
Copy link
Author

mtei commented Dec 25, 2019

この PR のブランチと master の二つで、

$ make helix/rev2/oled/back:default:avrdude

をやってみましたが、正常に期待通り動いているようです。

今よく見ると、ないんさんのコマンドは、$ make helix/rev2/oled/back:avrdude で、defualt の指定が抜けているようですが、これは単なる書き間違いですか? それともこの通りのコマンドを入れたのでしょうか?

@mtei
Copy link
Author

mtei commented Dec 25, 2019

キーマップ名を省略したコンパイル指定は、暗黙のうちに all が仮定されるようです。

$ make helix/rev2/oled/back:uso
QMK Firmware 0.7.100
Making helix/rev2/oled/back with keymap default and target uso          [ERRORS]
make[1]: *** No rule to make target `uso'.  Stop.
Making helix/rev2/oled/back with keymap edvorakjp and target uso        [ERRORS]
make[1]: *** No rule to make target `uso'.  Stop.
Making helix/rev2/oled/back with keymap five_rows and target uso        [ERRORS]
make[1]: *** No rule to make target `uso'.  Stop.
途中略
make: *** [helix/rev2/oled/back:uso] Error 1
Make finished with errors
$ make helix/rev2/oled/back:all:uso
QMK Firmware 0.7.100
Making helix/rev2/oled/back with keymap default and target uso          [ERRORS]
make[1]: *** No rule to make target `uso'.  Stop.
Making helix/rev2/oled/back with keymap edvorakjp and target uso        [ERRORS]
make[1]: *** No rule to make target `uso'.  Stop.
Making helix/rev2/oled/back with keymap five_rows and target uso        [ERRORS]
make[1]: *** No rule to make target `uso'.  Stop.
途中略
make: *** [helix/rev2/oled/back:all:uso] Error 1
Make finished with errors

なので、

$ make helix/rev2/oled/back:avrdude

は、以下と同じになり、

$ make helix/rev2/oled/back:all:avrdude

最初の書き込みで default キーマップ、2番目の書き込みで、edvorakjp キーマップを書き込んでいる可能性がありそうです。

@MakotoKurauchi
Copy link
Owner

混乱させてしまいすみません。コマンドはコピペミスで間違いです。
現状のmasterに戻して正常に動作していることは確認済みです。

@mtei
Copy link
Author

mtei commented Dec 25, 2019

うーん、、不思議です。この PR では、キーマップ系のソースは変更がないので変わらないとおもうのです。実際、手元では、master でも、このブランチでも同じ動作をしています。

もういちど、master, このブランチの helix original、このブランチの split_common 使用、の3つを default キーマップで試してみましたが、前2者は同じ動作、最後のものは、slave 側が 'default' 表示のまま、と、期待したとおりの動きでした。

どうすれば、報告の挙動を再現できるのだろう。

@mtei
Copy link
Author

mtei commented Dec 25, 2019

ごめんなさい、上で、以下のように書いたところが間違っていました。

$ cd qmk_firmware
$ git fetch origin pull/24/head:test_split_common
$ git checkout test_split_common

正しくは、以下のように、24 を 26 にしなければなりませんでした。

$ cd qmk_firmware
$ git fetch origin pull/26/head:test_split_common
$ git checkout test_split_common

一旦 test_split_common ブランチを消してやり直してからテストしてどうなるか確認お願いします。

(こちらでも、報告の現象再現できました。これは、#24 に有って見逃していたバグですね。ssd1306.c と drivers/oled/oled_driver.c の挙動に違いがあるようです。)

@MakotoKurauchi MakotoKurauchi merged commit 18a5acc into MakotoKurauchi:helix_add_split_common_option Dec 26, 2019
@MakotoKurauchi
Copy link
Owner

ありがとうございます!
こちらも確認不足でした。

@mtei
Copy link
Author

mtei commented Jan 20, 2020

追加の、PR #27 を作りました。マージしてもらえば、自動的に qmk/qmk_firmware への PR に追加で反映されます。

qmk 本家の方で、PR7915 が出ていて、それに伴って、quantum/matrix.cquantum/split_common/matrix.c を利用するキーボードは、config.h に以下が必須になったそうです。
Helix では、make helix/rev2/sc:map のように sc をつけた時が該当します。

#define DIODE_DIRECTION COL2ROW

@mtei mtei mentioned this pull request Jan 27, 2020
@mtei
Copy link
Author

mtei commented Jan 27, 2020

追加の、PR #28 を作りました。

readme にほんのちょっと追記を行いました。

ひと月経過してもqmk 本家にいっこうにマージされてない現状です。
みると All checks have failed になっていますが、さらに詳しく見てみると、他のキーボードのコンパイルがエラーになっていて、helix の問題ではなさそうです。
コメントでそれを指摘しても良いのですが、readme をちょっと直すネタを思いついたのでそれを追加することでテストを再度起動してみようかと思います

MakotoKurauchi pushed a commit that referenced this pull request Apr 9, 2022
* [keyboard] Initial support for Anne Pro 2

* [keyboard][AnnePro2] Keymap:update to a reasonable keymap with caps+hjkl => arrow

* :(

* changed to use HSI

* support for annepro2 c18

* keyboard/annepro2: Very stupid matrix scan bug fix.

* typo

* swap COL14/13

* keyboard/annepro2: startup secondary LED MCU

* keyboard/annepro2: typo fix

* Add IO Values

* Disable Combo feature

* Update default keymap to Anne Pro 2 Official Keymap

* keyboard/annepro2: keymap layer name changes

* keyboard/annepro2 BLE Support

* Fix keymap comment

FN1 ESC was listed as ~ instead of `

* keyboard/annepro2: Bluetooth path

* Keyboard annepro2 bidir led comms (#5)

* Added bidirectional shine comms and moved led functionality to new file

* Added bidirectional shine comms and moved led functionality to new file

* Restore original functionality to existing keymaps using new shine commands

* Fix dangling bracketless if statements

* PR cleanup

* add custom keycodes to switch led profiles

* Optimize code

* switch to prev profile before turning leds off

* Add persistent led support with eeprom (#9)

* adding HT32 support to chibios SPI master driver

* add support for W25X20CL SPI eeprom

* add makefile flag for eeprom feature

* add spi support to keyboard startup and config

* example keymap using eeprom profile loading

* Cleanup to fix C15 eeprom/spi build errors (#11)

* Cleanup to fix C15 eeprom/spi build errors

* add newline at eof

* LED Masking support for Shine

Introduce companion update to ledSetMask and ledClearMask.
In keymap `codetector` there is example of how to map caps_lock
to the caps_lock key light on the keyboard.

* [AnnePro2]: update bluetooth connection

* Merge the custom keys enums on annepro2.h (#13)

* Keyboard annepro2 ble caps lock (#12)

* Move matrix_scan_kb out of board.c to annepro2.c

* add buffer clear after init and caplock polling

* Add support for LED intensity (#15)

* Improve logic for switching off and on of LEDs (#16)

* Implement animation speed (#17)

* Include logic to send solid colors as foreground to shine and add sample profiles (#14)

Include the logic to send a solid color from qmk to shine. That solid color will act as a foreground (will override the current profile) until reset (witch will reactivate the current profile).
This functionality depends on changes made for shine as well.

Include 3 new profiles:

    default-full-caps -> same as default, but with the logic of using the red foreground color on caps lock.
    default-layer-indicators -> same as default, but with the logic of red foreground on caps lock, green foreground on FN1 and blue foreground on FN2.
    thomazmoura -> my own profile as a sample of an over-engineered advanced case scenario.

* Implement reactive lighting effects (#18)

* Added multiarrow keymap (#19)

* Add LED documentation (#26)

* add LED documentation

* add LED documentation to other default profiles

* Implement QMK's IAP default keybind (#29)

* Add keymap for going into IAP

* switch to default QMK keybind for IAP mode

* implement bluetooth IAP mode

* Make default config more like Obins stock default (#30)

* Add new message type for resetting foreground color (#31)

* annepro2(bluetooth): add media keys support (qmk#41)

* Asynchronous, robust serial protocol. (qmk#39)

* bla personal ap2-c18 keymap.

* Bidirectional, asynchronous message-based communication with Shine.

- Requires a matching Shine version.
- Protocol is resiliant to loosing bytes during communication, chips won't lock
  waiting for bytes that aren't coming.
- Chips resynchronize in event of loosing a byte using a AA0D header.

Regressions:
- Key masking/locking doesn't work right now. (did it work before?)
- Not all user keymaps build against it.

* Clang-format + code to ease reducing speed of LED UART.

- Did clang-format --style=file -i on multiple files according to
  coding_conventions_c.md

- Added separate serial speed for IAP boot and Led communication, it's possible
  that reducing this to 9600 helped someone with faulty HW. With this code they
  can do it with simple replacing of a value.

* Main chip can set/clear foreground using a mask mechanism.

- Some preparations for selective colouring.

* Selective mask works - tested on capslock.

- Migrated personal keymaps to new status API.

* Clear the foreground colors to show profile when it's modified.

- Show example of achieving selective caps-lock painting + foreground painting
  for layers.
- annepro2LedMaskSetRow is implemented, but still requires testing.

* Implement the QMK side of led blinking to indicate the command was received.

- This stupidly blinks the key when user presses one of the bluetooth commands
to let the user know that the command was received and forwarded to the BT chip.

- TODO: Row/col key positions are hardcoded and not taken from the keymap.

* Reduce memory footprint.

Applying code review suggestions. Moved msgId to globals - preparing for
transmission without copying payload when no retries are necessary.

Added empty readme.md files - required by QMK lint.

Co-authored-by: Tomasz bla Fortuna <[email protected]>

* Let the LED chip settle a bit before waking it from the bootloader. (qmk#42)

At least for one person that helps to reliably get the LEDs working without
disconnecting/reconnecting the power to the board multiple times.

Co-authored-by: Tomasz bla Fortuna <[email protected]>

* annepro2: rename KEYMAP to LAYOUT, as required by new version of QMK

* annepro2: update ChibiOS configuration files

* annepro2: fix undefined reference to dprint and timer_read32

* annepro2: update ChibiOS MCU name

* update spi driver, fix bad merging with master

* annepro2: add readme and info.json

* annepro2: make code compatible with QMK coding conventions

* tmk_core: temporary fix to allow HT32 based keyboards to work without patched ChibiOS-contrib (AnnePro2)

* AnnePro2: removed core changes

* AnnePro2: Leave only default keymaps

Missing keymaps will be restored in another PR

* annepro2: add licence information

* annepro2: satisfy qmk lint

* annepro2: fix drashna's suggestions

* annepro2: fix matrix

* annepro2: apply code review suggestions

* annepro2: apply remaining code review suggestions

* annepro2: update info.json

* annepro2: remove include

* annepro2: rename keymap to layout

* annepro2: fix typing

* annepro2: apply suggestions from tzarc's code review

Co-authored-by: Nick Brassel <[email protected]>

* annepro2: more fixes

* annepro2: apply suggestions from code review

Co-authored-by: Joel Challis <[email protected]>

* annepro2: rename file

* more fixes

* Apply suggestions from @tzarc code review

Co-authored-by: Nick Brassel <[email protected]>

* Update keyboards/annepro2/protocol.h

Co-authored-by: Nick Brassel <[email protected]>

* Update keyboards/annepro2/chconf.h

Co-authored-by: Nick Brassel <[email protected]>

* apply CR suggestions

* upgrade readme

* IAP

* update IAP comments, defines

* led fix

* init fix

* annepro2: GPIO cleanup

* annepro2: ioline

* change waiting time

* Start develop for 2022q2

* [Core] Squeeze AVR some more with `-mrelax` and `-mcall-prologues` (qmk#16269)

* Rework generate-api CLI command to use .build directory (qmk#16441)

* Remove `send_unicode_hex_string()` (qmk#16518)

* Change data driven "str" type to represent a quoted string literal (qmk#16516)

* Change data driven "str" type to represent a quoted string literal

* Update docs

* Map data driven `DESCRIPTION` as string literal (qmk#16523)

* update bootloader

* Revert "Merge pull request #2 from qmk/develop"

This reverts commit 9c76065, reversing
changes made to 240745d.

* Revert "update bootloader"

This reverts commit 240745d.

* fix rules.mk

* change PROGRAM_CMD

Co-authored-by: codetector <[email protected]>
Co-authored-by: Fagl4 <[email protected]>
Co-authored-by: Jakob Gillich <[email protected]>
Co-authored-by: tech2077 <[email protected]>
Co-authored-by: jcdeA <[email protected]>
Co-authored-by: Thomaz Moura <[email protected]>
Co-authored-by: Darkhan <[email protected]>
Co-authored-by: Paco <[email protected]>
Co-authored-by: jmarmstrong1207 <[email protected]>
Co-authored-by: 1Conan <[email protected]>
Co-authored-by: Tomasz bla Fortuna <[email protected]>
Co-authored-by: Tomasz bla Fortuna <[email protected]>
Co-authored-by: Nick Brassel <[email protected]>
Co-authored-by: Joel Challis <[email protected]>
Co-authored-by: QMK Bot <[email protected]>
Co-authored-by: Stefan Kerkmann <[email protected]>
Co-authored-by: Ryan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants