diff --git a/avr/modules/sk6812/main.asm b/avr/modules/sk6812/main.asm index 5ee3061..4577516 100644 --- a/avr/modules/sk6812/main.asm +++ b/avr/modules/sk6812/main.asm @@ -432,8 +432,10 @@ sk6812WriteConfToEeprom: push r15 in r15, SREG cli + ldi xl, LOW(EEPROM_OFFS_SK6812_RGBW) ldi xh, HIGH(EEPROM_OFFS_SK6812_RGBW) + lds r16, sk6812RGBW rcall Eeprom_WriteByteIfChanged ; (R17) adiw xh:xl, 1 @@ -445,6 +447,10 @@ sk6812WriteConfToEeprom: adiw xh:xl, 1 lds r16, sk6812RGBW+3 rcall Eeprom_WriteByteIfChanged ; (R17) + adiw xh:xl, 1 + lds r16, sk6812Type + rcall Eeprom_WriteByteIfChanged ; (R17) + out SREG, r15 pop r15 ret @@ -481,7 +487,16 @@ sk6812ReadConfFromEeprom: rcall Eeprom_ReadByte brcc sk6812ReadConfFromEeprom_default mov r21, r16 - + adiw xh:xl, 1 + + ; read type + rcall Eeprom_ReadByte + brcc sk6812ReadConfFromEeprom_default + cpi r16, SK6812_TYPE_NUM + brcc sk6812ReadConfFromEeprom_checkColor + sts sk6812Type, r16 + +sk6812ReadConfFromEeprom_checkColor: mov r16, r18 and r16, r19 and r16, r20