AP_GPS_GSOF: add second comport to base config

This commit is contained in:
Michael Oborne 2015-11-15 14:56:49 +08:00
parent 1a033f3b73
commit 2f49fa1531
2 changed files with 13 additions and 9 deletions

View File

@ -45,7 +45,10 @@ AP_GPS_GSOF::AP_GPS_GSOF(AP_GPS &_gps, AP_GPS::GPS_State &_state,
{
gsof_msg.gsof_state = gsof_msg_parser_t::STARTTX;
requestBaud();
// baud request for port 0
requestBaud(0);
// baud request for port 3
requestBaud(3);
uint32_t now = hal.scheduler->millis();
gsofmsg_time = now + 110;
@ -60,7 +63,8 @@ AP_GPS_GSOF::read(void)
if (gsofmsgreq_index < (sizeof(gsofmsgreq))) {
if (now > gsofmsg_time) {
requestGSOF(gsofmsgreq[gsofmsgreq_index]);
requestGSOF(gsofmsgreq[gsofmsgreq_index], 0);
requestGSOF(gsofmsgreq[gsofmsgreq_index], 3);
gsofmsg_time = now + 110;
gsofmsgreq_index++;
}
@ -132,11 +136,11 @@ AP_GPS_GSOF::parse(uint8_t temp)
}
void
AP_GPS_GSOF::requestBaud()
AP_GPS_GSOF::requestBaud(uint8_t portindex)
{
uint8_t buffer[19] = {0x02,0x00,0x64,0x0d,0x00,0x00,0x00, // application file record
0x03, 0x00, 0x01, 0x00, // file control information block
0x02, 0x04, 0x00, 0x07, 0x00,0x00, // serial port baud format
0x02, 0x04, portindex, 0x07, 0x00,0x00, // serial port baud format
0x00,0x03
}; // checksum
@ -153,11 +157,11 @@ AP_GPS_GSOF::requestBaud()
}
void
AP_GPS_GSOF::requestGSOF(uint8_t messagetype)
AP_GPS_GSOF::requestGSOF(uint8_t messagetype, uint8_t portindex)
{
uint8_t buffer[21] = {0x02,0x00,0x64,0x0f,0x00,0x00,0x00, // application file record
0x03,0x00,0x01,0x00, // file control information block
0x07,0x06,0x0a,0x00,0x01,0x00,0x01,0x00, // output message record
0x07,0x06,0x0a,portindex,0x01,0x00,0x01,0x00, // output message record
0x00,0x03
}; // checksum
@ -239,7 +243,7 @@ AP_GPS_GSOF::SwapUint16(uint8_t* src, uint32_t pos)
bool
AP_GPS_GSOF::process_message(void)
{
//http://www.trimble.com/EC_ReceiverHelp/V4.19/en/GSOFmessages_Overview.htm
//http://www.trimble.com/OEM_ReceiverHelp/V4.81/en/default.html#welcome.html
if (gsof_msg.packettype == 0x40) { // GSOF
#if gsof_DEBUGGING

View File

@ -42,8 +42,8 @@ private:
bool parse(uint8_t temp);
bool process_message();
void requestBaud();
void requestGSOF(uint8_t messagetype);
void requestBaud(uint8_t portindex);
void requestGSOF(uint8_t messagetype, uint8_t portindex);
double SwapDouble(uint8_t* src, uint32_t pos);
float SwapFloat(uint8_t* src, uint32_t pos);
uint32_t SwapUint32(uint8_t* src, uint32_t pos);