Try and fix display on real display

This commit is contained in:
Stefan Bethke 2025-06-02 20:24:05 +02:00
commit 558274927c
3 changed files with 8 additions and 7 deletions

View file

@ -105,7 +105,7 @@ class DBFAnimation(BubaAnimation):
title = self.station title = self.station
else: else:
title = f"{self.station} ({page+1}/{all_len})" title = f"{self.station} ({page+1}/{all_len})"
self.buba.text(page=0, row=0, col_start=0, col_end=120, text=title, align=BubaCmd.ALIGN_LEFT) self.buba.text(page=0, row=0, col_start=0, col_end=92, text=title, align=BubaCmd.ALIGN_LEFT)
for i, train in enumerate(trains): for i, train in enumerate(trains):
if train['isCancelled']: if train['isCancelled']:
when = "--" when = "--"
@ -113,11 +113,11 @@ class DBFAnimation(BubaAnimation):
when = self.countdown(train) when = self.countdown(train)
if when < 0: if when < 0:
when = 0 when = 0
self.buba.text(page=0, row=i + 1, col_start=0, col_end=120, text=self.short_train(train['train'])) self.buba.text(page=0, row=i + 1, col_start=0, col_end=119, text=self.short_train(train['train']))
self.buba.text(page=0, row=i + 1, col_start=12, col_end=76, text=self.short_station(train['destination'])) self.buba.text(page=0, row=i + 1, col_start=12, col_end=104, text=self.short_station(train['destination']))
self.buba.text(page=0, row=i + 1, col_start=105, col_end=120, self.buba.text(page=0, row=i + 1, col_start=105, col_end=119,
text=str(when), align=BubaCmd.ALIGN_RIGHT) text=str(when), align=BubaCmd.ALIGN_RIGHT)
self.buba.set_page(0) self.buba.set_page(0)
for i in range(10): for i in range(10):
self.buba.text(page=0, row=0, col_start=93, col_end=120, text=datetime.datetime.now().strftime("%H:%M:%S"), align=BubaCmd.ALIGN_RIGHT) self.buba.text(page=0, row=0, col_start=93, col_end=119, text=datetime.datetime.now().strftime("%H:%M:%S"), align=BubaCmd.ALIGN_RIGHT)
sleep(1) sleep(1)

View file

@ -17,5 +17,5 @@ class BubaTime(BubaAnimation):
self.buba.set_page(0) self.buba.set_page(0)
for i in range(5): for i in range(5):
self.buba.text(page=0, row=0, col_start=93, col_end=120, text=datetime.now().strftime("%H:%M:%S"), align=BubaCmd.ALIGN_RIGHT) self.buba.text(page=0, row=0, col_start=93, col_end=119, text=datetime.now().strftime("%H:%M:%S"), align=BubaCmd.ALIGN_RIGHT)
sleep(1) sleep(1)

View file

@ -148,6 +148,7 @@ export default class {
} }
text(page, row, col_start, col_end, text, align) { text(page, row, col_start, col_end, text, align) {
col_end += 1;
let s = this.col_start_for_alignment(col_start, col_end, text, align); let s = this.col_start_for_alignment(col_start, col_end, text, align);
if (s < 0) if (s < 0)
console.log("Out of alignment") console.log("Out of alignment")
@ -156,7 +157,7 @@ export default class {
} }
simple_text(page, row, col, text, align) { simple_text(page, row, col, text, align) {
this.text(page, row, col, this.config.cols, text, align); this.text(page, row, col, this.config.cols-1, text, align);
} }
defineFont() { defineFont() {