diff --git a/libraries/AP_RangeFinder/AP_RangeFinder_LightWareSerial.cpp b/libraries/AP_RangeFinder/AP_RangeFinder_LightWareSerial.cpp index de0ae939a9..29b01b6ea3 100644 --- a/libraries/AP_RangeFinder/AP_RangeFinder_LightWareSerial.cpp +++ b/libraries/AP_RangeFinder/AP_RangeFinder_LightWareSerial.cpp @@ -67,7 +67,7 @@ bool AP_RangeFinder_LightWareSerial::get_reading(uint16_t &reading_cm) char c = uart->read(); if (c == '\r') { linebuf[linebuf_len] = 0; - const float dist = (float)atof(linebuf); + const float dist = strtof(linebuf, NULL); if (!is_negative(dist)) { sum += dist; valid_count++; diff --git a/libraries/AP_RangeFinder/AP_RangeFinder_NMEA.cpp b/libraries/AP_RangeFinder/AP_RangeFinder_NMEA.cpp index fed8abe0c2..de4990e050 100644 --- a/libraries/AP_RangeFinder/AP_RangeFinder_NMEA.cpp +++ b/libraries/AP_RangeFinder/AP_RangeFinder_NMEA.cpp @@ -170,12 +170,12 @@ bool AP_RangeFinder_NMEA::decode_latest_term() if (_sentence_type == SONAR_DBT) { // parse DBT messages if (_term_number == 3) { - _distance_m = atof(_term); + _distance_m = strtof(_term, NULL); } } else if (_sentence_type == SONAR_DPT) { // parse DPT messages if (_term_number == 1) { - _distance_m = atof(_term); + _distance_m = strtof(_term, NULL); } } diff --git a/libraries/AP_RangeFinder/AP_RangeFinder_Wasp.cpp b/libraries/AP_RangeFinder/AP_RangeFinder_Wasp.cpp index 1fe85af94b..ba57588f9f 100644 --- a/libraries/AP_RangeFinder/AP_RangeFinder_Wasp.cpp +++ b/libraries/AP_RangeFinder/AP_RangeFinder_Wasp.cpp @@ -108,7 +108,7 @@ bool AP_RangeFinder_Wasp::get_reading(uint16_t &reading_cm) { if (isalpha(linebuf[0])) { parse_response(); } else { - float read_value = (float)atof(linebuf); + float read_value = strtof(linebuf, NULL); if (read_value > 0) { sum += read_value; count++;