From adfcf895b53f76c5c307c0d4b965c99e080c9156 Mon Sep 17 00:00:00 2001 From: shane-powell Date: Mon, 9 Nov 2020 07:58:54 +0000 Subject: [PATCH 01/10] 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( { From ef21b5e5f4c79b4e10ce5ddd7d5615f8d68a8c81 Mon Sep 17 00:00:00 2001 From: shane-powell Date: Mon, 9 Nov 2020 08:11:29 +0000 Subject: [PATCH 02/10] Lets try actually setting black instead of white. --- examples/monitor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/monitor.py b/examples/monitor.py index beddee9..7e6469c 100644 --- a/examples/monitor.py +++ b/examples/monitor.py @@ -976,7 +976,7 @@ def main(): 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)) + image_blank = Image.new("RGBA", (DISPLAY_WIDTH, DISPLAY_HEIGHT), color=(0, 0, 0)) # Pick a random selection of plant icons to display on screen From d84ea56e2324cd2d64c3776b1a421d9613e1a2e8 Mon Sep 17 00:00:00 2001 From: shane-powell Date: Mon, 9 Nov 2020 08:17:41 +0000 Subject: [PATCH 03/10] Decrese low light level threshold. --- examples/monitor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/monitor.py b/examples/monitor.py index 7e6469c..b8c6218 100644 --- a/examples/monitor.py +++ b/examples/monitor.py @@ -1066,7 +1066,7 @@ Alarm Interval: {:.2f}s if channel.alarm: alarm.trigger() - light_level_low = light.get_lux() < 4.0 + light_level_low = light.get_lux() < 3.0 alarm.update(light_level_low) From a82c2055c91578fdbb4f48de4a6c7c4c476b035e Mon Sep 17 00:00:00 2001 From: shane-powell Date: Mon, 9 Nov 2020 08:21:23 +0000 Subject: [PATCH 04/10] Decrese light threshold some more. --- examples/monitor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/monitor.py b/examples/monitor.py index b8c6218..21e1c32 100644 --- a/examples/monitor.py +++ b/examples/monitor.py @@ -1066,7 +1066,7 @@ Alarm Interval: {:.2f}s if channel.alarm: alarm.trigger() - light_level_low = light.get_lux() < 3.0 + light_level_low = light.get_lux() < 1.0 alarm.update(light_level_low) From 309b098c7cc0dc2d15d172efcd8c68ee54056b99 Mon Sep 17 00:00:00 2001 From: shane-powell Date: Mon, 9 Nov 2020 09:57:04 +0000 Subject: [PATCH 05/10] Add new features to config file. --- examples/monitor.py | 4 ++-- examples/settings.yml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/monitor.py b/examples/monitor.py index 21e1c32..c4b2154 100644 --- a/examples/monitor.py +++ b/examples/monitor.py @@ -1066,14 +1066,14 @@ Alarm Interval: {:.2f}s if channel.alarm: alarm.trigger() - light_level_low = light.get_lux() < 1.0 + light_level_low = light.get_lux() < config.get_general().get("light_level_low") alarm.update(light_level_low) viewcontroller.update() viewcontroller.render() - if light_level_low: + if light_level_low and config.get_general().get("black_screen_when_light_low"): display.display(image_blank.convert("RGB")) else: diff --git a/examples/settings.yml b/examples/settings.yml index 88871c1..74bc57d 100644 --- a/examples/settings.yml +++ b/examples/settings.yml @@ -16,3 +16,5 @@ channel3: general: alarm_enable: true alarm_interval: 2 + light_level_low: 4.0 + black_screen_when_light_low: false From 696d4061559ee46939dc45c427fda3715324cd4b Mon Sep 17 00:00:00 2001 From: shane-powell Date: Mon, 9 Nov 2020 10:30:19 +0000 Subject: [PATCH 06/10] Update printing of config values. --- examples/.idea/workspace.xml | 41 ++++++++++++++++++++++++++++++++++++ examples/monitor.py | 4 +++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 examples/.idea/workspace.xml diff --git a/examples/.idea/workspace.xml b/examples/.idea/workspace.xml new file mode 100644 index 0000000..8f2cca4 --- /dev/null +++ b/examples/.idea/workspace.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - \ No newline at end of file From fa7a91061b888e7c01a7ff22abb72b3fad880bc3 Mon Sep 17 00:00:00 2001 From: shane-powell Date: Thu, 12 Nov 2020 08:13:11 +0000 Subject: [PATCH 10/10] Trigger GitHub actions