|
@@ -10,6 +10,7 @@ import urllib2
|
|
|
import yaml
|
|
|
from OmegaExpansion import oledExp
|
|
|
|
|
|
+OLED_DISPLAY_WIDTH = 21
|
|
|
WIENER_LINIEN_DEFAULT_UPDATE_INTERVAL_SECONDS = 10
|
|
|
|
|
|
|
|
@@ -33,6 +34,10 @@ assert "-1:20" == format_timedelta(datetime.timedelta(seconds=-80))
|
|
|
assert "-2:00" == format_timedelta(datetime.timedelta(seconds=-120))
|
|
|
|
|
|
|
|
|
+def oled_write_line(line):
|
|
|
+ oledExp.write(line.ljust(OLED_DISPLAY_WIDTH, ' '))
|
|
|
+
|
|
|
+
|
|
|
class Departure:
|
|
|
|
|
|
def __init__(self, line, towards, predicted_time):
|
|
@@ -107,17 +112,16 @@ def run(config_path):
|
|
|
wiener_linien_last_update_time = time.time()
|
|
|
except urllib2.HTTPError as e:
|
|
|
print(e)
|
|
|
- oledExp.clear()
|
|
|
oledExp.setCursor(0, 0)
|
|
|
oledExp.write(datetime_now_local().strftime("%Y-%m-%d %H:%M:%S"))
|
|
|
for departure_idx, departure in enumerate(departures):
|
|
|
oledExp.setCursor(1 + departure_idx, 0)
|
|
|
- oledExp.write("%s %s %s" % (
|
|
|
+ oled_write_line("%s %s %s" % (
|
|
|
format_timedelta(departure.predicted_timedelta),
|
|
|
departure.line,
|
|
|
departure.towards,
|
|
|
))
|
|
|
- time.sleep(0.9)
|
|
|
+ time.sleep(0.1)
|
|
|
|
|
|
|
|
|
def _init_argparser():
|