AP_GPS_SBF: add init string and increase union size

This commit is contained in:
Michael Oborne 2015-09-04 06:41:29 +08:00 committed by Andrew Tridgell
parent a057a8a009
commit 993904f01c
3 changed files with 13 additions and 7 deletions

View File

@ -215,6 +215,14 @@ AP_GPS::detect_instance(uint8_t instance)
state[instance].status = NO_GPS;
state[instance].hdop = 9999;
#if GPS_RTK_AVAILABLE
// by default the sbf gps outputs no data on its port, until configured.
if (_type[instance] == GPS_TYPE_SBF) {
hal.console->print_P(PSTR(" SBF "));
new_gps = new AP_GPS_SBF(*this, state[instance], _port[instance]);
}
#endif // GPS_RTK_AVAILABLE
// record the time when we started detection. This is used to try
// to avoid initialising a uBlox as a NMEA GPS
if (dstate->detect_started_ms == 0) {
@ -273,10 +281,6 @@ AP_GPS::detect_instance(uint8_t instance)
hal.console->print_P(PSTR(" SBP "));
new_gps = new AP_GPS_SBP(*this, state[instance], _port[instance]);
}
else if (_type[instance] == GPS_TYPE_SBF) {
hal.console->print_P(PSTR(" SBF "));
new_gps = new AP_GPS_SBF(*this, state[instance], _port[instance]);
}
#endif // HAL_CPU_CLASS
#if !defined(GPS_SKIP_SIRF_NMEA)
// save a bit of code space on a 1280

View File

@ -46,6 +46,8 @@ AP_GPS_SBF::AP_GPS_SBF(AP_GPS &_gps, AP_GPS::GPS_State &_state,
AP_GPS_Backend(_gps, _state, _port)
{
sbf_msg.sbf_state = sbf_msg_parser_t::PREAMBLE1;
port->write((const uint8_t*)_initialisation_blob[0], strlen(_initialisation_blob[0]));
}
// Process all bytes available from the stream
@ -220,8 +222,8 @@ AP_GPS_SBF::process_message(void)
// Update position state (dont use 2·10^10)
if (temp.Latitude > -200000) {
state.location.lat = (int32_t)(temp.Latitude * 57.295779513 * 1e7);
state.location.lng = (int32_t)(temp.Longitude * 57.295779513 * 1e7);
state.location.lat = (int32_t)(temp.Latitude * RAD_TO_DEG_DOUBLE * 1e7);
state.location.lng = (int32_t)(temp.Longitude * RAD_TO_DEG_DOUBLE * 1e7);
state.location.alt = (int32_t)((float)temp.Height * 1e2f);
}

View File

@ -101,7 +101,7 @@ private:
union PACKED msgbuffer {
msg4007 msg4007u;
msg4001 msg4001u;
uint8_t bytes[];
uint8_t bytes[128];
};
struct sbf_msg_parser_t