From 9c4424ae2cd86002cd2f4140eff7108212ef884e Mon Sep 17 00:00:00 2001 From: Len Trigg Date: Sat, 16 Mar 2019 09:46:49 +1300 Subject: rgblight split transfer non-eeprom config (#5396) * Make rgblight_update_dword not update eeprom (we already have eeconfig_update_rgblight for that). Make split i2c keyboards transfer active rgblight config rather than eeprom saved version of rgblight config, enabling runtime changes that aren't persisted to eeprom. * prev_level and prev_rgb only store successfully transmitted values --- quantum/split_common/transport.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'quantum/split_common') diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c index b16852bc1..3696a2aba 100644 --- a/quantum/split_common/transport.c +++ b/quantum/split_common/transport.c @@ -39,17 +39,19 @@ bool transport_master(matrix_row_t matrix[]) { static uint8_t prev_level = ~0; uint8_t level = get_backlight_level(); if (level != prev_level) { - i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_BACKLIT_START, (void *)&level, sizeof(level), TIMEOUT); - prev_level = level; + if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_BACKLIT_START, (void *)&level, sizeof(level), TIMEOUT) >= 0) { + prev_level = level; + } } # endif # ifdef RGBLIGHT_ENABLE static uint32_t prev_rgb = ~0; - uint32_t rgb = eeconfig_read_rgblight(); + uint32_t rgb = rgblight_read_dword(); if (rgb != prev_rgb) { - i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_START, (void *)&rgb, sizeof(rgb), TIMEOUT); - prev_rgb = rgb; + if (i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_START, (void *)&rgb, sizeof(rgb), TIMEOUT) >= 0) { + prev_rgb = rgb; + } } # endif -- cgit v1.2.3-24-g4f1b