Fix wrong character sent when potentially unused slot is replaced
This commit is contained in:
parent
7e88e49b4e
commit
d53ba0eba2
|
|
@ -886,7 +886,6 @@ static void lcd_print_custom(uint8_t c) {
|
||||||
} else if (lcd_custom_characters[i] == 0x7F) { //found an empty slot. create a new custom character and send it
|
} else if (lcd_custom_characters[i] == 0x7F) { //found an empty slot. create a new custom character and send it
|
||||||
lcd_custom_characters[i] = c; // mark the custom character as used
|
lcd_custom_characters[i] = c; // mark the custom character as used
|
||||||
slotToUse = i;
|
slotToUse = i;
|
||||||
charToSend = i;
|
|
||||||
goto createChar;
|
goto createChar;
|
||||||
} else if (!(lcd_custom_characters[i] & 0x80)) { // found potentially unused slot. Remember it in case it's needed
|
} else if (!(lcd_custom_characters[i] & 0x80)) { // found potentially unused slot. Remember it in case it's needed
|
||||||
slotToUse = i;
|
slotToUse = i;
|
||||||
|
|
@ -897,10 +896,18 @@ static void lcd_print_custom(uint8_t c) {
|
||||||
// If there exists any potentially unused slot, then use that one instead.
|
// If there exists any potentially unused slot, then use that one instead.
|
||||||
// Otherwise, use the alternate form of the character.
|
// Otherwise, use the alternate form of the character.
|
||||||
if (slotToUse < 0) {
|
if (slotToUse < 0) {
|
||||||
|
#ifdef DEBUG_CUSTOM_CHARACTERS
|
||||||
|
printf_P(PSTR("used alternate for char %02x\n"), c);
|
||||||
|
#endif // DEBUG_CUSTOM_CHARACTERS
|
||||||
goto sendChar;
|
goto sendChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_CUSTOM_CHARACTERS
|
||||||
|
printf_P(PSTR("replaced char %02x at slot %u\n"), lcd_custom_characters[slotToUse], slotToUse);
|
||||||
|
#endif // DEBUG_CUSTOM_CHARACTERS
|
||||||
|
|
||||||
createChar:
|
createChar:
|
||||||
|
charToSend = slotToUse;
|
||||||
lcd_createChar_P(slotToUse, &Font[c - 0x80]);
|
lcd_createChar_P(slotToUse, &Font[c - 0x80]);
|
||||||
#ifdef DEBUG_CUSTOM_CHARACTERS
|
#ifdef DEBUG_CUSTOM_CHARACTERS
|
||||||
printf_P(PSTR("created char %02x at slot %u\n"), c, slotToUse);
|
printf_P(PSTR("created char %02x at slot %u\n"), c, slotToUse);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue