From fb5fd79ae1eba3911892c6706c6ae700f872059c Mon Sep 17 00:00:00 2001 From: Phil Crump Date: Thu, 14 Nov 2019 18:40:19 +0000 Subject: [PATCH] ubxtool.cc: Add switch for UART ports to add baudrate and port params, else behave as before. --- ubxtool.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/ubxtool.cc b/ubxtool.cc index 10773e5..51bd8f9 100644 --- a/ubxtool.cc +++ b/ubxtool.cc @@ -682,7 +682,23 @@ int main(int argc, char** argv) if(!doKeepNMEA) { if (doDEBUG) { cerr<>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<