sil architecture for tms - #599
ManushPatell wants to merge 4 commits into
Conversation
|
2 main things I wanted to bring up: We have a collision with the macro
I included a Secondly, since we initially used |
|
|
||
| using ::generated::can::TxBmsBroadcast; | ||
| using ::generated::can::TxTMSValues; | ||
| using ::generated::can::VehBus; |
There was a problem hiding this comment.
Don't use using in a header file. It pollutes the namespace. Write out the full path
It's ok to use in in the cc file
| return TxTMSValues{ | ||
| .val1 = static_cast<uint8_t>(temperatures[0] * 50.0f), | ||
| .val2 = static_cast<uint8_t>(temperatures[1] * 50.0f), | ||
| .val3 = static_cast<uint8_t>(temperatures[2] * 50.0f), |
There was a problem hiding this comment.
What's the 50.0 factor here?
It should be a named constant
There was a problem hiding this comment.
This factor was already implemented prior. Additionally, the logic before made no sense. Take a look:
TxTMSValues TMSBroadcast(const std::array<float, kSensorCount>& temperatures) { return TxTMSValues{ .val1 = static_cast<uint8_t>(bindings::temp_sensor_adc_1.ReadVoltage() * 50.0f), .val2 = static_cast<uint8_t>(bindings::temp_sensor_adc_2.ReadVoltage() * 50.0f), .val3 = static_cast<uint8_t>(bindings::temp_sensor_adc_3.ReadVoltage() * 50.0f), .val4 = static_cast<uint8_t>(bindings::temp_sensor_adc_4.ReadVoltage() * 50.0f), .val5 = static_cast<uint8_t>(bindings::temp_sensor_adc_5.ReadVoltage() * 50.0f), .val6 = static_cast<uint8_t>(bindings::temp_sensor_adc_6.ReadVoltage() * 50.0f), }; }
We pass in temperatures but read from bindings, which doesnt make sense. This version actually uses the passed in param
There was a problem hiding this comment.
Yeah that is pretty bad. Global variables are not good
Glad to have it fixed.
You should open a github issue "figure out what this TMS constant is"
| /** | ||
| ****************************************************************************** | ||
| * @file adc.h | ||
| * @brief This file contains all the function prototypes for |
There was a problem hiding this comment.
Regenerate the code from cubemx and run post_cubemx.sh. These files shouldn't have a git diff. They should've just been renamed
|
|
||
| using namespace mcal::stm32f; | ||
|
|
||
| AnalogInput temp_sensor_adc_1{&hadc1, SENS_1_UC_IN_CHANNEL}; |
There was a problem hiding this comment.
Good, this is exactly how bindings should be replaced
This is exactly what you should do. Each project needs to specify its dependencies. That's a good thing not "repetitive" |

No description provided.