clear LED values before initializing matrix

programs are rendered after LEDs are sent. this means the first update would be garbage. initialize the data so this is not the case.

also fix bug with current scaling register fill function (doesn't affect this program).
This commit is contained in:
true 2024-08-04 19:41:11 -07:00
parent 8cdc122363
commit 9d00b8daa1
2 changed files with 10 additions and 1 deletions

View File

@ -54,7 +54,7 @@ uint8_t is31fl3729_get_addr(uint8_t adpin)
void is31fl3729_set_scaling_current_multi(uint8_t i2c_addr, const uint8_t *current, uint8_t count)
{
if (!count) return;
count &= 0xf;
if (count > 16) count = 16;
i2c_write_addr1b(i2c_addr, FL3729_REG_SCALING, current, count);
}

View File

@ -47,6 +47,15 @@ void led_init()
uint8_t i;
uint8_t buf[FL3729_CS_OUTPUTS] = {0xff};
// reset LEDs
for (i = 0; i < 9; i++) {
rgb[i][0] = 0;
rgb[i][1] = 0;
rgb[i][2] = 0;
}
cursor[0] = cursor[1] = cursor[2] = 0;
// configure matrix
is31fl3729_init(FL3729_ADDR,
FL3729_CONF_SSD_NRML | FL3729_CONF_OSDE_OFF | FL3729_CONF_MATRIX_2x16,
LED_INIT_CURRENT);