From adfcf895b53f76c5c307c0d4b965c99e080c9156 Mon Sep 17 00:00:00 2001 From: shane-powell Date: Mon, 9 Nov 2020 07:58:54 +0000 Subject: [PATCH] black screen test --- examples/monitor.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/examples/monitor.py b/examples/monitor.py index 03f9f5c..beddee9 100644 --- a/examples/monitor.py +++ b/examples/monitor.py @@ -975,6 +975,10 @@ def main(): # Set up our canvas and prepare for drawing image = Image.new("RGBA", (DISPLAY_WIDTH, DISPLAY_HEIGHT), color=(255, 255, 255)) + # Setup blank image for darkness + image_blank = Image.new("RGBA", (DISPLAY_WIDTH, DISPLAY_HEIGHT), color=(255, 255, 255)) + + # Pick a random selection of plant icons to display on screen channels = [ Channel(1, 1, 1), @@ -1062,11 +1066,18 @@ Alarm Interval: {:.2f}s if channel.alarm: alarm.trigger() - alarm.update(light.get_lux() < 4.0) + light_level_low = light.get_lux() < 4.0 + + alarm.update(light_level_low) viewcontroller.update() viewcontroller.render() - display.display(image.convert("RGB")) + + if light_level_low: + display.display(image_blank.convert("RGB")) + + else: + display.display(image.convert("RGB")) config.set_general( {