diff --git a/rpi/main.py b/rpi/main.py index 5613e4a..95401d4 100644 --- a/rpi/main.py +++ b/rpi/main.py @@ -308,9 +308,13 @@ def handle_program1(): if scroll_node_active: bottom_text_iteration_count += 1 scroll_node_active = False - if s['program_vehicles_enabled'] and bottom_text_iteration_count >= config.PROGRAM2_TEXT_ITERATIONS: - bottom_text_iteration_count = 0 - if random.randint(0, 99) < config.PROGRAM2_TRIGGER_CHANCE: + force = s.get('force_vehicles', False) + if force: + with server._lock: + server.state['force_vehicles'] = False + if s['program_vehicles_enabled'] and (force or bottom_text_iteration_count >= config.PROGRAM2_TEXT_ITERATIONS): + if force or random.randint(0, 99) < config.PROGRAM2_TRIGGER_CHANCE: + bottom_text_iteration_count = 0 program2_active = True reset_program2() low_level.fill_pixels(0, 9, config.DISPLAY_MAX_X, config.DISPLAY_MAX_Y, 0, 0, 0) diff --git a/rpi/server.py b/rpi/server.py index 9b13244..6663c4f 100644 --- a/rpi/server.py +++ b/rpi/server.py @@ -13,6 +13,7 @@ state = { 'program_top_text_enabled': True, 'program_bottom_text_enabled': True, 'program_vehicles_enabled': True, + 'force_vehicles': False, } _lock = threading.Lock() @@ -46,6 +47,11 @@ INDEX_HTML = """ .brightness-row { display: flex; align-items: center; gap: 12px; } .brightness-row input[type=range] { flex: 1; accent-color: #4CAF50; } .brightness-row span { min-width: 32px; text-align: right; } + .btn { display: block; width: 100%; padding: 14px; border: none; border-radius: 12px; + font-size: 1em; cursor: pointer; margin-bottom: 12px; transition: 0.2s; } + .btn-vehicles { background: #2a4a7f; color: #eee; } + .btn-vehicles:hover { background: #3a5a9f; } + .btn-vehicles:active { background: #1a3a6f; } @@ -74,6 +80,7 @@ INDEX_HTML = """ 100 +