Conversation
Codecov Report
@@ Coverage Diff @@
## master #150 +/- ##
==========================================
+ Coverage 38.20% 38.27% +0.06%
==========================================
Files 69 69
Lines 3942 3977 +35
==========================================
+ Hits 1506 1522 +16
- Misses 2436 2455 +19
Continue to review full report at Codecov.
|
mifrandir
left a comment
There was a problem hiding this comment.
Couple of things to start with.
| // convert to degrees C | ||
| double temp = static_cast<double>(raw_value) / 4095; | ||
| temp = (temp * 175) - 50; | ||
| return static_cast<int8_t>(temp); |
There was a problem hiding this comment.
This seems like a convoluted way of doing this. Is there a datasheet somewhere?
Why not the following?
return std::round(static_cast<double>(raw_value) / 23.4 - 50);There was a problem hiding this comment.
You may have to recast the result to make the compiler happy. Actually, we may want to assert that the result is in bounds, e.g. by checking std::numeric_limits<int8_t>::max() or INT8_MAX.
| * @param raw_value input voltage | ||
| * @return int representation of temperature | ||
| */ | ||
| static int8_t scaleData(uint8_t raw_value); |
| data::TemperatureData temperature_data_; | ||
| }; | ||
|
|
||
| class BrakesAndSuspensionTemperature : public ITemperature { |
There was a problem hiding this comment.
I believe this should go into a separate file.
|
|
||
| void BrakesAndSuspensionTemperature::run() | ||
| { | ||
| uint16_t raw_value = pin_.read(); |
| void Temperature::run() | ||
| void AmbientTemperature::run() | ||
| { | ||
| uint16_t raw_value = pin_.read(); |
|
|
||
| using AmbientTemperaturePins = std::array<uint8_t, data::Sensors::kNumAmbientTemp>; | ||
| using BrakeTemperaturePins = std::array<uint8_t, data::Sensors::kNumBrakeTemp>; | ||
| using BrakeTemperaturePins = std::array<uint8_t, data::Sensors::kNumBrakeSuspensionTemp>; |
| static constexpr size_t kNumImus = 4; | ||
| static constexpr size_t kNumEncoders = 4; | ||
| static constexpr size_t kNumBrakePressure = 2; | ||
| static constexpr size_t kNumBrakeSuspensionTemp = 4; |
There was a problem hiding this comment.
kNumBrakeAndSuspensionTemperature
| static constexpr size_t kNumEncoders = 4; | ||
| static constexpr size_t kNumBrakePressure = 2; | ||
| static constexpr size_t kNumBrakeSuspensionTemp = 4; | ||
| static constexpr size_t kNumAmbientTemp = 1; |
#143 rewrite
Adds brakes and suspension temperatures