Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions controller/display/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
26 changes: 22 additions & 4 deletions controller/display/test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { setTimeout } from "node:timers/promises"
import { configureDisplay, watch } from "../../lib/scope.js"

watch("display").then(async (messages) => {
Expand All @@ -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
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've run this test for 3h didn't notice anything wrong.

I'll try a longer run.