diff --git a/controller/display/main.py b/controller/display/main.py index 9605b2cb6..4a3ffd94e 100644 --- a/controller/display/main.py +++ b/controller/display/main.py @@ -116,13 +116,24 @@ def render(status=""): epd.init() epd.Clear(0xFF) - epd.display_Partial(epd.getbuffer(image)) - epd.sleep() + epd.display_Base(epd.getbuffer(image)) + # epd.sleep() async def configure(config): + assert draw is not None + assert width is not None + assert height is not None + assert epd is not None + assert image is not None + status = config.get("status", "") - render(status) + + drawStatus(status=status) + newimage = image.crop((0, height - BAR_HEIGHT, width, height)) + image.paste(newimage, (0, height - BAR_HEIGHT)) + + epd.display_Partial(epd.getbuffer(image)) async def clear(): diff --git a/controller/display/test.js b/controller/display/test.js index f4a62258d..1371fbed2 100644 --- a/controller/display/test.js +++ b/controller/display/test.js @@ -1,3 +1,4 @@ +import { setTimeout } from "node:timers/promises" import { configureDisplay, watch } from "../../lib/scope.js" watch("display").then(async (messages) => { @@ -6,7 +7,24 @@ watch("display").then(async (messages) => { } }) -const status = `http://planktoscope-sponge-bob` -await configureDisplay({ - status, -}) +function generateRandomString() { + const length = Math.floor(Math.random() * 11) + 10 // 10–20 + const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" + let result = "" + + for (let i = 0; i < length; i++) { + result += chars.charAt(Math.floor(Math.random() * chars.length)) + } + + return result +} + +while (true) { + const status = generateRandomString() + await configureDisplay({ + status, + }) + // await setTimeout(1000) +} + +// 10:54