Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
2d2ebdf
created PedalsSystem files
wschotte Feb 8, 2026
d95efed
setup most of SteeringSystem class
wschotte Feb 10, 2026
66577d4
added a few last function declarations, might be done with header for…
wschotte Feb 10, 2026
1b177cd
added to system data struct
wschotte Feb 10, 2026
c1abbff
added conversion to degree functions, worked on recalibrating values
bmorrissey9 Feb 12, 2026
d083f5a
comments
carterbliss Feb 15, 2026
501e922
finished rough draft of intended functions
carterbliss Feb 15, 2026
804cbfd
implausability error, dtheta check, sensor priority
carterbliss Feb 17, 2026
2ec44f1
fixed a few naming bugs
wschotte Feb 17, 2026
5b65558
files not updated
carterbliss Feb 19, 2026
c4a72ca
fixed up some syntax
wschotte Feb 19, 2026
7bb6485
fixed up some functions
wschotte Feb 19, 2026
4afe0f3
minor bug fixes before meet
carterbliss Feb 22, 2026
954961a
basic cleanup and revising functions
carterbliss Feb 23, 2026
330e03a
current version, bug fixes
wschotte Feb 24, 2026
64ae5a5
more bug fixing and edited calibration slightly
wschotte Feb 24, 2026
598a8c1
work on unit test and fix unsafe conversions
bmorrissey9 Feb 26, 2026
34d1ae7
continued working on conversion errors
bmorrissey9 Feb 26, 2026
d3b219c
more work on conversion errors
bmorrissey9 Feb 26, 2026
b5ef377
AGAIN
bmorrissey9 Feb 26, 2026
1f49f9e
finish unit test
bmorrissey9 Feb 26, 2026
940f556
fixed formatting
wschotte Feb 26, 2026
f019659
forgot one line
wschotte Feb 26, 2026
4a292e0
fix build errors maybe
wschotte Feb 26, 2026
56e1f39
fixed some unit tests
wschotte Mar 1, 2026
3fba1ef
made conversion functions simpler
wschotte Mar 1, 2026
f1897d2
simplified oor functions
wschotte Mar 2, 2026
c464983
addressed all comments besides EEPROM stuff
wschotte Mar 2, 2026
15e5d83
added VCF tasks for writing to EEPROM, running system, and initializing
wschotte Mar 2, 2026
a96f276
assigned analog values and added tasks in main
wschotte Mar 3, 2026
fe5bf4a
Worked on unit tests, 2 fails remain
bmorrissey9 Mar 3, 2026
7085639
added addresses for EEPROM and edited CAN steering enqueue
wschotte Mar 3, 2026
ff62bbe
worked on unit tests
bmorrissey9 Mar 5, 2026
78e19ee
bug fixes
carterbliss Mar 5, 2026
b4c692e
worked on unit test
bmorrissey9 Mar 5, 2026
03d47d0
only one unit test fails now
bmorrissey9 Mar 5, 2026
419ada8
pulling issue
carterbliss Mar 8, 2026
d23b16a
pull issue
carterbliss Mar 8, 2026
a5674c2
ALL THE UNIT TESTS PASS! 💯💯🙏🙏
bmorrissey9 Mar 8, 2026
c6ba66d
Merge branch 'main' into feat/current_steering_system
carterbliss Mar 11, 2026
86e28e8
Merge branch 'main' into feat/current_steering_system
carterbliss Mar 11, 2026
f61d0b8
removing the sensordata input struct, and preparing for hardware test
carterbliss Mar 12, 2026
ffed532
updated steering system tasks
wschotte Mar 12, 2026
c4d96b6
changed digital steering raw values to full orbis data struct
wschotte Mar 12, 2026
0b6f97c
fixed conversion and access modifier
wschotte Mar 15, 2026
88a18fa
added debug prints for steering system
wschotte Mar 15, 2026
aa2730e
debugged sone stuff i think
wschotte Mar 15, 2026
ffe021a
added YIELD to calibration task
wschotte Mar 16, 2026
b24deeb
added test writes
wschotte Mar 16, 2026
dc6fedf
test commit
carterbliss Mar 16, 2026
ee3c5ba
integrated interface sensor errors into system level error output
carterbliss Mar 17, 2026
5756b2b
started fixing unit tests because of encoder/interface
wschotte Apr 2, 2026
499cfa2
merged in main
wschotte Apr 3, 2026
ace940a
added min max calibration for analog
wschotte Apr 3, 2026
8fdcd9b
fixing calibration (before observed value changes)
wschotte Apr 3, 2026
f294efa
finished updating steering calibration to match pedals system button …
wschotte Apr 3, 2026
6b3d390
added kinda chopped implementation for using the pedals button to rec…
wschotte Apr 3, 2026
e4ee889
calibration changes done
wschotte Apr 3, 2026
965637f
fixed analog memory writes/reads and added more debug prints
wschotte Apr 4, 2026
8a7d9ce
updated deg per count
wschotte Apr 4, 2026
9f25c9a
added new task to sample digital steering sensor
AlexBailey11 Apr 4, 2026
004a50e
moved steeringsystemdata to shared firmware types
wschotte Apr 5, 2026
c023e0d
Merge branch 'feat/current_steering_system' of https://github.com/hyt…
wschotte Apr 5, 2026
3490a32
updated can library
wschotte Apr 5, 2026
a9f577b
updated can enqueue steering data
wschotte Apr 5, 2026
4cf3ea1
fixed min cell reading to correctly use new CAN lib
AlexBailey11 Apr 6, 2026
1410ed0
created sub branch for recalibration changes for steering system
wschotte Apr 6, 2026
7712e47
added variables on VCRInterface for steeringsystem recalibration
wschotte Apr 7, 2026
77f3766
added support for steering system ethernet
auskawang Apr 8, 2026
d48578d
added recalibration steering stuff
carterbliss Apr 9, 2026
c7b5ebb
Added steering system button press and recalibration
carterbliss Apr 9, 2026
1aa556b
new can on platformio
carterbliss Apr 9, 2026
9ab31d2
updated steering fields for ethernet
auskawang Apr 9, 2026
46cf463
added 1 liner for hard code test
carterbliss Apr 14, 2026
ec45b70
testing logistics so now it works
carterbliss Apr 14, 2026
504b1ee
merged in recalibration branch
carterbliss Apr 14, 2026
48d6385
merged with recalibration branch
carterbliss Apr 14, 2026
0337191
Fixed analog voltage dropoff, constant values, and fixed recalibrate
bmorrissey9 Apr 16, 2026
af6aa44
Merge branch 'feat/current_steering_system' of https://github.com/hyt…
carterbliss Apr 16, 2026
529faa2
fixed steering system test
bmorrissey9 Apr 16, 2026
a9f1cad
Merge branch 'feat/current_steering_system' of https://github.com/hyt…
carterbliss Apr 17, 2026
ac92a26
fixed build errors
carterbliss Apr 17, 2026
86c3ede
worked on fixing up the recalibate stuff, plausability constants
carterbliss Apr 17, 2026
e7228b2
changed recalibrate to constantly update, but if its updating a minim…
carterbliss Apr 17, 2026
576f147
added some more logic to recalibrate to adjust to clipping error and …
carterbliss Apr 19, 2026
b5e2e2a
changed the ordering of checks and also the type for the if statement
carterbliss Apr 19, 2026
3ca3ed5
added two new useful signals to indicate clipping, for analog and dig…
carterbliss Apr 19, 2026
287929d
added the ethernet and can messaging for clipping messages, and also …
carterbliss Apr 19, 2026
db12341
Revert "added the ethernet and can messaging for clipping messages, a…
carterbliss Apr 20, 2026
91e68c6
commented out something in VCF
carterbliss Apr 20, 2026
c53f533
added analog and digital clipped to shared firmware types
carterbliss Apr 20, 2026
3695135
commented out steeringsystem test requirement in pio.ini
carterbliss Apr 20, 2026
8e94d23
changed max_observed to > sign and updated pio for sharedfirmware
carterbliss Apr 28, 2026
59939f8
fixed the recalibration stuff, detheta analog, hardware testing works…
carterbliss Apr 29, 2026
72ba046
removed the analog and digital clipped variables everywhere on VCF, a…
carterbliss May 2, 2026
92c23d7
moved steering encoder structs into shared firmware types and removed…
carterbliss May 2, 2026
9d3e67e
fixed unit tests, no modifications needed in pio from main
carterbliss May 3, 2026
6fa52c8
uncommented stuff in main for testing, and VCF for broken digital
carterbliss May 3, 2026
a402f72
kinda fixed steering system velocity but very noisy
wschotte May 3, 2026
860c8a4
fixed steering velocity
wschotte May 3, 2026
575e5b0
removed log file
wschotte May 3, 2026
873ba4b
updated to work with separate buttons for pedals and steering
AlexBailey11 May 9, 2026
27fbcd4
fixed checks
AlexBailey11 May 10, 2026
9cc8ef7
merged in main
AlexBailey11 May 10, 2026
d89d232
adjusted changes to reflect current state of VCF
AlexBailey11 May 10, 2026
5319904
fixed small things and validated on car
AlexBailey11 May 10, 2026
a58a134
Merge branch 'main' into feat/current_steering_system
AlexBailey11 May 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 54 additions & 23 deletions include/VCF_Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace VCFInterfaceConstants {
/* Teensy 4.1 GPIO pins */

/* Not on Schematic
// constexpr int BTN_DIM_READ = 28;
// constexpr int BTN_DIM_READ = 28; // Currently used for steering system recalibration TODO: change pin
// constexpr int BTN_PRESET_READ = 31;
// constexpr int BTN_MODE_READ = 27; // USED TO BE 26.
*/
Expand Down Expand Up @@ -93,9 +93,9 @@ namespace VCFInterfaceConstants {
constexpr float FL_LOADCELL_OFFSET = 0.0;
constexpr float FR_LOADCELL_SCALE = 1.0; //Values
constexpr float FR_LOADCELL_OFFSET = 0.0;

constexpr float FR_SUS_POT_SCALE = 0.01396; // Calibrated for mm between mounting bolts
constexpr float FR_SUS_POT_OFFSET = 150.8; // Can change offset once car is on ground to center at zero
constexpr float FR_SUS_POT_OFFSET = 150.8;
constexpr float FL_SUS_POT_SCALE = 0.01396; // Same as FR
constexpr float FL_SUS_POT_OFFSET = 150.8;

Expand Down Expand Up @@ -125,7 +125,7 @@ namespace VCFSystemConstants {
constexpr uint32_t ACCEL_MAX_SENSOR_PEDAL_2 = 4000;
constexpr float ACCEL_DEADZONE_MARGIN = 0.03f;
constexpr float ACCEL_MECHANICAL_ACTIVATION_PERCENTAGE = 0.05f;

constexpr uint32_t BRAKE_1_MIN_ADDR = 16;
constexpr uint32_t BRAKE_2_MIN_ADDR = 20;
constexpr uint32_t BRAKE_1_MAX_ADDR = 24;
Expand All @@ -137,6 +137,30 @@ namespace VCFSystemConstants {
constexpr uint32_t BRAKE_MAX_SENSOR_PEDAL_2 = 4000;
constexpr float BRAKE_DEADZONE_MARGIN = 0.04f;
constexpr float BRAKE_MECHANICAL_ACTIVATION_PERCENTAGE = 0.5f;

// Steering System Constants
constexpr uint32_t MIN_STEERING_SIGNAL_ANALOG_ADDR = 56; //Raw ADC value from analog sensor at minimum (left) steering angle (calibration)
constexpr uint32_t MAX_STEERING_SIGNAL_ANALOG_ADDR = 60; //Raw ADC value from analog sensor at maximum (right) steering angle
constexpr uint32_t MIN_STEERING_SIGNAL_DIGITAL_ADDR = 32; //Raw ADC value from digital sensor at minimum (left) steering angle
constexpr uint32_t MAX_STEERING_SIGNAL_DIGITAL_ADDR = 36; //Raw ADC value from digital sensor at maximum (right) steering angle

constexpr int32_t ANALOG_MIN_WITH_MARGINS_ADDR = 40;
constexpr int32_t ANALOG_MAX_WITH_MARGINS_ADDR = 44;
constexpr int32_t DIGITAL_MIN_WITH_MARGINS_ADDR = 48;
constexpr int32_t DIGITAL_MAX_WITH_MARGINS_ADDR = 52;


// implausibility values
constexpr float ANALOG_TOLERANCE = 0.05f; //+- 0.5% error (analog sensor tolerance according to datasheet)
constexpr float DIGITAL_TOLERANCE = 0.05f; // +- 0.2 degrees error
constexpr float ERROR_BETWEEN_SENSORS_TOLERANCE = 5.0f;

// rate of angle change
constexpr float MAX_DTHETA_THRESHOLD = 50.0f; //maximum change in angle since last reading to consider the reading valid

// degrees per bit
constexpr float DEG_PER_COUNT_DIGITAL = 360.0f / 16384.0f;
constexpr float DEG_PER_COUNT_ANALOG = 360.0f / 3686.4f;
}

// software configuration constants
Expand All @@ -150,45 +174,52 @@ namespace VCFTaskConstants {
constexpr unsigned long CAN_SEND_PRIORITY = 10;
constexpr unsigned long CAN_SEND_PERIOD = 2000; // 2 000 us = 500 Hz

constexpr unsigned long PEDALS_PRIORITY = 5;
constexpr unsigned long PEDALS_SEND_PERIOD = 4000; // 4 000 us = 250 Hz
constexpr unsigned long PEDALS_SAMPLE_PERIOD = 500; // 500 us = 2 kHz

constexpr unsigned long PEDALS_RECALIBRATION_PRIORITY = 150;
constexpr unsigned long PEDALS_RECALIBRATION_PERIOD = 100000; // 100 000 us = 10 Hz


constexpr unsigned long BUZZER_PRIORITY = 20;
constexpr unsigned long BUZZER_WRITE_PERIOD = 100000; // 100 000 us = 10 Hz

constexpr unsigned long DASH_SAMPLE_PRIORITY = 21;
constexpr unsigned long DASH_SAMPLE_PERIOD = 100000; // 100 000 us = 10 Hz

constexpr unsigned long DASH_SEND_PRIORITY = 7;
constexpr unsigned long DASH_SEND_PERIOD = 100000; // 100 000 us = 10 Hz

constexpr unsigned long DEBUG_PRIORITY = 100;
constexpr unsigned long DEBUG_PERIOD = 10000; // 10 000 us = 2 Hz

constexpr unsigned long NEOPIXEL_UPDATE_PRIORITY = 90;
constexpr unsigned long NEOPIXEL_UPDATE_PERIOD = 100000; // 100 000 us = 10 Hz

constexpr unsigned long STEERING_SEND_PRIORITY = 25;
constexpr unsigned long STEERING_SEND_PERIOD = 4000; // 4 000 us = 250 Hz



constexpr unsigned long LOADCELL_SAMPLE_PRIORITY = 24;
constexpr unsigned long LOADCELL_SAMPLE_PERIOD = 250; // 250 us = 4 kHz

constexpr unsigned long LOADCELL_SEND_PRIORITY = 25;
constexpr unsigned long LOADCELL_SEND_PERIOD = 4000; // 4 000 us = 250 Hz

constexpr unsigned long ETHERNET_SEND_PRIORITY = 20;
constexpr unsigned long ETHERNET_SEND_PERIOD = 100000; // 100 000 us = 10Hz

constexpr unsigned long PEDALS_PRIORITY = 5;
constexpr unsigned long PEDALS_SEND_PERIOD = 4000; // 4 000 us = 250 Hz
constexpr unsigned long PEDALS_SAMPLE_PERIOD = 500; // 500 us = 2 kHz

constexpr unsigned long PEDALS_RECALIBRATION_PRIORITY = 150;
constexpr unsigned long PEDALS_RECALIBRATION_PERIOD = 100000; // 100 000 us = 10 Hz

constexpr unsigned long LOADCELL_SEND_PRIORITY = 25;
constexpr unsigned long LOADCELL_SEND_PERIOD = 4000; // 4 000 us = 250 Hz
constexpr unsigned long STEERING_SEND_PRIORITY = 25;
constexpr unsigned long STEERING_SEND_PERIOD = 4000; // 4 000 us = 250 Hz

constexpr unsigned long STEERING_SAMPLE_PERIOD = 1000; // 2000 us = 500 Hz
constexpr unsigned long STEERING_SAMPLE_PRIORITY = 10;

constexpr unsigned long STEERING_RECALIBRATION_PRIORITY = 150;
constexpr unsigned long STEERING_RECALIBRATION_PERIOD = 100000;

// IIR filter alphas
constexpr float LOADCELL_IIR_FILTER_ALPHA = 0.01f;

constexpr unsigned long WATCHDOG_PRIORITY = 1;
constexpr unsigned long WATCHDOG_KICK_PERIOD = 10000; // 10 000 us = 100 Hz
}

#endif /* VCF_CONSTANTS */
#endif /* VCF_CONSTANTS */
14 changes: 3 additions & 11 deletions include/VCF_Tasks.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "VCFCANInterfaceImpl.h"
#include "VCFEthernetInterface.h"
#include "PedalsSystem.h"
#include "SteeringSystem.h"
#include "ht_sched.hpp"
#include "ht_task.hpp"
#include "BuzzerController.h"
Expand All @@ -42,6 +43,7 @@
#include "WatchdogSystem.h"
#include "ADCInterface.h"
#include "CANInterface.h"
#include "SteeringEncoderInterface.h"

/**
* The read_adc0 task will command the ADCInterface to sample, convert, and store
Expand All @@ -60,6 +62,7 @@ HT_TASK::TaskResponse run_kick_watchdog(const unsigned long& sysMicros, const HT

HT_TASK::TaskResponse update_pedals_calibration_task(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo);

HT_TASK::TaskResponse update_steering_calibration_task(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo);
/**
* The buzzer_control task will control the buzzer control pin. This function
* relies on the buzzer_control pin definition in VCF_Constants.h;
Expand All @@ -77,20 +80,9 @@ HT_TASK::TaskResponse run_buzzer_control_task(const unsigned long& sysMicros, co
HT_TASK::TaskResponse init_handle_send_vcf_ethernet_data(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo);
HT_TASK::TaskResponse run_handle_send_vcf_ethernet_data(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo);

/**
* The handle_receive_VCR_ethernet_data task will receive a protobuf message
* from VCR. This function relies on the VCF (receiving) socket and vcf_data
* defined in VCFGlobals.h, and Ethernet constants defined in
* EthernetAddressDefs.h.
*
*/
HT_TASK::TaskResponse init_handle_receive_vcr_ethernet_data(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo);
HT_TASK::TaskResponse run_handle_receive_vcr_ethernet_data(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo);

// this task attempts to send any data that is enqueued at 250hz. this will be the max rate that you can send over the CAN bus.
// you dont have to enqeue at this rate, but this allows us to have 2 layers of rate limiting on CAN sending
HT_TASK::TaskResponse handle_CAN_send(const unsigned long &sysMicros, const HT_TASK::TaskInfo &taskInfo); // NOLINT (capitalization of CAN)
HT_TASK::TaskResponse handle_CAN_receive(const unsigned long& sysMicros, const HT_TASK::TaskInfo& taskInfo); // NOLINT (capitalization of CAN)

HT_TASK::TaskResponse run_dash_GPIOs_task(const unsigned long& sys_micros, const HT_TASK::TaskInfo& task_info); // NOLINT (capitalization of GPIOs)
HT_TASK::TaskResponse send_dash_data(const unsigned long &sysMicros, const HT_TASK::TaskInfo &taskInfo);
Expand Down
1 change: 0 additions & 1 deletion lib/interfaces/include/NeopixelController.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "etl/singleton.h"
#include "VCFCANInterfaceImpl.h"


struct MinCellMonitoringThresholds_s
{
float max_level = 3.85;
Expand Down
30 changes: 2 additions & 28 deletions lib/interfaces/include/SteeringEncoderInterface.h
Original file line number Diff line number Diff line change
@@ -1,32 +1,6 @@
#ifndef STEERING_ENCODER_INTERFACE_H
#define STEERING_ENCODER_INTERFACE_H

#include <Arduino.h>

enum class SteeringEncoderStatus_e
{
NOMINAL = 0,
ERROR = 1,
};

/// @brief Error and warning flags from the encoder.
/// @note Specific encoders may populate only a subset of these flags.
struct EncoderErrorFlags_s
{
bool dataInvalid = false;
bool operatingLimit = false;
bool noData = false;
};

/// @brief Complete steering angle measurement with status and error flags.
/// @note This struct is transmitted across the CAN bus to other vehicle systems.
struct SteeringEncoderReading_s
{
float angle = 0.0f;
int rawValue = 0;
SteeringEncoderStatus_e status = SteeringEncoderStatus_e::NOMINAL;
EncoderErrorFlags_s errors;
};
#include "SharedFirmwareTypes.h"

class SteeringEncoderInterface
{
Expand All @@ -40,4 +14,4 @@ class SteeringEncoderInterface
virtual SteeringEncoderReading_s getLastReading() = 0;
};

#endif /* STEERING_ENCODER_INTERFACE_H */
#endif /* STEERING_ENCODER_INTERFACE_H */
3 changes: 2 additions & 1 deletion lib/interfaces/include/VCFEthernetInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "ADCInterface.h"
#include "DashboardInterface.h"
#include "PedalsSystem.h"
#include "SteeringSystem.h"

namespace VCFEthernetInterface
{
Expand All @@ -17,7 +18,7 @@ namespace VCFEthernetInterface
* @return A populated instance of the outgoing protoc struct.
*/
// hytech_msgs_VCFData_s make_vcf_data_msg(VCFData_s &shared_state);
hytech_msgs_VCFData_s make_vcf_data_msg(ADCInterface &ADCInterfaceInstance, DashboardInterface &dashInstance, PedalsSystem &pedalsInstance);
hytech_msgs_VCFData_s make_vcf_data_msg(ADCInterface &ADCInterfaceInstance, DashboardInterface &dashInstance, PedalsSystem &pedalsInstance, SteeringSystem &steeringInstance);

/**
* Function to take a populated protoc struct from VCR and update the VCF state. This is ONLY critical
Expand Down
12 changes: 7 additions & 5 deletions lib/interfaces/include/VCRInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
#include "hytech.h"
#include "FlexCAN_T4.h"


struct InverterErrorFlags_s{

veh_vec<bool> error;

};

struct InverterBusVolts_s{

veh_vec<int> voltage;
};

Expand All @@ -26,11 +24,15 @@ class VCRInterface

bool is_in_pedals_calibration_state() {return _is_in_pedals_calibration_state;}
TorqueLimit_e get_torque_limit_mode() {return _torque_limit;}

bool is_in_steering_calibration_state() {return _is_in_steering_calibration_state;} //steering and pedals calibration states are the same, so we can use the same variable for both

void receive_dash_control_data(const CAN_message_t &can_msg);

void disable_calibration_state() {_is_in_pedals_calibration_state = false;}

void disable_steering_calibration_state() {_is_in_steering_calibration_state = false;}

void receive_car_states_data(const CAN_message_t &can_msg);

void receive_inverter_status_1(const CAN_message_t &can_msg);
Expand All @@ -45,22 +47,22 @@ class VCRInterface
VehicleState_e get_vehicle_state() {return _vehicle_state_value;}
DrivetrainState_e get_drivetrain_state() {return _drivetrain_state_value;}
InverterBusVolts_s get_dc_bus_voltage() {return _bus_voltages;}

bool get_db_in_ctrl() {return _is_db_in_ctrl;}
bool get_inverter_error();

private:

bool _is_in_pedals_calibration_state = false;
bool _is_in_steering_calibration_state = false;
VehicleState_e _vehicle_state_value;
DrivetrainState_e _drivetrain_state_value;
bool _is_db_in_ctrl;
TorqueLimit_e _torque_limit = TorqueLimit_e::TCMUX_LOW_TORQUE;
InverterErrorFlags_s _inv_error_status; //creates object that reflects the inverter error status...the object
//holds the error flags for each inverter, the getter above returns True if there's an error in any of the 4
InverterBusVolts_s _bus_voltages;
InverterBusVolts_s _bus_voltages;
};

using VCRInterfaceInstance = etl::singleton<VCRInterface>;

#endif /* VCR_INTERFACE_H */
#endif /* VCR_INTERFACE_H */
1 change: 0 additions & 1 deletion lib/interfaces/src/ACUInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ void ACUInterface::receive_ACU_voltages(const CAN_message_t &can_msg)
{
BMS_VOLTAGES_t unpacked_msg;
Unpack_BMS_VOLTAGES_hytech(&unpacked_msg, can_msg.buf, can_msg.len); // NOLINT (implicitly decay pointer)

_min_cell_voltage = HYTECH_min_cell_voltage_ro_fromS(unpacked_msg.min_cell_voltage_ro);
}
2 changes: 1 addition & 1 deletion lib/interfaces/src/ADCInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,4 @@ AnalogConversion_s ADCInterface::get_brake_pressure_front() {

AnalogConversion_s ADCInterface::get_brake_pressure_rear() {
return _adc1.data.conversions[_adc_parameters.channels.brake_pressure_rear_channel];
}
}
5 changes: 3 additions & 2 deletions lib/interfaces/src/NeopixelController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void NeopixelController::set_neopixel(uint16_t id, uint32_t c)
void NeopixelController::refresh_neopixels(const PedalsSystemData_s &pedals_data, CANInterfaces &interfaces)
{
// If we are in pedals recalibration state, LIGHT UP DASHBOARD ALL RED.
if (interfaces.vcr_interface.is_in_pedals_calibration_state()) {
if (interfaces.vcr_interface.is_in_pedals_calibration_state() || interfaces.vcr_interface.is_in_steering_calibration_state()) {
set_neopixel_color(LED_ID_e::BRAKE, LED_color_e::RED);
set_neopixel_color(LED_ID_e::TORQUE_MODE, LED_color_e::RED);
set_neopixel_color(LED_ID_e::LATCH, LED_color_e::RED);
Expand Down Expand Up @@ -136,10 +136,11 @@ void NeopixelController::refresh_neopixels(const PedalsSystemData_s &pedals_data
interfaces.vcr_interface.get_dc_bus_voltage().voltage.RL > _hv_threshold_voltage ||
interfaces.vcr_interface.get_dc_bus_voltage().voltage.RR > _hv_threshold_voltage;


constexpr float glv_critical_voltage = 22.0f;

/* SHUTDOWN LEDS */
set_neopixel_color(LED_ID_e::LATCH, hv_present ? LED_color_e::PURPLE : LED_color_e::GREEN); // Unused for now
set_neopixel_color(LED_ID_e::LATCH, hv_present ? LED_color_e::PURPLE : LED_color_e::GREEN);
set_neopixel_color(LED_ID_e::IMD, interfaces.dash_interface.imd_ok ? LED_color_e::GREEN : LED_color_e::RED);
set_neopixel_color(LED_ID_e::BMS, interfaces.dash_interface.bms_ok ? LED_color_e::GREEN : LED_color_e::RED);
set_neopixel_color(LED_ID_e::SHUTDOWN, LED_color_e::OFF); // Unused for now
Expand Down
19 changes: 18 additions & 1 deletion lib/interfaces/src/VCFEthernetInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "hytech_msgs_version.h"
#include "device_fw_version.h"

hytech_msgs_VCFData_s VCFEthernetInterface::make_vcf_data_msg(ADCInterface &ADCInterfaceInstance, DashboardInterface &dashInstance, PedalsSystem &pedalsInstance)
hytech_msgs_VCFData_s VCFEthernetInterface::make_vcf_data_msg(ADCInterface &ADCInterfaceInstance, DashboardInterface &dashInstance, PedalsSystem &pedalsInstance, SteeringSystem &steeringInstance)
{
hytech_msgs_VCFData_s out;

Expand All @@ -14,6 +14,7 @@ hytech_msgs_VCFData_s VCFEthernetInterface::make_vcf_data_msg(ADCInterface &ADCI
out.has_front_suspot_data = true;
out.has_pedals_system_data = true;
out.has_steering_data = true;
out.has_steering_system_data = true;
out.has_vcf_ethernet_link_data = true;
out.has_vcf_shutdown_data = true;
out.has_brake_pressure_data = true;
Expand All @@ -30,6 +31,22 @@ hytech_msgs_VCFData_s VCFEthernetInterface::make_vcf_data_msg(ADCInterface &ADCI
out.steering_data.analog_steering_degrees = ADCInterfaceInstance.get_steering_degrees_cw().conversion;
out.steering_data.digital_steering_analog = ADCInterfaceInstance.get_steering_degrees_ccw().conversion;

//SteeringSystem
out.steering_system_data.analog_raw = steeringInstance.get_steering_system_data().analog_raw;
out.steering_system_data.digital_raw = steeringInstance.get_steering_system_data().digital_raw;
out.steering_system_data.analog_steering_angle = steeringInstance.get_steering_system_data().analog_steering_angle;
out.steering_system_data.digital_steering_angle = steeringInstance.get_steering_system_data().digital_steering_angle;
out.steering_system_data.output_steering_angle = steeringInstance.get_steering_system_data().output_steering_angle;
out.steering_system_data.analog_steering_velocity_deg_s = steeringInstance.get_steering_system_data().analog_steering_velocity_deg_s;
out.steering_system_data.digital_steering_velocity_deg_s = steeringInstance.get_steering_system_data().digital_steering_velocity_deg_s;
out.steering_system_data.digital_oor_implausibility = steeringInstance.get_steering_system_data().digital_oor_implausibility;
out.steering_system_data.analog_oor_implausibility = steeringInstance.get_steering_system_data().analog_oor_implausibility;
out.steering_system_data.sensor_disagreement_implausibility = steeringInstance.get_steering_system_data().sensor_disagreement_implausibility;
out.steering_system_data.dtheta_exceeded_analog = steeringInstance.get_steering_system_data().dtheta_exceeded_analog;
out.steering_system_data.dtheta_exceeded_digital = steeringInstance.get_steering_system_data().dtheta_exceeded_digital;
out.steering_system_data.both_sensors_fail = steeringInstance.get_steering_system_data().both_sensors_fail;
out.steering_system_data.interface_sensor_error = steeringInstance.get_steering_system_data().interface_sensor_error;

//TODO: MODIFY ETH STRUCT
// Dash
out.dash_input_state.dim_btn_is_pressed = dashInstance.get_dashboard_outputs().brightness_ctrl_btn_is_pressed;
Expand Down
Loading
Loading