Skip to content

Commit

Permalink
one line does one thing and handling const correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
RCMast3r committed Sep 14, 2024
1 parent b8fb3fb commit 79637f1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/interfaces/include/ThermistorInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const int MCU15_THERM_FR_CHANNEL = 1;
class ThermistorInterface
{
private:
Thermistors<MCU15_NUM_THERMISTORS> front_thermistors;
Thermistors<MCU15_NUM_THERMISTORS> _front_thermistors;

float therm_fl;
float therm_fr;
Expand Down
21 changes: 12 additions & 9 deletions lib/interfaces/src/ThermistorInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@



ThermistorInterface::ThermistorInterface(CANBufferType *msg_output_queue) : front_thermistors()
ThermistorInterface::ThermistorInterface(CANBufferType *msg_output_queue)
{
_msg_queue = msg_output_queue;

}



void ThermistorInterface::update_front_thermistor_readings()
{
// FRONT_THERMISTORS_t front_thermistors_;
// //scale by 500 for easy packing
// front_thermistors_.thermistor_motor_fl = HYTECH_thermistor_motor_fl_toS(therm_fl);
// front_thermistors_.thermistor_motor_fr = HYTECH_thermistor_motor_fr_toS(therm_fr);
FRONT_THERMISTORS_t front_thermistors;
//scale by 500 for easy packing
front_thermistors.thermistor_motor_fl_ro = HYTECH_thermistor_motor_fl_ro_toS(therm_fl);
front_thermistors.thermistor_motor_fr_ro = HYTECH_thermistor_motor_fr_ro_toS(therm_fr);

// enqueue_CAN_front_thermistors<FRONT_THERMISTORS_t>(&front_thermistors_, &Pack_FRONT_THERMISTORS_hytech);
enqueue_CAN_front_thermistors<FRONT_THERMISTORS_t>(&front_thermistors, &Pack_FRONT_THERMISTORS_hytech);
}

template<typename U>
Expand All @@ -32,9 +31,13 @@ void ThermistorInterface::enqueue_CAN_front_thermistors(U* structure, uint32_t (
}

void ThermistorInterface::tick(const AnalogConversion_s &raw_therm_fl, const AnalogConversion_s &raw_therm_fr)

{

therm_fl = front_thermistors.get(MCU15_THERM_FL_CHANNEL).convert(raw_therm_fl.raw);
therm_fr = front_thermistors.get(MCU15_THERM_FR_CHANNEL).convert(raw_therm_fr.raw);
auto fl_channel = _front_thermistors.get(MCU15_THERM_FL_CHANNEL);
auto fr_channel = _front_thermistors.get(MCU15_THERM_FR_CHANNEL);

therm_fl = fl_channel.convert((uint16_t)raw_therm_fl.raw);
therm_fr = fr_channel.convert((uint16_t)raw_therm_fr.raw);
update_front_thermistor_readings();
}

0 comments on commit 79637f1

Please sign in to comment.