Skip to content

Commit

Permalink
Added auto fuel handling
Browse files Browse the repository at this point in the history
Added the handling of the XDR Volume message.
The layout is as follows:
$IIXDR,V,x.x,L|G|M,FUEL*<checksum>
Where L= liters, G = Gallons, M = Cubic meters.
  • Loading branch information
ptulp committed Jun 16, 2018
1 parent 5b8f3ed commit 605d261
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
4 changes: 2 additions & 2 deletions VERSION.cmake
Original file line number Diff line number Diff line change
@@ -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")
28 changes: 26 additions & 2 deletions src/Logbook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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 );
}

}
}
}
Expand Down Expand Up @@ -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 )
{
Expand Down
6 changes: 4 additions & 2 deletions src/Logbook.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -90,7 +91,8 @@ class Logbook : public LogbookHTML
double maxwindA;
double minwindT;
double avgwindT;
double maxwindT;
double maxwindT;
double dVolume;
wxString swindspeedsA;
wxString swindspeedsT;

Expand Down

0 comments on commit 605d261

Please sign in to comment.