From 9d0b229519c6a34ea1f79d59ac33eec769dd13e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Thu, 12 May 2016 13:01:06 +0200 Subject: [PATCH] GPSProvider: add SIMULATE_RTCM_OUTPUT to enable simulated RTCM output (currently disabled) --- src/GPS/GPSProvider.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/GPS/GPSProvider.cc b/src/GPS/GPSProvider.cc index 44121945a..a991ad689 100644 --- a/src/GPS/GPSProvider.cc +++ b/src/GPS/GPSProvider.cc @@ -18,9 +18,25 @@ #include "Drivers/src/gps_helper.h" #include "definitions.h" +//#define SIMULATE_RTCM_OUTPUT //if defined, generate simulated RTCM messages + //additionally make sure to call connectGPS(""), eg. from QGCToolbox.cc + void GPSProvider::run() { +#ifdef SIMULATE_RTCM_OUTPUT + const int fakeMsgLengths[3] = { 30, 170, 240 }; + uint8_t* fakeData = new uint8_t[fakeMsgLengths[2]]; + while (!_requestStop) { + for (int i = 0; i < 3; ++i) { + gotRTCMData((uint8_t*) fakeData, fakeMsgLengths[i]); + msleep(4); + } + msleep(100); + } + delete[] fakeData; +#endif /* SIMULATE_RTCM_OUTPUT */ + if (_serial) delete _serial; _serial = new QSerialPort(); -- 2.22.0