Fix wrong module for random S-Bahn position

This commit is contained in:
Julian Metzler 2022-03-19 21:47:03 +01:00
parent e5c0b01046
commit 187e7ad16a
1 changed files with 7 additions and 8 deletions

15
run.py
View File

@ -83,7 +83,7 @@ def update_display(display, dbi):
if train['isCancelled']:
display.info_2.set(CANCELLED_TEXT)
else:
elif delay >= 5:
delay_text = ""
if CONFIG == "PHALOS-TYP-M-ZZA":
if 5 <= delay <= 20:
@ -97,15 +97,14 @@ def update_display(display, dbi):
elif delay > 60:
delay_text = UNSPECIFIC_DELAY_TEXT
display.info_2.set(delay_text)
train_type_text = TRAIN_TYPE_MAP.get(train_type, "")
if train_type_text:
display.info_1.set(train_type_text)
elif train_type == "S":
else:
# Random train length indicator for S-Bahn
random.seed(train['train'])
train_length_pos = random.randint(56, 65)
display.info_1.set(MAP_INFO_1[train_length_pos])
train_length_pos = random.randint(36, 45)
display.info_2.set(MAP_INFO_2[train_length_pos])
train_type_text = TRAIN_TYPE_MAP.get(train_type, "")
display.info_1.set(train_type_text)
route = route_from([VIA_MAP.get(stop['name'], stop['name']) for stop in train['route']], STATION_NAME)[:-1]
via_combination = get_vias(route, VIA_WEIGHTS, VIA_1, VIA_2, check_dashes=False, debug=True)