Skip to content

LED rework#8

Draft
cameronm57 wants to merge 28 commits into
mainfrom
Cameron-LEDrework
Draft

LED rework#8
cameronm57 wants to merge 28 commits into
mainfrom
Cameron-LEDrework

Conversation

@cameronm57
Copy link
Copy Markdown

@cameronm57 cameronm57 commented Jan 9, 2025

Changed to an Event system. Pass in the LED subsystem and call LED.sendEvent(event) with the event that occurred. LED displays are not being managed in the LED.periodic(). There are two enum types of events -- StripEvents and CANdleEvents -- which are matched to priority levels. We compare the priority levels of the previous event and the new event, and continue with the event if the new event's priority is greater than or equal to the previous event.

Special Cases:

  • If the last event was idle, always update the state.
  • If reading a sensor value, do not update the state if the last event was the meaningful reading and the new event is idle. Ex: If the last event was a piece being present and the new event is idle, do not update. This prevents the LED flashing between the two events.
  • If the new event is sticky fault present and the previous event caused a sticky fault, do not update. We want the specific issue to display on the LED, but once the issue has been resolved, we still need to display that there are sticky faults present until it is cleared on the dashboard.

Managing States:

  • Each subsystem will manage its own states and keep track of the last reading related to events. This is done to ensure that we do not send duplicate events.
  • Exception: LED subsystem will check for sticky faults being listed on the dashboard and the match timer.

ArtemZhukovskyy and others added 26 commits January 5, 2025 17:01
tested, works
… is uncalibrated. added comments throughout updated code.
…f color -> bcrcolor

!! not done doesnt work !!
…ctive events, new method created to allow this
uses maps instead of arrays, method added to get priority of event instead of using a loop to iterate through an array, logic added to allow for a full circle of updates (idle -> piece -> shoot -> idle, etc.), names of events in enum and all references changed from camelCase to capitalized with underscores, removed rainbow and shooterRPM in BCRColor enum.

To-Do: implement last 10 second timer, update LEDs whenever robot state changes (will likely fix problem regarding intaking not being displayed)
removed the "non-permanent piece detection when robot is disabled" due to earlier removal of piece timer
@jennatripoli jennatripoli marked this pull request as draft January 17, 2025 02:25
@jennatripoli
Copy link
Copy Markdown

Converted to a draft since this will not be merged (did not implement handling RobotState changes since this is a proof of concept). Let's keep the PR open so it is easy to see the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants