Skip to content

Commit

Permalink
Add OLED clearline
Browse files Browse the repository at this point in the history
  • Loading branch information
enesbcs committed Jan 30, 2019
1 parent 9db3881 commit 5af2fe7
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion _P023_OLED.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#
# Available commands:
# OLEDCMD,<value> - value can be: on, off, clear, low, med, high
# OLEDCMD,clearline,<row> - clears selected <row>
# OLED,<row>,<col>,<text> - write text message to OLED screen at the requested position
#
# Copyright (C) 2018-2019 by Alexander Nagy - https://bitekmindenhol.blog.hu/
Expand All @@ -24,7 +25,7 @@

class Plugin(plugin.PluginProto):
PLUGIN_ID = 23
PLUGIN_NAME = "Display - Simple OLED (TESTING)"
PLUGIN_NAME = "Display - Simple OLED"
PLUGIN_VALUENAME1 = "OLED"
P23_Nlines = 8

Expand Down Expand Up @@ -331,6 +332,20 @@ def plugin_write(self,cmd):
self.device.clear()
self.dispimage = Image.new('1', (self.device.width,self.device.height), "black")
res = True
elif cmd == "clearline":
try:
l = int(cmdarr[2].strip())
except Exception as e:
misc.addLog(rpieGlobals.LOG_LEVEL_ERROR,"Parameter error: "+str(e))
return False
if self.device is not None and self.dispimage is not None:
if l>0:
l-=1
draw = ImageDraw.Draw(self.dispimage)
y = (l*self.lineheight)
draw.rectangle( ((0,y+2), (self.device.width,y+self.lineheight)), fill="black")
self.device.display(self.dispimage)
res = True
if cmd == "low":
self.device.contrast(64)
res = True
Expand Down

0 comments on commit 5af2fe7

Please sign in to comment.