From 605d2615e16e1af6cc5083ff8b1e6003bc2a1bc1 Mon Sep 17 00:00:00 2001
From: ptulp
Date: Sat, 16 Jun 2018 20:00:16 +0200
Subject: [PATCH] Added auto fuel handling
Added the handling of the XDR Volume message.
The layout is as follows:
$IIXDR,V,x.x,L|G|M,FUEL*
Where L= liters, G = Gallons, M = Cubic meters.
---
VERSION.cmake | 4 ++--
src/Logbook.cpp | 28 ++++++++++++++++++++++++++--
src/Logbook.h | 6 ++++--
3 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/VERSION.cmake b/VERSION.cmake
index db8d26bf..6e154dd6 100644
--- a/VERSION.cmake
+++ b/VERSION.cmake
@@ -1,4 +1,4 @@
SET(PLUGIN_VERSION_MAJOR "1")
SET(PLUGIN_VERSION_MINOR "3")
-SET(PLUGIN_VERSION_PATCH "004")
-SET(PLUGIN_VERSION_DATE "2018-06-13")
+SET(PLUGIN_VERSION_PATCH "005")
+SET(PLUGIN_VERSION_DATE "2018-06-16")
diff --git a/src/Logbook.cpp b/src/Logbook.cpp
index 87bb2929..0a1ff37c 100644
--- a/src/Logbook.cpp
+++ b/src/Logbook.cpp
@@ -110,7 +110,9 @@ Logbook::Logbook( LogbookDialog* parent, wxString data, wxString layout, wxStrin
sRPM1Source = wxEmptyString;
sRPM2Shaft = wxEmptyString;
sRPM2Source = wxEmptyString;
- rpmSentence = false;
+ rpmSentence = false;
+ sVolume = wxEmptyString;
+ dVolume = 0;
}
Logbook::~Logbook( void )
@@ -627,8 +629,25 @@ void Logbook::SetSentence( wxString &sentence )
// XDR Humidity
if (m_NMEA0183.Xdr.TransducerInfo[i].TransducerType == _T("H")) {
sHumidity = wxString::Format( _T( "%3.1f " ),xdrdata );
+ }
+ // XDR Volume
+ if (m_NMEA0183.Xdr.TransducerInfo[i].TransducerType == _T("V")) {
+ if (m_NMEA0183.Xdr.TransducerInfo[i].UnitOfMeasurement == _T("M")) {
+ xdrdata *= 1000;
+ if ( opt->vol == _T( "gal" ))
+ xdrdata = xdrdata * 0.264172;
+ }
+ if (m_NMEA0183.Xdr.TransducerInfo[i].UnitOfMeasurement == _T("L")) {
+ if ( opt->vol == _T( "gal" ))
+ xdrdata = xdrdata * 0.264172;
+ }
+ if (m_NMEA0183.Xdr.TransducerInfo[i].UnitOfMeasurement == _T("G")) {
+ if ( opt->vol == _T( "liter" ))
+ xdrdata = xdrdata * 3.7854;
+ }
+ dVolume += xdrdata;
+ sVolume = wxString::Format( _T( "%3.1f " ),dVolume );
}
-
}
}
}
@@ -1769,6 +1788,11 @@ void Logbook::appendRow( bool showlastline, bool autoline )
dialog->logGrids[1]->SetCellValue( lastRow,LogbookHTML::BARO,sPressure );
dialog->logGrids[1]->SetCellValue( lastRow,LogbookHTML::HYDRO,sHumidity );
}
+
+ dialog->logGrids[2]->SetCellValue( lastRow,LogbookHTML::FUEL,sVolume );
+ sVolume = wxEmptyString;
+ dVolume = 0;
+ getModifiedCellValue( 2, lastRow, 0, LogbookHTML::FUEL );
if ( bRPM1 )
{
diff --git a/src/Logbook.h b/src/Logbook.h
index 22fb1f6a..ee074291 100644
--- a/src/Logbook.h
+++ b/src/Logbook.h
@@ -52,7 +52,8 @@ class Logbook : public LogbookHTML
bool bTemperatureAir;
wxDateTime dtWimda;
wxString sPressure;
- wxString sHumidity;
+ wxString sHumidity;
+ wxString sVolume;
wxString sWindA;
wxString sWindT;
wxDateTime dtWindA;
@@ -90,7 +91,8 @@ class Logbook : public LogbookHTML
double maxwindA;
double minwindT;
double avgwindT;
- double maxwindT;
+ double maxwindT;
+ double dVolume;
wxString swindspeedsA;
wxString swindspeedsT;