...
Buttons to change state
Drive, Reverse, and Neutral
Power button
Regen Braking button
Hazard Button
three 7-segment displays with the below quantities
Speedometer (speed in km/h)
Battery Percentage Indicator (Percent remaining charge)
Cruise Control indicator (desired speed in km/h)
Indicator LEDS
One for each of the above buttons (P/D/N/R/Haz/Reg)
Left turn signal
Right Turn Signal
Cruise control enabled indicator
We will also be displaying error codes on centre console 7-segs when faults occur.
Expand | ||
---|---|---|
| ||
TX:
|
...
|
...
RX: (with checks to determine if a board has gone offline)
cc_cruise_info → MCI |
Centre Console Functionality
Module: cc_buttons
This module provides a functions to get all button values. Buttons should be read in the fast cycle. They are connected to the pca9555 gpio expander, and must be read over i2c. This read function should just send notifications to the requisite tasks.
Power Button, hazard, regen: send notifications to main task
R, N, D → Send notifications to Drive FSM
Module: refreshupdate_dashboard:
Static variables:
cruise_control_state
target_velocity
regen_braking_state
power_state_to_transmit
Functions (all called in medium cycle):
dashboard_init()
update_indicators()
Gets notification value from button presses, updates indicator lights and output can_messages
Power button:
Set cc_power_ctrl.power_event
POWER_EV_NONE if no power button pressed event
POWER_EV_BTN if button is pressed and brake reading == 0
POWER_EV_BTN_AND_BRAKE if button is pressed and brake reading != 0
Hazard enabled:
when pressed,
toggle static hazard state
update indicator and cc_power_
control.hazard_enabled message based on stored value
Regen Brake:
when pressed, toggle static regen brake state
update indicator and
drive_output.regen_brake_enabled message based on stored value
Lights left/right
update left/right indicator based on steering_info.input_lights
Cruise Control Enabled:
update static cc state based on steering_info.cc_input
update indicator based on cc_state
update drive_output based on cc_state + target_velocity
update_displays()
Reads values from CAN messages, uses values for 7-seg:
motor_info.current_speed → speed display
battery_info.batt_percentage → battery display
if (cruise control enabled) target_velocity → cruise control display
cruise_control_monitor()
Checks for cruise control inputs from steering
Updates
...
Pedal - Constantly monitor brake state to determine whether to enter main power state
Must receive value within 100MS (Could be certain number of cycles with new architecture)
MCI
Constantly monitor speed message - Must receive new message within 3 seconds
Send pre-charge and wait for complete message with a timeout
BMS - Heartbeat Message
If not received in 3 seconds, or has errors in message, a BPS fault has occurred
ACK messages from Power Distribution, MCI,
Outputs
LED Indicators - All on a I2C Expander for 8 possible outputs
CENTRE_CONSOLE_LED_BPS
CENTRE_CONSOLE_LED_POWER
CENTRE_CONSOLE_LED_DRIVE
CENTRE_CONSOLE_LED_REVERSE
CENTRE_CONSOLE_LED_NEUTRAL
CENTRE_CONSOLE_LED_PARKING
CENTRE_CONSOLE_LED_HAZARDS
CENTRE_CONSOLE_LED_SPARE,
...
Used for Cruise Control, speed, and battery percentage
...