SITL: fix labs on unsigned value subtraction

This commit is contained in:
Siddharth Purohit 2021-05-20 15:23:11 +05:30 committed by Andrew Tridgell
parent 2e41077347
commit 643fc77323
1 changed files with 1 additions and 1 deletions

View File

@ -125,7 +125,7 @@ uint32_t SITL::TSYS01::calculate_adc(float temperature) const
// temperature_for_adc(9378708); // should be 10.59
while (labs(max_adc - min_adc) > 1 && current_error > 0.05) {
while (labs(int32_t(max_adc - min_adc)) > 1 && current_error > 0.05) {
uint32_t candidate_adc;
if (bisect_down) {
candidate_adc = (min_adc+(uint64_t)current_adc)/2;