Fix several problems with data escape handling in hd44780-serial:
1. A bogus address calculation was done (spotted by G. Smith). 2. The displayID was added to the data escape character even if the connection type does not support multiple displays (spotted by G. Smith). 3. When calculation if data escape is necessary, the character 0xff could not be escaped. Changed an updates all connection types (M. Dolze).
This commit is contained in:
@@ -280,9 +280,10 @@ serial_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char f
|
||||
/* Do we need a DATA indicator byte? */
|
||||
if ((SERIAL_IF.data_escape != '\0') &&
|
||||
(((ch >= SERIAL_IF.data_escape_min) &&
|
||||
(ch < SERIAL_IF.data_escape_max)) ||
|
||||
(ch <= SERIAL_IF.data_escape_max)) ||
|
||||
(SERIAL_IF.multiple_displays && displayID != lastdisplayID))) {
|
||||
write(p->fd, &SERIAL_IF.data_escape + displayID, 1);
|
||||
unsigned char esc_ch = SERIAL_IF.data_escape + (SERIAL_IF.multiple_displays) ? displayID : 0;
|
||||
write(p->fd, &esc_ch, 1);
|
||||
}
|
||||
write(p->fd, &ch, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user