Skip to content

Commit

Permalink
merge changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RCMast3r committed Oct 20, 2024
1 parent e501659 commit 7490ed6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 35 deletions.
4 changes: 0 additions & 4 deletions lib/systems/include/DrivebrainController.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ class DrivebrainController : public Controller
float max_fault_clear_speed_m_s = 1.0,
ControllerMode_e assigned_controller_mode = ControllerMode_e::MODE_4)
{
<<<<<<< Updated upstream
_last_worst_latency_rec_time =0;
=======
_last_worst_latency_timestamp = 0;
>>>>>>> Stashed changes
_worst_latency_so_far = -1;
_params = {allowed_latency, max_fault_clear_speed_m_s, assigned_controller_mode};
}
Expand Down
10 changes: 0 additions & 10 deletions lib/systems/src/DrivebrainController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,9 @@ TorqueControllerOutput_s DrivebrainController::evaluate(const SharedCarState_s &
// Serial.println("uh");
// 3 if the time between the current MCU sys_tick.millis time and the last millis time that the drivebrain received is too high
bool message_too_latent = (::abs((int)(sys_tick.millis - db_input.DB_prev_MCU_recv_millis)) > (int)_params.allowed_latency);
<<<<<<< Updated upstream
if((sys_tick.millis - _last_worst_latency_rec_time) > 5000)
{
// Serial.print("_worst_latency_so_far ");
// Serial.println(_worst_latency_so_far);
// Serial.print("errord:");
// Serial.println(_timing_failure);
_last_worst_latency_rec_time = sys_tick.millis;
=======
if((sys_tick.millis - _last_worst_latency_timestamp) > 5000)
{
_last_worst_latency_timestamp = sys_tick.millis;
>>>>>>> Stashed changes
_worst_latency_so_far = -1;
}

Expand Down
4 changes: 0 additions & 4 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ lib_deps_shared =
git+ssh://[email protected]/hytech-racing/CASE_lib.git#v49
https://github.com/hytech-racing/shared_firmware_types.git#feb3b83
https://github.com/hytech-racing/shared_firmware_systems.git#af96a63
<<<<<<< Updated upstream
https://github.com/hytech-racing/HT_proto/releases/download/2024-10-07T23_13_48/hytech_msgs_pb_lib.tar.gz
=======
https://github.com/hytech-racing/HT_proto/releases/download/2024-10-20T18_54_37/hytech_msgs_pb_lib.tar.gz
>>>>>>> Stashed changes

[env:test_env]
platform = native
Expand Down
34 changes: 17 additions & 17 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ void tick_all_systems(const SysTick_s &current_system_tick);
/* Reset inverters */
void drivetrain_reset();

void handle_ethernet_interface_comms();
// void handle_ethernet_interface_comms(const SysTick_s &systick, const hytech_msgs_MCUOutputData &out_msg);

/*
SETUP
Expand Down Expand Up @@ -652,19 +652,19 @@ void tick_all_systems(const SysTick_s &current_system_tick)
vn_interface.get_vn_struct().vn_status);
}

void handle_ethernet_interface_comms()
{
// function that will handle receiving and distributing of all messages to all ethernet interfaces
// via the union message. this is a little bit cursed ngl.
// TODO un fuck this and make it more sane
// Serial.println("bruh");
// handle_ethernet_socket_receive(&protobuf_recv_socket, &recv_pb_stream_union_msg, ethernet_interfaces);

std::function<void(unsigned long, const uint8_t *, size_t, DrivebrainETHInterface &, const pb_msgdesc_t *)> recv_boi = &recv_pb_stream_msg<hytech_msgs_MCUCommandData, DrivebrainETHInterface>;
handle_ethernet_socket_receive<1024, hytech_msgs_MCUCommandData>(systick, &protobuf_recv_socket, recv_boi, db_eth_interface, hytech_msgs_MCUCommandData_fields);

if (systick.triggers.trigger1000)
{
handle_ethernet_socket_send_pb<hytech_msgs_MCUOutputData, 1024>(EthParams::default_TCU_ip, EthParams::default_protobuf_send_port, &protobuf_send_socket, out_msg, hytech_msgs_MCUOutputData_fields);
}
}
// void handle_ethernet_interface_comms(const SysTick_s &systick, const hytech_msgs_MCUOutputData &out_msg)
// {
// // function that will handle receiving and distributing of all messages to all ethernet interfaces
// // via the union message. this is a little bit cursed ngl.
// // TODO un fuck this and make it more sane
// // Serial.println("bruh");
// // handle_ethernet_socket_receive(&protobuf_recv_socket, &recv_pb_stream_union_msg, ethernet_interfaces);

// std::function<void(unsigned long, const uint8_t *, size_t, DrivebrainETHInterface &, const pb_msgdesc_t *)> recv_boi = &recv_pb_stream_msg<hytech_msgs_MCUCommandData, DrivebrainETHInterface>;
// handle_ethernet_socket_receive<1024, hytech_msgs_MCUCommandData>(systick, &protobuf_recv_socket, recv_boi, db_eth_interface, hytech_msgs_MCUCommandData_fields);

// if (systick.triggers.trigger1000)
// {
// handle_ethernet_socket_send_pb<hytech_msgs_MCUOutputData, 1024>(EthParams::default_TCU_ip, EthParams::default_protobuf_send_port, &protobuf_send_socket, out_msg, hytech_msgs_MCUOutputData_fields);
// }
// }

0 comments on commit 7490ed6

Please sign in to comment.