MLB-LED-Scoreboard / mlb-led-scoreboard

An LED scoreboard for Major League Baseball :baseball:
GNU General Public License v3.0
582 stars 105 forks source link

Allow news ticker when no games are live #455

Closed WardBrian closed 1 year ago

WardBrian commented 1 year ago

This allows you to have no_games_live set for the news and weather screen, just like the current setting for standings.

If both are set, it will rotate between the two every couple minutes until games become live.

This is accomplished with a kind of clever system where we can pass in conditions from the outside which control how long each screen is shown for. This also starts to pave the way for a better overall rotation config. I'd love to eventually allow you to have a rotation which looks like this:

offday: [news]                                           # options: news, standings
no_games_live: [news, standings]                         # options: news, standings
gameday: [preferred_teams, news, standings, live_games]  # options: preferred_teams (never rotate during these except inning breaks), news, standings, followed_teams (teams you follow but don't want to become sticky like preferred teams), live_games (all other games)

Not sure if I'll have a go at implementing that here or later on.

WardBrian commented 1 year ago

I made the somewhat natural extension of allowing news/standings settings for offdays to compose. So now if you set team_offday to true for both, it will switch between them rather than picking one

WardBrian commented 1 year ago

@ty-porter I don't think I'm going to push this any further toward that full refactor for the time being, so I'd consider this ready for the full review.

The only open question is if we want to move the STANDINGS_NEWS_SWITCH_TIME constant into a configurable value or not.

WardBrian commented 1 year ago

My board crashed today and I suspected this was to blame, but it was actually an unrelated issue. My board tried to display a Wild Card standing at the exact second a refresh happened, and during that exact second the list of divisions hadn't been correctly populated.

I fixed this by storing it as a local until it is fully populated and then assigning it to the member variable