Fix some display issues

- Fix LCD line and column positioning (#7387)
- Fix Display handling of hexadecimal escape characters (#7387)
This commit is contained in:
Theo Arends 2020-01-01 15:13:58 +01:00
parent b05301b149
commit 287b3b97f1
5 changed files with 22 additions and 7 deletions

View File

@ -58,6 +58,8 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
- Fix Sonoff Bridge, Sc, L1, iFan03 and CSE7766 serial interface to forced speed, config and disable logging
- Fix commands ``Display`` and ``Counter`` from overruling command processing (#7322)
- Fix ``White`` added to light status (#7142)
- Fix LCD line and column positioning (#7387)
- Fix Display handling of hexadecimal escape characters (#7387)
- Add command ``SetOption79 0/1`` to enable reset of counters at teleperiod time by Andre Thomas (#7355)
- Add SerialConfig to ``Status 1``
- Add WifiPower to ``Status 5``

View File

@ -3,6 +3,8 @@
### 8.1.0.2 20191230
- Add support for ``AdcParam`` parameters to control ADC0 Current Transformer Apparent Power formula by Jodi Dillon (#7100)
- Fix LCD line and column positioning (#7387)
- Fix Display handling of hexadecimal escape characters (#7387)
### 8.1.0.1 20191225

View File

@ -328,7 +328,8 @@ uint8_t index=0;
#define ESCAPE_CHAR '~'
// decode text escapes, 1 hexbyte assumed
void decode_te(char *line) {
uint32_t decode_te(char *line) {
uint32_t skip = 0;
char sbuf[3],*cp;
while (*line) {
if (*line==ESCAPE_CHAR) {
@ -336,11 +337,12 @@ void decode_te(char *line) {
if (*cp!=0 && *cp==ESCAPE_CHAR) {
// escape escape, discard one
memmove(cp,cp+1,strlen(cp));
skip++;
} else {
// escape HH
if (strlen(cp)<2) {
// illegal lenght, ignore
return;
return skip;
}
// take 2 hex chars
sbuf[0]=*(cp);
@ -349,10 +351,12 @@ void decode_te(char *line) {
*line=strtol(sbuf,0,16);
// must shift string 2 bytes shift zero also
memmove(cp,cp+2,strlen(cp)-1);
skip += 2;
}
}
line++;
}
return skip;
}
/*-------------------------------------------------------------------------------------------*/
@ -829,10 +833,13 @@ void DisplayText(void)
}
exit:
// now draw buffer
decode_te(linebuf);
dp -= decode_te(linebuf);
if ((uint32_t)dp - (uint32_t)linebuf) {
if (!fill) *dp = 0;
else linebuf[abs(fill)] = 0;
if (!fill) {
*dp = 0;
} else {
linebuf[abs(fill)] = 0;
}
if (fill<0) {
// right align
alignright(linebuf);
@ -1276,7 +1283,7 @@ void DisplaySetPower(void)
{
disp_power = bitRead(XdrvMailbox.index, disp_device -1);
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DSP: Power %d"), disp_power);
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DSP: Power %d"), disp_power);
if (Settings.display_model) {
if (!renderer) {

View File

@ -85,6 +85,10 @@ void LcdInitDriver(void)
void LcdDrawStringAt(void)
{
if (dsp_flag) { // Supply Line and Column starting with Line 1 and Column 1
dsp_x--;
dsp_y--;
}
lcd->setCursor(dsp_x, dsp_y);
lcd->print(dsp_str);
}

View File

@ -3,7 +3,7 @@
"""
decode-status.py - decode status for Tasmota
Copyright (C) 2019 Theo Arends
Copyright (C) 2020 Theo Arends
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by