Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion include/Dash_Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using VCRData_sInstance = etl::singleton<VCRData_s>;


constexpr int NEOPIXEL_CONTROL_PIN = PC14;
constexpr int NEOPIXEL_COUNT = 12; // 12 neopixeles on dashboard
constexpr int NEOPIXEL_COUNT = 16; // 12 neopixeles on dashboard



Expand Down
1 change: 0 additions & 1 deletion include/HT_FDCAN.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "stm32h750xx.h"


#include "DrivebrainInterface.h"
#include "ACUInterface.h"
#include "VCFInterface.h"
#include "VCRInterface.h"
Expand Down
9 changes: 7 additions & 2 deletions include/newDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
#include "HT_SPI.h"

#include "bitmaps.h"
#include "alysa_frames.h"

#include "SharedFirmwareTypes.h"
#include "etl/singleton.h"

// Defines
Expand All @@ -32,17 +34,20 @@ class HTX_Display
HTX_Display(uint8_t cs) : _display(cs, 320, 240) {}
void init(SPI_HandleTypeDef *hspi);
void startup();
void hytech_animation();
void hytech_animation();
void alysa_animation();
// void driver_animation(StartupAnimations);
void draw_background();
void clear_display_buffer() { _display.clearDisplayBuffer(); }
void draw_vertical_pedal_bar(float val, int initial_x_coord);
void draw_battery_bar(int percent);
void display_speeds(float rpm);
void draw_icons(uint8_t vn_status, uint8_t car_state, bool db_in_ctrl);
void display_mode(int mode);
void draw_icons(uint8_t vn_status, VehicleState_e car_state, bool db_in_ctrl);
void invert_display(bool invert_criteria);
void draw_popup(String title);
void send_display_buffer(SPI_HandleTypeDef *hspi);
void display_min_cell(float min_cell_voltage);
uint8_t current_page = 0;

private:
Expand Down
24 changes: 15 additions & 9 deletions lib/interfaces/include/ACUInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,37 @@
#include "CANInterface.h"
#include "SystemTimeInterface.h"

struct ACUData_s
{
bool bms_ok;
bool imd_ok;
volt pack_voltage;
volt min_cell_voltage;
};

class ACUInterface
{
public:
//ACUInterface() = delete;

ACUInterface(){
_acu_init_millis = sys_time::hal_millis();
_acu_data.bms_ok = true;
_acu_data.imd_ok = true;
_acu_data.pack_voltage = 460;
}

void receive_acu_ok_message(const CAN_message_t &msg);


ACUCoreData_s get_curr_data() {return _last_recvd_data;}

bool get_voltages_not_critical() {return _voltages_not_critical;}
ACUData_s get_curr_data() {return _acu_data;}

void receive_acu_voltages(const CAN_message_t &msg);

bool bms_ok = true;
bool imd_ok = true;

private:
ACUCoreData_s _last_recvd_data;
bool _voltages_not_critical = false;
ACUData_s _acu_data;


unsigned long _acu_init_millis;

};

Expand Down
7 changes: 2 additions & 5 deletions lib/interfaces/include/DashCANInterfaceImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,17 @@
#include "VCFInterface.h"
#include "ACUInterface.h"
#include "VCRInterface.h"
#include "DrivebrainInterface.h"


struct CANInterfaces {
explicit CANInterfaces(VCFInterface &vcf_int, ACUInterface &acu_int, VCRInterface &vcr_int, DrivebrainInterface &db_int)
explicit CANInterfaces(VCFInterface &vcf_int, ACUInterface &acu_int, VCRInterface &vcr_int)
: vcf_interface(vcf_int),
acu_interface(acu_int),
vcr_interface(vcr_int),
db_interface(db_int) {}
vcr_interface(vcr_int) {}

VCFInterface &vcf_interface;
ACUInterface &acu_interface;
VCRInterface &vcr_interface;
DrivebrainInterface &db_interface;
};

using CANInterfacesInstance = etl::singleton<CANInterfaces>;
Expand Down
29 changes: 0 additions & 29 deletions lib/interfaces/include/DrivebrainInterface.h

This file was deleted.

26 changes: 16 additions & 10 deletions lib/interfaces/include/NeopixelController.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,22 @@

enum LED_ID_e
{
BOTS = 0,
LAUNCH_CTRL = 1,
SHUTDOWN = 0,
INVERTER_ERR = 1,
TORQUE_MODE = 2,
BRAKE = 3,
IMD = 4,
COCKPIT_BRB = 5,
INERTIA = 6,
BMS = 7,
GLV = 8,
CRIT_CHARGE = 9,
RDY_DRIVE = 10,
MC_ERR = 11,
BMS = 4,
GLV = 5,
PACK = 6,
IMD = 7,
IMPLAUSE = 8,
RDY_DRIVE = 9,
LATCH = 10,
CRIT_CHARGE = 11,
END1 = 12,
END2 = 13,
END3 = 14,
END4 = 15
};

enum class LED_color_e
Expand All @@ -41,6 +45,8 @@ enum class LED_color_e
RED = 0xFF0000,
INIT_COLOR = 0xFF007F,
BLUE = 0xFF,
PURPLE = 0x703fab,
ORANGE = 0xf5a742,
};

class NeopixelController
Expand Down
12 changes: 5 additions & 7 deletions lib/interfaces/include/VCFInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,20 @@ class VCFInterface
bool is_mech_brake_pressed() {return _curr_data.stamped_pedals.pedals_data.mech_brake_is_active;}
bool is_drivetrain_reset_pressed() {return _curr_data.dash_input_state.mc_reset_btn_is_pressed; }
bool is_recalibrate_pedals_button_pressed() {return _curr_data.dash_input_state.preset_btn_is_pressed; }
bool is_pedals_heartbeat_not_ok() {return !_curr_data.stamped_pedals.heartbeat_ok; }

int get_control_mode() {return _control_mode;}
void reset_pedals_heartbeat();

void receive_pedals_message(const CAN_message_t& msg, unsigned long curr_millis);
void receive_dashboard_message(const CAN_message_t& msg, unsigned long curr_millis);

VCFCANInterfaceData_s get_curr_data();

void send_buzzer_start_message();
void send_recalibrate_pedals_message();
void enqueue_torque_mode_LED_message(TorqueLimit_e torque_mode);

VCFCANInterfaceData_s get_curr_data() {return _curr_data;}
private:

VCFCANInterfaceData_s _curr_data;

int _control_mode = 0;

unsigned long _max_heartbeat_interval_ms;
bool _first_received_message_heartbeat_init = false;

Expand Down
14 changes: 7 additions & 7 deletions lib/interfaces/include/VCRInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ struct MotorMechanics_s
float actual_speed; //rpm
};

struct VehicleState_s
{
uint8_t drivetrain_state;
};

class VCRInterface
{
Expand All @@ -31,15 +27,19 @@ class VCRInterface

MotorMechanics_s get_curr_wheel_data() {return _wheel_data;}

void receive_vehicle_state(const CAN_message_t &can_msg, unsigned long curr_millis);
void receive_vehicle_state(const CAN_message_t &can_msg);

VehicleState_e get_curr_car_state() {return _vehicle_state_value;}

VehicleState_s get_curr_car_state() {return _car_state;}
bool get_drivebrain_in_control() {return _is_db_in_ctrl;}

private:
TorqueLimit_e _torque_limit = TorqueLimit_e::TCMUX_LOW_TORQUE;
bool _is_in_pedals_calibration_state = false;
MotorMechanics_s _wheel_data;
VehicleState_s _car_state;
VehicleState_e _vehicle_state_value;
DrivetrainState_e _drivetrain_state_value;
bool _is_db_in_ctrl;
};


Expand Down
Loading
Loading