Skip to content

Commit df0506e

Browse files
committed
b1display: screensaver in readme and control.py
Signed-off-by: Daniel Schaefer <[email protected]>
1 parent 9443b5e commit df0506e

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

b1display/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ It's 4.2 inches in size and mounted in portrait orientation.
55
Because it's optimized for power, the recommended framerate is 1 FPS.
66
But it can go up to 32 FPS.
77

8+
The current panel is susceptible to image retention, so the display will start
9+
up with the screen saver. If you send a command to draw anything on the display,
10+
the screensaver will exit.
11+
Currently it does not re-appear after a timeout, it will only re-appear on the
12+
next power-on or after waking from sleep.
13+
814
## Controlling
915

1016
### Display System Status
@@ -56,6 +62,8 @@ Options:
5662
Display a simple pattern [possible values: white, black]
5763
--invert-screen [<INVERT_SCREEN>]
5864
Invert screen on/off [possible values: true, false]
65+
--screen-saver [<SCREEN_SAVER>]
66+
Screensaver on/off [possible values: true, false]
5967
--image-bw <IMAGE_BW>
6068
Display black&white image (300x400px)
6169
--clear-ram

control.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ class CommandVals(IntEnum):
3939
InvertScreen = 0x15
4040
SetPixelColumn = 0x16
4141
FlushFramebuffer = 0x17
42+
ClearRam = 0x18
43+
ScreenSaver = 0x19
4244
Version = 0x20
4345

4446

@@ -192,6 +194,8 @@ def main():
192194
action=argparse.BooleanOptionalAction)
193195
parser.add_argument("--invert-screen", help="Invert display",
194196
action=argparse.BooleanOptionalAction)
197+
parser.add_argument("--screen-saver", help="Turn on/off screensaver",
198+
action=argparse.BooleanOptionalAction)
195199
parser.add_argument("--b1image", help="On the B1 display, show a PNG or GIF image in black and white only)",
196200
type=argparse.FileType('rb'))
197201

@@ -256,7 +260,7 @@ def main():
256260
snake_embedded()
257261
elif args.game_of_life_embedded is not None:
258262
game_of_life_embedded(args.game_of_life_embedded)
259-
elif args.quit_embedded_game is not None:
263+
elif args.quit_embedded_game:
260264
send_command(CommandVals.GameControl, [GameControlVal.Quit])
261265
elif args.pong_embedded:
262266
pong_embedded()
@@ -276,6 +280,8 @@ def main():
276280
display_on_cmd(args.display_on)
277281
elif args.invert_screen is not None:
278282
invert_screen_cmd(args.invert_screen)
283+
elif args.screen_saver is not None:
284+
screen_saver_cmd(args.screen_saver)
279285
elif args.b1image is not None:
280286
b1image_bl(args.b1image)
281287
elif args.version:
@@ -1063,6 +1069,10 @@ def invert_screen_cmd(invert):
10631069
send_command(CommandVals.InvertScreen, [invert])
10641070

10651071

1072+
def screen_saver_cmd(on):
1073+
send_command(CommandVals.ScreenSaver, [on])
1074+
1075+
10661076
# 5x6 symbol font. Leaves 2 pixels on each side empty
10671077
# We can leave one row empty below and then the display fits 5 of these digits.
10681078

0 commit comments

Comments
 (0)