Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

Ability to have a script run before/after certain events #359

Open
necromancyr opened this issue Jan 5, 2022 · 4 comments
Open

Ability to have a script run before/after certain events #359

necromancyr opened this issue Jan 5, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@necromancyr
Copy link

Description
Incorporate ability to run a script at certain events. Suggested event lists:

  • Start-Up of NHL-LED-Scoreboard
  • Before/After Goal Animation
  • Before/After Penalty Animation
  • When exiting script (if there's a graceful exit mechanism)

Pseudocode Example:
if (GoalOccurs) then if (Goal-PreAnimation Exists) then execcommand = pregoalscriptname PlayGoalAnimationsandAlerts if (Goal-PostAnimation Exists) then execcommand = postgoalscriptname

This would allow custom activities to happen around events.

@falkyre
Copy link
Contributor

falkyre commented Jan 6, 2022

The only issue with adding in an external script is the possibility of the script causing the board to hang. The functionality for running an external script already exists in the pushbutton code but it's very basic and doesn't take into account for anything out of the ordinary and is used for specific situations where if it hangs, it doesn't really matter (ie poweroff or reboot). If you are looking for event driven activities, the upcoming MQTT addition provides topics for goals and penalties and the addition of the board start /stop could be added without a problem. That's likely a better solution in my opinion. Then you could use a separate python script that won't impact the running of the core board that subscribes to the topics and do what you need to do on the goals/penalities etc. Maybe @riffnshred has some other ideas, but that's my 2 cents.

@necromancyr
Copy link
Author

Definitely understand that as an issue. I would think having it multithreaded in some way with the script run separately and the board not waiting for it would address the issue, but perhaps not. It's a bit beyond my limited capabilities - the MQTT messagins seems appropriate as well if things could be done locally and quickly so there's not multi-second delays between the script running and events occurring on the board.

@falkyre
Copy link
Contributor

falkyre commented Jan 19, 2022

Definitely understand that as an issue. I would think having it multithreaded in some way with the script run separately and the board not waiting for it would address the issue, but perhaps not. It's a bit beyond my limited capabilities - the MQTT messagins seems appropriate as well if things could be done locally and quickly so there's not multi-second delays between the script running and events occurring on the board.

So I just double checked the code for the pushbutton and I am already using the subprocess function to launch the scripts. It was one of the first things I coded so I'd have to circle back and wrap my old brain around what I did and see if it can be extended to other parts of the code. I think it could be added along side the MQTT stuff where events are being sent already. @riffnshred assign this to me as an enhancement, I'll see what I can do to add it.

@riffnshred riffnshred added the enhancement New feature or request label Jan 19, 2022
@riffnshred
Copy link
Owner

roger that ! I like the idea. Just not sure with the state of the project how well it will integrate without causing issues to the current features. Ill leave that to you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants