Browse Source

AP_GPS: fixed hexdigit in NMEA detector

thanks to adorus for spotting this! See issue#4255
mission-4.1.18
Andrew Tridgell 9 years ago
parent
commit
2239fd6a6e
  1. 3
      libraries/AP_GPS/AP_GPS_NMEA.cpp

3
libraries/AP_GPS/AP_GPS_NMEA.cpp

@ -94,7 +94,7 @@ const char AP_GPS_NMEA::_initialisation_blob[] = SIRF_INIT_MSG MTK_INIT_MSG UBLO
// Convenience macros ////////////////////////////////////////////////////////// // Convenience macros //////////////////////////////////////////////////////////
// //
#define DIGIT_TO_VAL(_x) (_x - '0') #define DIGIT_TO_VAL(_x) (_x - '0')
#define hexdigit(x) ((x)>9?'A'+(x):'0'+(x)) #define hexdigit(x) ((x)>9?'A'+((x)-10):'0'+(x))
AP_GPS_NMEA::AP_GPS_NMEA(AP_GPS &_gps, AP_GPS::GPS_State &_state, AP_HAL::UARTDriver *_port) : AP_GPS_NMEA::AP_GPS_NMEA(AP_GPS &_gps, AP_GPS::GPS_State &_state, AP_HAL::UARTDriver *_port) :
AP_GPS_Backend(_gps, _state, _port), AP_GPS_Backend(_gps, _state, _port),
@ -473,6 +473,7 @@ AP_GPS_NMEA::_detect(struct NMEA_detect_state &state, uint8_t data)
break; break;
case 3: case 3:
if (hexdigit(state.ck&0xF) == data) { if (hexdigit(state.ck&0xF) == data) {
state.step = 0;
return true; return true;
} }
state.step = 0; state.step = 0;

Loading…
Cancel
Save