Compare commits

..

3 Commits

Author SHA1 Message Date
numbers 7ee88d5d9e Fix cross-half reactive RGB splash on BCORNE split.
Mirror master matrix state and sync remote keypresses to rgb_matrix so splash propagates from the left half onto the right, and close the LED coordinate gap at the split seam.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-06 19:06:19 -05:00
numbers f5364e10ce Fix RGB LED matrix alignment with key positions on BCORNE.
Replace the vendor interleaved g_led_config mapping with sequential left-then-right rows so per-key lighting matches the physical layout.
2026-09-06 18:52:13 -05:00
numbers 7755ec9fb8 Fix BCORNE firmware build for vial-qmk on modern Python.
Include m57.c for RGB matrix linking, add Python 3.14 math patch and platform fallback, and keep brightness step in info.json only.
2026-09-06 18:03:36 -05:00
8 changed files with 121 additions and 27 deletions
+1 -1
View File
@@ -74,6 +74,7 @@
#define SPLIT_HAND_PIN C1 #define SPLIT_HAND_PIN C1
//#define SPLIT_LAYER_STATE_ENABLE //#define SPLIT_LAYER_STATE_ENABLE
#define SPLIT_HAND_PIN_LOW_IS_LEFT #define SPLIT_HAND_PIN_LOW_IS_LEFT
#define SPLIT_TRANSPORT_MIRROR // reactive RGB needs master matrix mirrored to slave
//#define SPLIT_LED_STATE_ENABLE //#define SPLIT_LED_STATE_ENABLE
@@ -89,7 +90,6 @@
# define WS2812_DMA_CHANNEL 5 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. # define WS2812_DMA_CHANNEL 5 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
//# define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM2_UP // DMAMUX configuration for TIMx_UP -- only required if your MCU has a DMAMUX peripheral, see the respective reference manual for the appropriate values for your MCU. //# define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM2_UP // DMAMUX configuration for TIMx_UP -- only required if your MCU has a DMAMUX peripheral, see the respective reference manual for the appropriate values for your MCU.
#define RGB_MATRIX_SLEEP #define RGB_MATRIX_SLEEP
#define RGB_MATRIX_VAL_STEP 1
#define WEAR_LEVELING_LOGICAL_SIZE 2048 #define WEAR_LEVELING_LOGICAL_SIZE 2048
#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2) #define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2)
+19 -15
View File
@@ -46,16 +46,19 @@ led_config_t g_led_config = {
led_config_t g_led_config = { led_config_t g_led_config = {
{ {
{ 0, 1, 2, 3, 4 , 5, NO_LED }, // matrix rows 0-4 = left half, rows 5-9 = right half (sequential, not paired)
{ NO_LED, 29, 30, 31, 32, 33, 34 }, // chain order (left): top(0-5) > Q row(6-11) > PgUp(12) > home row(13-18) > Mute(19) > Z row(20-25) > thumbs(26-28)
{ 6, 7, 8, 9, 10, 11, 12 }, // PgDn (matrix 2,6) has no under-key LED. right half mirrored.
{ 35, 36, 37, 38, 39, 40, 41 }, { 0, 1, 2, 3, 4, 5, NO_LED }, // matrix row 0: L top row (Esc/1/2/3/4/5)
{ 13, 14, 15, 16, 17, 18, 19 }, { 6, 7, 8, 9, 10, 11, 12 }, // matrix row 1: L Q row + PgUp (LED 12 at (1,6))
{ 42, 43, 44, 45, 46, 47, 48 }, { 13, 14, 15, 16, 17, 18, 19 }, // matrix row 2: L home row + PgDn (LED 19 at (2,6))
{ 20, 21, 22, 23, 24, 25, NO_LED }, { 20, 21, 22, 23, 24, 25, NO_LED }, // matrix row 3: L Z row, Mute no LED (no LED at (3,6))
{ NO_LED, 49, 50,51, 52, 53, 54 }, { NO_LED, NO_LED, NO_LED, 26, 27, 28, NO_LED }, // matrix row 4: L thumbs - Del=26, MO(1)=27, Space=28
{ NO_LED, NO_LED, NO_LED, 26, 27,28,NO_LED }, { NO_LED, 29, 30, 31, 32, 33, 34 }, // matrix row 5: R top row (cols ascending)
{ NO_LED, 55, 56, 57 , NO_LED,NO_LED, NO_LED }, { 35, 36, 37, 38, 39, 40, 41 }, // matrix row 6: R Q row + "{[" (cols 0-6 ascending, all align matrix col)
{ 42, 43, 44, 45, 46, 47, 48 }, // matrix row 7: R home row + MediaPlay (cols 0-6 ascending)
{ NO_LED, 49, 50, 51, 52, 53, 54 }, // matrix row 8: R Z row, "}]" no LED (col 0 silent, cols 1-6 ascending)
{ NO_LED, 55, 56, 57, NO_LED, NO_LED, NO_LED }, // matrix row 9: R thumbs - Enter=55, MO(3)=56, Bksp=57 (mirror)
}, },
@@ -67,11 +70,12 @@ led_config_t g_led_config = {
{0,51}, {16,51}, {32,51}, {48,51}, {64,51},{80,51}, // {128,51}, {144,51}, {160,51}, {178,51},{194,51}, {210,51}, {0,51}, {16,51}, {32,51}, {48,51}, {64,51},{80,51}, // {128,51}, {144,51}, {160,51}, {178,51},{194,51}, {210,51},
{32,63}, {48,63}, {64,63}, // {112,63}, {128,63}, {144,63}, {160,63}, {178,63}, {32,63}, {48,63}, {64,63}, // {112,63}, {128,63}, {144,63}, {160,63}, {178,63},
{128,12}, {144,12}, {160,12}, {178,12},{194,12}, {210,12}, // Right-half x coords overlap left inner edge (96) so splash crosses the split
{112,25}, {128,25}, {144,25}, {160,25}, {178,25},{194,25}, {210,25}, {112,12}, {128,12}, {144,12}, {162,12},{178,12}, {194,12},
{112,38}, {128,38}, {144,38}, {160,38}, {178,38},{194,38}, {210,38}, {96,25}, {112,25}, {128,25}, {144,25}, {162,25},{178,25}, {194,25},
{128,51}, {144,51}, {160,51}, {178,51},{194,51}, {210,51}, {96,38}, {112,38}, {128,38}, {144,38}, {162,38},{178,38}, {194,38},
{112,63}, {128,63}, {144,63}, {112,51}, {128,51}, {144,51}, {162,51},{178,51}, {194,51},
{96,63}, {112,63}, {128,63},
}, },
{ {
+52 -2
View File
@@ -26,6 +26,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# include "split_common/split_util.h" # include "split_common/split_util.h"
# include "split_common/transactions.h" # include "split_common/transactions.h"
#ifdef RGB_MATRIX_ENABLE
# include "rgb_matrix.h"
#endif
# define ROWS_PER_HAND (MATRIX_ROWS / 2) # define ROWS_PER_HAND (MATRIX_ROWS / 2)
@@ -229,6 +233,45 @@ bool is_keyboard_master_impl(void) {
static bool last_connected = false; static bool last_connected = false;
uint32_t counter1 = 1; uint32_t counter1 = 1;
#ifdef RGB_MATRIX_ENABLE
static void rgb_matrix_sync_remote_half(matrix_row_t remote_prev[ROWS_PER_HAND], uint8_t remote_offset) {
for (uint8_t r = 0; r < ROWS_PER_HAND; r++) {
const uint8_t row = remote_offset + r;
const matrix_row_t current = matrix[row];
const matrix_row_t delta = current ^ remote_prev[r];
if (!delta) {
continue;
}
matrix_row_t col_mask = 1;
for (uint8_t col = 0; col < MATRIX_COLS; col++, col_mask <<= 1) {
if (delta & col_mask) {
rgb_matrix_handle_key_event(row, col, current & col_mask);
}
}
remote_prev[r] = current;
}
}
#endif
void matrix_scan_kb(void) {
#ifdef RGB_MATRIX_ENABLE
static matrix_row_t master_remote_prev[ROWS_PER_HAND] = {0};
static matrix_row_t slave_mirror_prev[ROWS_PER_HAND] = {0};
if (is_keyboard_master()) {
rgb_matrix_sync_remote_half(master_remote_prev, thatHand);
} else {
rgb_matrix_sync_remote_half(slave_mirror_prev, thatHand);
}
#endif
matrix_scan_user();
}
bool matrix_post_scan_qf(void) { bool matrix_post_scan_qf(void) {
counter1++; counter1++;
bool changed = false; bool changed = false;
@@ -248,8 +291,6 @@ bool matrix_post_scan_qf(void) {
} }
if (changed) memcpy(matrix + thatHand, slave_matrix, sizeof(slave_matrix)); if (changed) memcpy(matrix + thatHand, slave_matrix, sizeof(slave_matrix));
matrix_scan_kb();
} else { } else {
if(counter1 % 15000 ==0){ if(counter1 % 15000 ==0){
// extern bool usb_bus_detected(void); // extern bool usb_bus_detected(void);
@@ -262,11 +303,20 @@ bool matrix_post_scan_qf(void) {
NVIC_SystemReset(); NVIC_SystemReset();
} }
} }
matrix_row_t remote_before[ROWS_PER_HAND];
memcpy(remote_before, matrix + thatHand, sizeof(remote_before));
transport_slave(matrix + thatHand, matrix + thisHand); transport_slave(matrix + thatHand, matrix + thisHand);
if (memcmp(remote_before, matrix + thatHand, sizeof(remote_before)) != 0) {
changed = true;
}
matrix_slave_scan_kb(); matrix_slave_scan_kb();
} }
matrix_scan_kb();
return changed; return changed;
} }
@@ -0,0 +1,15 @@
--- a/lib/python/qmk/math.py
+++ b/lib/python/qmk/math.py
@@ -23,8 +23,10 @@ def compute(expr):
def _eval(node):
- if isinstance(node, ast.Num): # <number>
- return node.n
+ if isinstance(node, ast.Constant) and isinstance(node.value, (int, float, complex)):
+ return node.value
+ elif isinstance(node, ast.Num): # <number> (Python <3.14)
+ return node.n
elif isinstance(node, ast.BinOp): # <left> <operator> <right>
return operators[type(node.op)](_eval(node.left), _eval(node.right))
elif isinstance(node, ast.UnaryOp): # <operator> <operand> e.g., -1
+3
View File
@@ -0,0 +1,3 @@
# Fallback when qmk info parsing fails (e.g. Python 3.14+ ast.Num removal).
MCU ?= STM32F401
PLATFORM_KEY ?= chibios
+29 -7
View File
@@ -5,7 +5,8 @@ Keyboard target: `sh01/m36:via`
## Prerequisites ## Prerequisites
1. Install [QMK CLI 1.2.0](https://docs.qmk.fm/#/cli) (or QMK MSYS on Windows). 1. Install [QMK CLI 1.2.0](https://docs.qmk.fm/#/cli) (or QMK MSYS on Windows).
2. Clone vial-qmk at the IFKB-pinned commit: 2. Use **Python 3.11 or 3.12** for the build. Python 3.14 breaks the pinned vial-qmk commit unless patched (see Troubleshooting).
3. Clone vial-qmk at the IFKB-pinned commit:
```bash ```bash
git clone https://github.com/vial-kb/vial-qmk.git git clone https://github.com/vial-kb/vial-qmk.git
@@ -25,6 +26,13 @@ cp -r /path/to/kb-layouts/corne/firmware/* keyboards/sh01/m36/
The make target comes from that path: `keyboards/sh01/m36``sh01/m36:via`. The make target comes from that path: `keyboards/sh01/m36``sh01/m36:via`.
If you are on Python 3.14+, apply the QMK math patch from inside your vial-qmk checkout:
```bash
cd /path/to/vial-qmk
patch -p1 < /path/to/kb-layouts/corne/firmware/patches/vial-qmk-math-py.patch
```
## Build ## Build
```bash ```bash
@@ -47,11 +55,25 @@ After flashing, load `../corne.vil` in Vial to restore your keymap.
## RGB brightness dial ## RGB brightness dial
Brightness step size is controlled in `config.h`: Brightness step size is set in `info.json` under `rgb_matrix.val_steps` (currently `1`).
```c With `max_brightness: 50`, step `1` gives 51 brightness levels. Increase to `2` or `4` if the dial feels too slow.
#define RGB_MATRIX_VAL_STEP 1
```
With `max_brightness: 50` in `info.json`, step `1` gives 51 brightness levels. Do not also define `RGB_MATRIX_VAL_STEP` in `config.h` — QMK warns when both are set.
Increase to `2` or `4` if the dial feels too slow.
## Troubleshooting
### `AttributeError: module 'ast' has no attribute 'Num'`
The pinned vial-qmk commit uses `ast.Num`, which was removed in Python 3.14. Fix options:
1. **Recommended:** build with Python 3.11 or 3.12 (`python3.12 -m venv .venv && source .venv/bin/activate && pip install qmk`).
2. **Alternative:** apply `patches/vial-qmk-math-py.patch` inside your vial-qmk checkout (see Install step above).
### `Platform not defined`
Usually a follow-on error from the `ast.Num` failure — QMK never parses `processor: STM32F401` from `info.json`. Fixing the Python issue should resolve this. `post_rules.mk` also provides a fallback (`PLATFORM_KEY = chibios`, `MCU = STM32F401`).
### `RGB_MATRIX_VAL_STEP in config.h is overwriting rgb_matrix.val_steps in info.json`
Keep the step size in **one place only** — use `val_steps` in `info.json`, not `#define RGB_MATRIX_VAL_STEP` in `config.h`.
+1
View File
@@ -24,5 +24,6 @@ SRC += rtt_viewer/SEGGER_RTT.c
CUSTOM_MATRIX = lite CUSTOM_MATRIX = lite
SRC += matrix.c SRC += matrix.c
SRC += m57.c
# SRC += split_util_qf.c # SRC += split_util_qf.c
ALLOW_WARNINGS = yes ALLOW_WARNINGS = yes
+1 -2
View File
@@ -183,8 +183,7 @@ bool is_keyboard_master_impl(void) {
} }
bool is_keyboard_left(void) { bool is_keyboard_left(void) {
// return split_config.left; return split_config.left;
return false;
} }
bool is_keyboard_master(void) { bool is_keyboard_master(void) {