From 3901cafd2d681bac69ada9960e035c833b0715a8 Mon Sep 17 00:00:00 2001 From: Nicholas Saraniti Date: Sun, 10 Mar 2024 15:55:20 -0400 Subject: [PATCH 1/4] added check for isolcpus=3 --- install.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 53b37d8e..b9563b98 100755 --- a/install.sh +++ b/install.sh @@ -151,7 +151,21 @@ if [ "$SKIP_MATRIX" = false ]; then else echo "Sound Blacklist File found, skipping creation." fi - + echo "------------------------------------" + echo " Checking for isolcpus=3" + echo "------------------------------------" + if grep -q isolcpus=3 "/boot/cmdline.txt" || grep -q isolcpus=3 "/boot/firmware/cmdline.txt" 2>/dev/null; then + echo "isolcpus=3 found in cmdline.txt" + else + read -d . VERSION < /etc/debian_version + if [ "$VERSION" -lt "12" ]; then + echo "adding isolcpus=3 to /boot/cmdline.txt" + sudo sed -i '$ s/$/ isolcpus=3/' /boot/cmdline.txt + else + echo "adding isolcpus=3 to /boot/firmware/cmdline.txt" + sudo sed -i '$ s/$/ isolcpus=3/' /boot/firmware/cmdline.txt + fi + fi fi if [ "$SKIP_CONFIG" = true ]; then From ed979cbe7256a29c28b4f9cafc95b4774d49817e Mon Sep 17 00:00:00 2001 From: Tyler Porter Date: Fri, 17 May 2024 13:12:15 -0400 Subject: [PATCH 2/4] Add relative positioning option for team records --- coordinates/w128h32.json.example | 3 ++- coordinates/w128h64.json.example | 3 ++- coordinates/w192h64.json.example | 3 ++- coordinates/w32h32.json.example | 3 ++- coordinates/w64h32.json.example | 4 ++-- coordinates/w64h64.json.example | 3 ++- renderers/games/teams.py | 27 +++++++++++++++++++-------- 7 files changed, 31 insertions(+), 15 deletions(-) diff --git a/coordinates/w128h32.json.example b/coordinates/w128h32.json.example index c181acdf..5621a376 100644 --- a/coordinates/w128h32.json.example +++ b/coordinates/w128h32.json.example @@ -301,6 +301,7 @@ }, "record": { "enabled": false, + "position": "absolute", "away": { "font_name": "4x6", "x": 19, @@ -378,4 +379,4 @@ "y": 31 } } -} +} \ No newline at end of file diff --git a/coordinates/w128h64.json.example b/coordinates/w128h64.json.example index 184a7e0c..6e67c098 100644 --- a/coordinates/w128h64.json.example +++ b/coordinates/w128h64.json.example @@ -281,6 +281,7 @@ }, "record": { "enabled": false, + "position": "absolute", "away": { "x": 30, "y": 13 @@ -359,4 +360,4 @@ "y": 63 } } -} +} \ No newline at end of file diff --git a/coordinates/w192h64.json.example b/coordinates/w192h64.json.example index 6f010530..1dc6b1ad 100644 --- a/coordinates/w192h64.json.example +++ b/coordinates/w192h64.json.example @@ -281,6 +281,7 @@ }, "record": { "enabled": false, + "position": "absolute", "away": { "x": 30, "y": 13 @@ -359,4 +360,4 @@ "y": 63 } } -} +} \ No newline at end of file diff --git a/coordinates/w32h32.json.example b/coordinates/w32h32.json.example index 31a8dd0a..7a55924f 100644 --- a/coordinates/w32h32.json.example +++ b/coordinates/w32h32.json.example @@ -288,6 +288,7 @@ }, "record": { "enabled": false, + "position": "absolute", "away": { "x": 4, "y": 6 @@ -363,4 +364,4 @@ "y": 31 } } -} +} \ No newline at end of file diff --git a/coordinates/w64h32.json.example b/coordinates/w64h32.json.example index a9ee194b..51786014 100644 --- a/coordinates/w64h32.json.example +++ b/coordinates/w64h32.json.example @@ -153,7 +153,6 @@ "desc_length": "short", "enabled": true } - }, "batter_count": { "x": 34, @@ -275,6 +274,7 @@ }, "record": { "enabled": false, + "position": "absolute", "away": { "x": 15, "y": 6 @@ -350,4 +350,4 @@ "y": 31 } } -} +} \ No newline at end of file diff --git a/coordinates/w64h64.json.example b/coordinates/w64h64.json.example index 5ec273bb..eecefa32 100644 --- a/coordinates/w64h64.json.example +++ b/coordinates/w64h64.json.example @@ -257,6 +257,7 @@ }, "record": { "enabled": false, + "position": "absolute", "away": { "font_name": "4x6", "x": 18, @@ -334,4 +335,4 @@ "y": 63 } } -} +} \ No newline at end of file diff --git a/renderers/games/teams.py b/renderers/games/teams.py index 5d7bb78f..572e306d 100644 --- a/renderers/games/teams.py +++ b/renderers/games/teams.py @@ -1,5 +1,8 @@ from driver import graphics +ABSOLUTE = "absolute" +RELATIVE = "relative" + def render_team_banner( canvas, layout, team_colors, home_team, away_team, full_team_names, short_team_names_for_runs_hits, show_score, ): @@ -55,11 +58,11 @@ def render_team_banner( canvas, full_team_names, short_team_names_for_runs_hits, [home_team, away_team] ) - __render_team_text(canvas, layout, away_colors, away_team, "away", use_full_team_names, default_colors) - __render_team_text(canvas, layout, home_colors, home_team, "home", use_full_team_names, default_colors) + away_name_end_pos = __render_team_text(canvas, layout, away_colors, away_team, "away", use_full_team_names, default_colors) + home_name_end_pos = __render_team_text(canvas, layout, home_colors, home_team, "home", use_full_team_names, default_colors) - __render_record_text(canvas, layout, away_colors, away_team, "away", default_colors) - __render_record_text(canvas, layout, home_colors, home_team, "home", default_colors) + __render_record_text(canvas, layout, away_colors, away_team, "away", default_colors, away_name_end_pos) + __render_record_text(canvas, layout, home_colors, home_team, "home", default_colors, home_name_end_pos) if show_score: # Number of characters in each score. @@ -108,12 +111,14 @@ def __render_team_text(canvas, layout, colors, team, homeaway, full_team_names, text_color_graphic = graphics.Color(text_color["r"], text_color["g"], text_color["b"]) coords = layout.coords("teams.name.{}".format(homeaway)) font = layout.font("teams.name.{}".format(homeaway)) - team_text = "{:3s}".format(team.abbrev.upper()) + team_text = "{:3s}".format(team.abbrev.upper()).strip() if full_team_names: - team_text = "{:13s}".format(team.name) + team_text = "{:13s}".format(team.name).strip() graphics.DrawText(canvas, font["font"], coords["x"], coords["y"], text_color_graphic, team_text) -def __render_record_text(canvas, layout, colors, team, homeaway, default_colors): + return (coords["x"] + (len(team_text) * font["size"]["width"]), coords["y"]) + +def __render_record_text(canvas, layout, colors, team, homeaway, default_colors, origin): if "losses" not in team.record or "wins" not in team.record: return if not layout.coords("teams.record").get("enabled", False): @@ -124,8 +129,14 @@ def __render_record_text(canvas, layout, colors, team, homeaway, default_colors) coords = layout.coords("teams.record.{}".format(homeaway)) font = layout.font("teams.record.{}".format(homeaway)) record_text = "({}-{})".format(team.record["wins"], team.record["losses"]) - graphics.DrawText(canvas, font["font"], coords["x"], coords["y"], text_color_graphic, record_text) + if layout.coords("teams.record").get("position", ABSOLUTE) != RELATIVE: + origin = (0, 0) + + x = coords["x"] + origin[0] + y = coords["y"] + origin[1] + + graphics.DrawText(canvas, font["font"], x, y, text_color_graphic, record_text) def __render_score_component(canvas, layout, colors, homeaway, default_colors, coords, component_val, width_chars): # The coords passed in are the rightmost pixel. From f40d9a6179a9d39a9283ea3e7247d4d19a5af87f Mon Sep 17 00:00:00 2001 From: Tyler Porter Date: Fri, 17 May 2024 13:19:42 -0400 Subject: [PATCH 3/4] Update README for new feature --- coordinates/README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/coordinates/README.md b/coordinates/README.md index 0aa630e8..0f5ddb0b 100644 --- a/coordinates/README.md +++ b/coordinates/README.md @@ -6,6 +6,11 @@ You can edit these coordinates to display parts of the scoreboard in any way you ## Example If you have a 64x32 board, copy `w64h32.json.example` to a new file called `w64h32.json`, then edit the coordinates in that file as you see fit. Your customized coordinates will always take precedence. +>!WARNING +> **DO NOT** remove `.example` files! **Copy** the files instead. +> +> These are checked by the software to determine which matrix dimensions are supported. If you remove the file, the scoreboard may fail to start. + ## Fonts Any scoreboard element that prints text can accept a `"font_name"` attribute. Supported fonts need to be named with `x.bdf` (or `xB.bdf` for bold fonts). The font loader will search `assets/` first for the specified font and then it will fall back to searching `matrix/fonts/` if one was not found. @@ -19,13 +24,18 @@ The layout can have a couple of different states where things are rendered diffe * `spacing` is the number of pixels between the runs/hits and hits/errors. ## Pitch Data -* `enabled` (true/false) turn feature on/off +* `enabled` (true/false) Turn feature on/off * `mph` (true/false) When rendering pitch speed add mph after (99 mph) * `desc_length` (short/long) The short or long pitch type description, you can change both the short and long description to your liking in data/pitches as long as you do not change the index value. ## Play Result -* `enabled` (true/false) turn feature on/off -* `desc_length` (short/long) The short or long play result description. You can change both the short and long description to your liking in data/plays. +* `enabled` (true/false) Turn feature on/off +* `desc_length` (short/long) The short or long play result description. + +## Team Records During Games +Team records can be displayed on the team banner during most game states, such as pregame, live, and postgame. +* `enabled` (true/false) Turn feature on/off +* `position` (absolute/relative) Defines origin of the text. When `absolute`, the origin is always `(0, 0)`. When `relative`, the origin is relative to the end of the team name in the banner. ## Updates The software develops and releases features with full support for the default layouts, so custom layouts may look unsatisfactory if you update to later versions of the scoreboard. If you as a user decide to create a custom layout file, you are responsible for tweaking the coordinates to your liking with each update. @@ -34,5 +44,5 @@ The software develops and releases features with full support for the default la A couple of things are not completely implemented or have some implementation details you should understand. * `bases` currently requires an even `size` value to be rendered correctly -* Not all options are enabled on all board sizes by default. For example pitch count and pitch type are not enabled by default on boards smaller than 64x64. Options are "disabled" by forcing them to render outside the board, by setting X and Y coordinates less than 0 or greater than the height or width of the board. +* Not all options are enabled on all board sizes by default. For example pitch count and pitch type are not enabled by default on boards smaller than 64x64. Options are "disabled" by forcing them to render outside the board, by setting X and Y coordinates less than 0 or greater than the height or width of the board. From b36bf397498d3738d49ee3c70544b2996ee64a8b Mon Sep 17 00:00:00 2001 From: Tyler Porter Date: Sun, 19 May 2024 14:20:16 -0400 Subject: [PATCH 4/4] Bump version --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index 05d65d4c..3f68b6da 100644 --- a/version.py +++ b/version.py @@ -1,5 +1,5 @@ SCRIPT_NAME = "MLB LED Scoreboard" -SCRIPT_VERSION = "8.0.1" +SCRIPT_VERSION = "8.0.2" if __name__ == "__main__":