diff --git a/README.md b/README.md index 8b7b5f5..ddc1457 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,16 @@ Draw a line of pixels on the display. Options: ] } +### Clear +Erases all pixels on the display to show a blank screen. +{ + "drawings": [ + { + "type": "clear" + } + ] +} + ### Multiple drawings. Provide a list of drawings to place multiple elements on to the screen. The next DoCommand will erase the screen { diff --git a/models.py b/models.py index d498534..4a6825b 100644 --- a/models.py +++ b/models.py @@ -64,6 +64,8 @@ async def do_command( pixels = drawing["pixels"] width = drawing.get("width") self.line(draw, pixels, width) + case "clear": + self.clear(draw) result["drawings"] = True return result @@ -87,6 +89,9 @@ def line(self, draw, pixels: list[int], width): width=1 draw.line(pixels, fill="white", width=width) + def clear(self, draw): + draw.clear() + def reconfigure(self, config: ComponentConfig, dependencies: Mapping[ResourceName, ResourceBase]):