ubxtool.cc: Add switch for UART ports to add baudrate and port params, else behave as before.

pull/42/head
Phil Crump 2019-11-14 18:40:19 +00:00
parent 35aac1b080
commit fb5fd79ae1
1 changed files with 17 additions and 1 deletions

View File

@ -682,7 +682,23 @@ int main(int argc, char** argv)
if(!doKeepNMEA) {
if (doDEBUG) { cerr<<humanTimeNow()<<" Disabling NMEA"<<endl; }
msg = buildUbxMessage(0x06, 0x00, {(unsigned char)(ubxport),0x00,0x00,0x00,0xC0 /* 8 bit */,0x08 /* No parity */,0x00,0x00,(unsigned char)((baudrate) & 0xFF),(unsigned char)((baudrate>>8) & 0xFF),(unsigned char)((baudrate>>16) & 0xFF),(unsigned char)((baudrate >> 24) & 0xFF),0x03,0x00,0x01,0x00,0x00,0x00,0x00,0x00});
if(ubxport == 1 || ubxport == 2) {
/* Ublox UART[1] or UART2 port, so encode baudrate and serial settings */
msg = buildUbxMessage(0x06, 0x00, {(unsigned char)(ubxport),0x00,0x00,0x00,
0xC0 /* 8 bit */,
0x08 /* No parity */,
0x00,0x00,
(unsigned char)((baudrate) & 0xFF),
(unsigned char)((baudrate>>8) & 0xFF),
(unsigned char)((baudrate>>16) & 0xFF),
(unsigned char)((baudrate>>24) & 0xFF),
0x03,0x00,0x01,0x00,
0x00,0x00,0x00,0x00
});
}
else {
msg = buildUbxMessage(0x06, 0x00, {(unsigned char)(ubxport),0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x01,0x00,0x00,0x00,0x00,0x00});
}
if(sendAndWaitForUBXAckNack(fd, 10, msg, 0x06, 0x00)) { // disable NMEA
if (doDEBUG) { cerr<<humanTimeNow()<<" NMEA disabled"<<endl; }
}