From 98d4c85295a831107d72eee90e084bda5d4c0e65 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Tue, 4 Jun 2019 17:38:00 -0700 Subject: [PATCH 1/7] Fix detection of last timestamp --- src/comm/LogReplayLink.cc | 56 ++++++++++++++++++++++++++++------------------- src/comm/LogReplayLink.h | 3 ++- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/src/comm/LogReplayLink.cc b/src/comm/LogReplayLink.cc index a97a84b..f10ca07 100644 --- a/src/comm/LogReplayLink.cc +++ b/src/comm/LogReplayLink.cc @@ -215,7 +215,9 @@ quint64 LogReplayLink::_seekToNextMavlinkMessage(mavlink_message_t* nextMsg) mavlink_status_t status; qint64 messageStartPos = -1; - while (_logFile.getChar(&nextByte)) { // Loop over every byte + mavlink_reset_channel_status(_mavlinkChannel); + + while (_logFile.getChar(&nextByte)) { bool messageFound = mavlink_parse_char(_mavlinkChannel, nextByte, nextMsg, &status); if (status.parse_state == MAVLINK_PARSE_STATE_GOT_STX) { @@ -235,6 +237,31 @@ quint64 LogReplayLink::_seekToNextMavlinkMessage(mavlink_message_t* nextMsg) return 0; } +quint64 LogReplayLink::_findLastTimestamp(void) +{ + char nextByte; + mavlink_status_t status; + quint64 lastTimestamp = 0; + mavlink_message_t msg; + + // We read through the entire file looking for the last good timestamp. This can be somewhat slow, but trying to work from the + // end of the file can be way slower due to all the seeking back and forth required. So instead we take the simple reliable approach. + + _logFile.reset(); + mavlink_reset_channel_status(_mavlinkChannel); + + while (_logFile.bytesAvailable() > cbTimestamp) { + lastTimestamp = _parseTimestamp(_logFile.read(cbTimestamp)); + + bool endOfMessage = false; + while (!endOfMessage && _logFile.getChar(&nextByte)) { + endOfMessage = mavlink_parse_char(_mavlinkChannel, nextByte, &msg, &status); + } + } + + return lastTimestamp; +} + bool LogReplayLink::_loadLogFile(void) { QString errorMsg; @@ -258,28 +285,11 @@ bool LogReplayLink::_loadLogFile(void) _logTimestamped = logFilename.endsWith(".tlog"); if (_logTimestamped) { - // Get the first timestamp from the log - // This should be a big-endian uint64. - QByteArray timestamp = _logFile.read(cbTimestamp); - quint64 startTimeUSecs = _parseTimestamp(timestamp); - - // Now find the last timestamp by scanning for the last MAVLink packet and - // find the timestamp before it. To do this we start searchin a little before - // the end of the file, specifically the maximum MAVLink packet size + the - // timestamp size. This guarantees that we will hit a MAVLink packet before - // the end of the file. Unfortunately, it basically guarantees that we will - // hit more than one. This is why we have to search for a bit. - qint64 fileLoc = _logFile.size() - ((MAVLINK_MAX_PACKET_LEN - cbTimestamp) * 2); - _logFile.seek(fileLoc); - quint64 endTimeUSecs = startTimeUSecs; // Set a sane default for the endtime - mavlink_message_t msg; - quint64 messageTimeUSecs; - while ((messageTimeUSecs = _seekToNextMavlinkMessage(&msg)) > endTimeUSecs) { - endTimeUSecs = messageTimeUSecs; - } - - if (endTimeUSecs == startTimeUSecs) { - errorMsg = tr("The log file '%1' is corrupt. No valid timestamps were found at the end of the file.").arg(logFilename); + quint64 startTimeUSecs = _parseTimestamp(_logFile.read(cbTimestamp)); + quint64 endTimeUSecs = _findLastTimestamp(); + + if (endTimeUSecs <= startTimeUSecs) { + errorMsg = tr("The log file '%1' is corrupt or empty.").arg(logFilename); goto Error; } diff --git a/src/comm/LogReplayLink.h b/src/comm/LogReplayLink.h index 6f369b3..fecb77a 100644 --- a/src/comm/LogReplayLink.h +++ b/src/comm/LogReplayLink.h @@ -115,6 +115,7 @@ private: void _replayError(const QString& errorMsg); quint64 _parseTimestamp(const QByteArray& bytes); quint64 _seekToNextMavlinkMessage(mavlink_message_t* nextMsg); + quint64 _findLastTimestamp(void); quint64 _readNextMavlinkMessage(QByteArray& bytes); bool _loadLogFile(void); void _finishPlayback(void); @@ -131,7 +132,7 @@ private: LogReplayLinkConfiguration* _logReplayConfig; bool _connected; - int _mavlinkChannel; + uint8_t _mavlinkChannel; QTimer _readTickTimer; ///< Timer which signals a read of next log record QString _errorTitle; ///< Title for communicatorError signals From 189a0d2573dfe558d0d9d43a6d21ae1357ce5c5b Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Tue, 4 Jun 2019 21:08:45 -0700 Subject: [PATCH 2/7] Fix android build --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 5030b4b..6ebda7b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,7 @@ matrix: services: xvfb sudo: required - os: android + dist: trusty language: android env: SPEC=android-g++ CONFIG=installer sudo: false From e4a1eae4489ff41537b37aba244f04aee0683025 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Fri, 7 Jun 2019 10:38:41 -0700 Subject: [PATCH 3/7] Switch to mini dump --- deploy/qgroundcontrol_installer.nsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/qgroundcontrol_installer.nsi b/deploy/qgroundcontrol_installer.nsi index e1ede48..60ee267 100644 --- a/deploy/qgroundcontrol_installer.nsi +++ b/deploy/qgroundcontrol_installer.nsi @@ -78,7 +78,7 @@ doinstall: WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$\"$INSTDIR\${EXENAME}-Uninstall.exe$\"" SetRegView 64 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\${EXENAME}.exe" "DumpCount" 5 - WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\${EXENAME}.exe" "DumpType" 2 + WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\${EXENAME}.exe" "DumpType" 1 WriteRegExpandStr HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\${EXENAME}.exe" "DumpFolder" "%LOCALAPPDATA%\QGCCrashDumps" ; Only attempt to install the PX4 driver if the version isn't present From f21fa39670a5aef068babde7c0a6614689a9a4e3 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Thu, 13 Jun 2019 10:55:12 -0700 Subject: [PATCH 4/7] Always install PX4 Drivers --- ChangeLog.md | 4 +++- deploy/qgroundcontrol_installer.nsi | 22 +--------------------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 468917c..f2311cd 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -8,7 +8,9 @@ Note: This file only contains high level features or important fixes. * Major rewrite and bug fix pass through Structure Scan. Previous version had such bad problems that it can no longer be supported. Plans with Structure Scan will need to be recreated. New QGC will not load old Structure Scan plans. -### 3.5.3 - Not yet released +### 3.5.3 - Stable +* Change Crash Dump to mini-dumps +* Always install PX4 drivers, even if already there * Fix crash when clicking on GeoFence polygon vertex * PX4: Fix missing ```MC_YAW_FF``` parameter in PID Tuning * ArduPilot: Fix parameter file save generating bad characters from git hash diff --git a/deploy/qgroundcontrol_installer.nsi b/deploy/qgroundcontrol_installer.nsi index 60ee267..bc48f26 100644 --- a/deploy/qgroundcontrol_installer.nsi +++ b/deploy/qgroundcontrol_installer.nsi @@ -78,29 +78,9 @@ doinstall: WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$\"$INSTDIR\${EXENAME}-Uninstall.exe$\"" SetRegView 64 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\${EXENAME}.exe" "DumpCount" 5 - WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\${EXENAME}.exe" "DumpType" 1 + WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\${EXENAME}.exe" "DumpType" 2 WriteRegExpandStr HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\${EXENAME}.exe" "DumpFolder" "%LOCALAPPDATA%\QGCCrashDumps" - - ; Only attempt to install the PX4 driver if the version isn't present - !define ROOTKEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\434608CF2B6E31F0DDBA5C511053F957B55F098E" - - SetRegView 64 - ReadRegStr $0 HKLM "${ROOTKEY}" "Publisher" - StrCmp $0 "3D Robotics" found_provider notfound - -found_provider: - ReadRegStr $0 HKLM "${ROOTKEY}" "DisplayVersion" - DetailPrint "Checking USB driver version... $0" - StrCmp $0 "04/11/2013 2.0.0.4" skip_driver notfound - -notfound: - DetailPrint "USB Driver not found... installing" ExecWait '"msiexec" /i "px4driver.msi"' - goto done - -skip_driver: - DetailPrint "USB Driver found... skipping install" -done: SetRegView lastused SectionEnd From 39bbe3153c5a1f754089e179160e4887b9d513e2 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Thu, 13 Jun 2019 14:58:34 -0700 Subject: [PATCH 5/7] Revert "Windows: Always install PX4 Drivers" --- ChangeLog.md | 4 +--- deploy/qgroundcontrol_installer.nsi | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index f2311cd..468917c 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -8,9 +8,7 @@ Note: This file only contains high level features or important fixes. * Major rewrite and bug fix pass through Structure Scan. Previous version had such bad problems that it can no longer be supported. Plans with Structure Scan will need to be recreated. New QGC will not load old Structure Scan plans. -### 3.5.3 - Stable -* Change Crash Dump to mini-dumps -* Always install PX4 drivers, even if already there +### 3.5.3 - Not yet released * Fix crash when clicking on GeoFence polygon vertex * PX4: Fix missing ```MC_YAW_FF``` parameter in PID Tuning * ArduPilot: Fix parameter file save generating bad characters from git hash diff --git a/deploy/qgroundcontrol_installer.nsi b/deploy/qgroundcontrol_installer.nsi index bc48f26..60ee267 100644 --- a/deploy/qgroundcontrol_installer.nsi +++ b/deploy/qgroundcontrol_installer.nsi @@ -78,9 +78,29 @@ doinstall: WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$\"$INSTDIR\${EXENAME}-Uninstall.exe$\"" SetRegView 64 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\${EXENAME}.exe" "DumpCount" 5 - WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\${EXENAME}.exe" "DumpType" 2 + WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\${EXENAME}.exe" "DumpType" 1 WriteRegExpandStr HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\${EXENAME}.exe" "DumpFolder" "%LOCALAPPDATA%\QGCCrashDumps" + + ; Only attempt to install the PX4 driver if the version isn't present + !define ROOTKEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\434608CF2B6E31F0DDBA5C511053F957B55F098E" + + SetRegView 64 + ReadRegStr $0 HKLM "${ROOTKEY}" "Publisher" + StrCmp $0 "3D Robotics" found_provider notfound + +found_provider: + ReadRegStr $0 HKLM "${ROOTKEY}" "DisplayVersion" + DetailPrint "Checking USB driver version... $0" + StrCmp $0 "04/11/2013 2.0.0.4" skip_driver notfound + +notfound: + DetailPrint "USB Driver not found... installing" ExecWait '"msiexec" /i "px4driver.msi"' + goto done + +skip_driver: + DetailPrint "USB Driver found... skipping install" +done: SetRegView lastused SectionEnd From 8f55cd7838b65f88690c4701a52618f6b4d3cb93 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Fri, 14 Jun 2019 12:01:14 -0700 Subject: [PATCH 6/7] Change USB driver detection logic --- ChangeLog.md | 3 ++- deploy/qgroundcontrol_installer.nsi | 14 ++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 468917c..5ab0a21 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -8,7 +8,8 @@ Note: This file only contains high level features or important fixes. * Major rewrite and bug fix pass through Structure Scan. Previous version had such bad problems that it can no longer be supported. Plans with Structure Scan will need to be recreated. New QGC will not load old Structure Scan plans. -### 3.5.3 - Not yet released +### 3.5.3 - Stable +* Change Windows driver detection logic * Fix crash when clicking on GeoFence polygon vertex * PX4: Fix missing ```MC_YAW_FF``` parameter in PID Tuning * ArduPilot: Fix parameter file save generating bad characters from git hash diff --git a/deploy/qgroundcontrol_installer.nsi b/deploy/qgroundcontrol_installer.nsi index 60ee267..e58c820 100644 --- a/deploy/qgroundcontrol_installer.nsi +++ b/deploy/qgroundcontrol_installer.nsi @@ -62,6 +62,7 @@ Section ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" StrCmp $R0 "" doinstall + DetailPrint "Uninstalling previous version..." ExecWait "$R0 /S _?=$INSTDIR -LEAVE_DATA=1" IntCmp $0 0 doinstall @@ -82,24 +83,21 @@ doinstall: WriteRegExpandStr HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\${EXENAME}.exe" "DumpFolder" "%LOCALAPPDATA%\QGCCrashDumps" ; Only attempt to install the PX4 driver if the version isn't present - !define ROOTKEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\434608CF2B6E31F0DDBA5C511053F957B55F098E" + !define DRIVERKEY "SOFTWARE\MichaelOborne\driver" SetRegView 64 - ReadRegStr $0 HKLM "${ROOTKEY}" "Publisher" - StrCmp $0 "3D Robotics" found_provider notfound + ReadRegDWORD $0 HKCU "${DRIVERKEY}" "installed" + IntCmp $0 1 found_provider notfound notfound found_provider: - ReadRegStr $0 HKLM "${ROOTKEY}" "DisplayVersion" - DetailPrint "Checking USB driver version... $0" - StrCmp $0 "04/11/2013 2.0.0.4" skip_driver notfound + DetailPrint "USB Drivers already installed" + goto done notfound: DetailPrint "USB Driver not found... installing" ExecWait '"msiexec" /i "px4driver.msi"' goto done -skip_driver: - DetailPrint "USB Driver found... skipping install" done: SetRegView lastused SectionEnd From 08a023d85011ba5984137c36bfc7ed7537f83cc1 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Fri, 14 Jun 2019 12:28:35 -0700 Subject: [PATCH 7/7] Change Survey-In min accuracy --- ChangeLog.md | 1 + src/Settings/RTK.SettingsGroup.json | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 5ab0a21..cc95a44 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -9,6 +9,7 @@ Note: This file only contains high level features or important fixes. * Major rewrite and bug fix pass through Structure Scan. Previous version had such bad problems that it can no longer be supported. Plans with Structure Scan will need to be recreated. New QGC will not load old Structure Scan plans. ### 3.5.3 - Stable +* Change minimum RTK Survey-In limit to 0.01 meters * Change Windows driver detection logic * Fix crash when clicking on GeoFence polygon vertex * PX4: Fix missing ```MC_YAW_FF``` parameter in PID Tuning diff --git a/src/Settings/RTK.SettingsGroup.json b/src/Settings/RTK.SettingsGroup.json index 3b71723..72b797d 100644 --- a/src/Settings/RTK.SettingsGroup.json +++ b/src/Settings/RTK.SettingsGroup.json @@ -2,12 +2,12 @@ { "name": "surveyInAccuracyLimit", "shortDescription": "Survey in accuracy (U-blox only)", - "longDescription": "The maximum accuracy allowed prior to completing survey in.", + "longDescription": "The minimum accuracy value that Survey-In must achieve before it can complete.", "type": "double", "defaultValue": 2.0, - "min": 0.5, + "min": 0.01, "units": "m", - "decimalPlaces": 1, + "decimalPlaces": 2, "qgcRebootRequired": true }, {