Skip to content

Commit

Permalink
[LCD4linux] v5.0-r25 bugfix for AX206 displays
Browse files Browse the repository at this point in the history
- bugfixed troubles with AX206 displays

HINT: **LCD4linux** is still working under Python2 and Python3
  • Loading branch information
MrServo authored and Hains committed Feb 7, 2025
1 parent 046bcde commit 891216e
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions lcd4linux/src/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2886,31 +2886,32 @@ def getResolution(t, r):
if int(LCD4linux.xmlOffset.value) != 0:
MAX_W -= (int(LCD4linux.xmlOffset.value) * 2)
MAX_H -= (int(LCD4linux.xmlOffset.value) * 2)
elif t.endswith("1"):
# ATTENTION: must not be changed to 'endswith()' under any circumstances
elif t[1:] == "1":
MAX_W, MAX_H = 320, 240
elif t.endswith("2"):
elif t[1:] == "2":
MAX_W, MAX_H = 240, 320
elif t[1:] in ["3", "4", "5", "10", "15"]:
MAX_W, MAX_H = 800, 480
elif t[1:] in ["6", "9", "11", "12"]:
MAX_W, MAX_H = 800, 600
elif t[1:] in ["7", "8", "13", "14"]:
MAX_W, MAX_H = 1024, 600
elif t.endswith("17"):
elif t[1:] == "17":
MAX_W, MAX_H = 220, 176
elif t.endswith("18"):
elif t[1:] == "18":
MAX_W, MAX_H = 255, 64
elif t.endswith("22"):
elif t[1:] == "22":
MAX_W, MAX_H = 480, 320
elif t.endswith("23"):
elif t[1:] == "23":
MAX_W, MAX_H = 800, 480
elif t.endswith("30"):
elif t[1:] == "30":
MAX_W, MAX_H = 400, 240
elif t == "320":
MAX_W, MAX_H = LCD4linux.SizeW.value, LCD4linux.SizeH.value
elif t == "420":
MAX_W, MAX_H = LCD4linux.SizeW2.value, LCD4linux.SizeH2.value
elif t.endswith("21"):
elif t[1:] == "21":
MAX_W, MAX_H = 128, 128
else:
MAX_W, MAX_H = 132, 64
Expand Down Expand Up @@ -9506,14 +9507,14 @@ def rcKeyPressed(self, key, flag):
self.restartTimer()
if LCD4linux.KeySwitch.value == True:
if flag == 3:
if LCD4linux.KeyScreen.value.endswith("1") and key == self.k:
if LCD4linux.KeyScreen.value[-1:] == "1" and key == self.k:
ScreenTime = 9999
L4logE("Restart at Scr-longkey")
NextScreen(True)
LCD4linux.ScreenActive.value = ScreenActive[0]
self.Refresh = "1"
self.restartTimer()
elif LCD4linux.KeyOff.value.endswith("1") and key == self.ko:
elif LCD4linux.KeyOff.value[-1:] == "1" and key == self.ko:
LCDon = True if LCDon == False else False
L4logE("Restart at Off-longkey")
self.Refresh = "1"
Expand All @@ -9524,12 +9525,12 @@ def rcKeyPressed(self, key, flag):
self.KeyTime = time()
if self.KeyDoppel == key and flag == 0:
self.KeyDoppel = 0
if not LCD4linux.KeyOff.value.endswith("1") and key == self.ko: # PREVIOUS
if LCD4linux.KeyOff.value[-1:] != "1" and key == self.ko: # PREVIOUS
LCDon = True if LCDon == False else False
L4logE("Restart at Off-doublekey %s" % key)
self.Refresh = "1"
self.restartTimer()
elif not LCD4linux.KeyScreen.value.endswith("1") and key == self.k: # FORWARD / INFO
elif LCD4linux.KeyScreen.value[-1:] != "1" and key == self.k: # FORWARD / INFO
ScreenTime = 9999
NextScreen(True)
LCD4linux.ScreenActive.value = ScreenActive[0]
Expand Down Expand Up @@ -12295,9 +12296,9 @@ def putProgress(workaround, draw, im):
POSX = getSplit(ConfigSplit, ConfigAlign, MAX_W, ProgressBar)
if self.LsreftoString is not None:
Minutes, Prozent = (" min", " %") if ConfigMinutes else ("", "")
if ConfigType.endswith("1"):
if ConfigType[1:] == "1":
ms = 1.5
elif ConfigType.endswith("2"):
elif ConfigType[1:] == "2":
ms = 2
else:
ms = 1
Expand Down Expand Up @@ -12663,7 +12664,7 @@ def putSat(workaround, draw, im):
x = int(float(CS) / yy * xx)
imW = imW.resize((x, CS))
POSX = getSplit(ConfigSplit, ConfigAlign, MAX_W, x)
if ConfigType.endswith("A"):
if ConfigType[1:] == "A":
ShadowText(draw, POSX, ConfigPos + int(ConfigSize / 4), Code_utf8(orbital), font, ConfigColor, ConfigShadow)
POSX += w
if str(LCD4linux.PiconTransparenz.value) == "2":
Expand All @@ -12673,9 +12674,9 @@ def putSat(workaround, draw, im):
self.im[im].paste(imW, (POSX, ConfigPos))
if not PY3: # correction for Python 2
POSX += x
if ConfigType.endswith("C"):
if ConfigType[1:] == "C":
ShadowText(draw, POSX, ConfigPos + int(ConfigSize / 4), Code_utf8(orbital), font, ConfigColor, ConfigShadow)
if ConfigType.endswith("B"):
if ConfigType[1:] == "B":
ShadowText(draw, POSX - int((x - w) / 2), ConfigPos + CS, Code_utf8(orbital), font, ConfigColor, ConfigShadow)
except Exception:
pass
Expand Down Expand Up @@ -13717,7 +13718,7 @@ def putMail(workaround, draw, im):
font = ImageFont.truetype(ConfigFont, ConfigSize, encoding='unic')
c = int(ConfigSize / 4)
for M in PopMail[CP]:
if i >= int(ConfigLines) or (ConfigType.endswith("2") and M[2] == PopMailUid[CP][0]):
if i >= int(ConfigLines) or (ConfigType[1:] == "2" and M[2] == PopMailUid[CP][0]):
break
i += 1
self.draw[draw].ellipse((POSX, POSY + int(ConfigSize / 2) - c, POSX + (2 * c), POSY + int(ConfigSize / 2) + c), fill=ConfigColor)
Expand Down Expand Up @@ -14078,7 +14079,7 @@ def putNetatmoIllu(workaround, draw, im):
staerke = staerkeVal2
dis_reason = Code_utf8(self.dis_reason[ConfigStation])
if ConfigType.startswith("0"):
if ConfigType.endswith("9"):
if ConfigType[1:] == "9":
S = 1.5 if ConfigSize <= 10 else 1.0
ZW = str(staerkeValOrg) # Value
font = ImageFont.truetype(FONT, int(ConfigSize * S), encoding='unic')
Expand All @@ -14105,7 +14106,7 @@ def putNetatmoIllu(workaround, draw, im):
except Exception:
L4log("Error Knob")
L4log("Error:", format_exc())
if ConfigType.endswith("9"):
if ConfigType[1:] == "9":
ZW = str(int(staerkeValOrg))
font = ImageFont.truetype(FONT, int(ConfigSize / 3), encoding='unic')
w, h = getFsize(ZW, font)
Expand Down

0 comments on commit 891216e

Please sign in to comment.