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>
This commit is contained in:
@@ -74,6 +74,7 @@
|
||||
#define SPLIT_HAND_PIN C1
|
||||
//#define SPLIT_LAYER_STATE_ENABLE
|
||||
#define SPLIT_HAND_PIN_LOW_IS_LEFT
|
||||
#define SPLIT_TRANSPORT_MIRROR // reactive RGB needs master matrix mirrored to slave
|
||||
|
||||
|
||||
//#define SPLIT_LED_STATE_ENABLE
|
||||
|
||||
@@ -70,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},
|
||||
{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},
|
||||
{112,25}, {128,25}, {144,25}, {160,25}, {178,25},{194,25}, {210,25},
|
||||
{112,38}, {128,38}, {144,38}, {160,38}, {178,38},{194,38}, {210,38},
|
||||
{128,51}, {144,51}, {160,51}, {178,51},{194,51}, {210,51},
|
||||
{112,63}, {128,63}, {144,63},
|
||||
// Right-half x coords overlap left inner edge (96) so splash crosses the split
|
||||
{112,12}, {128,12}, {144,12}, {162,12},{178,12}, {194,12},
|
||||
{96,25}, {112,25}, {128,25}, {144,25}, {162,25},{178,25}, {194,25},
|
||||
{96,38}, {112,38}, {128,38}, {144,38}, {162,38},{178,38}, {194,38},
|
||||
{112,51}, {128,51}, {144,51}, {162,51},{178,51}, {194,51},
|
||||
{96,63}, {112,63}, {128,63},
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
+52
-2
@@ -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/transactions.h"
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
# include "rgb_matrix.h"
|
||||
#endif
|
||||
|
||||
# define ROWS_PER_HAND (MATRIX_ROWS / 2)
|
||||
|
||||
|
||||
@@ -229,6 +233,45 @@ bool is_keyboard_master_impl(void) {
|
||||
|
||||
static bool last_connected = false;
|
||||
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) {
|
||||
counter1++;
|
||||
bool changed = false;
|
||||
@@ -248,8 +291,6 @@ bool matrix_post_scan_qf(void) {
|
||||
}
|
||||
|
||||
if (changed) memcpy(matrix + thatHand, slave_matrix, sizeof(slave_matrix));
|
||||
|
||||
matrix_scan_kb();
|
||||
} else {
|
||||
if(counter1 % 15000 ==0){
|
||||
// extern bool usb_bus_detected(void);
|
||||
@@ -262,11 +303,20 @@ bool matrix_post_scan_qf(void) {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
}
|
||||
matrix_row_t remote_before[ROWS_PER_HAND];
|
||||
memcpy(remote_before, matrix + thatHand, sizeof(remote_before));
|
||||
|
||||
transport_slave(matrix + thatHand, matrix + thisHand);
|
||||
|
||||
if (memcmp(remote_before, matrix + thatHand, sizeof(remote_before)) != 0) {
|
||||
changed = true;
|
||||
}
|
||||
|
||||
matrix_slave_scan_kb();
|
||||
}
|
||||
|
||||
matrix_scan_kb();
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
@@ -183,8 +183,7 @@ bool is_keyboard_master_impl(void) {
|
||||
}
|
||||
|
||||
bool is_keyboard_left(void) {
|
||||
// return split_config.left;
|
||||
return false;
|
||||
return split_config.left;
|
||||
}
|
||||
|
||||
bool is_keyboard_master(void) {
|
||||
|
||||
Reference in New Issue
Block a user