Skip to content

Commit

Permalink
Patch 11:
Browse files Browse the repository at this point in the history
• Data export :
  additional Clockticks & UTC-timestamp as well as data separator
  selectable via Preferences
• ‘TWA to Waypoint’ instrument now shows ‘min-angle’, ‘average-angle’, ‘max-angle’
  Average time can be adjusted via the already available slider of the Average Wind
  Dir.instrument
• Boat layline on/off bugfix after restart
• Version/Patch display in preferences headline
  • Loading branch information
tom-r committed Sep 8, 2019
1 parent 92a88fd commit e97aede
Show file tree
Hide file tree
Showing 22 changed files with 571 additions and 209 deletions.
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ SET(CPACK_PACKAGE_CONTACT "Tom R")

SET(BUNDLE_DATA TRUE)

INCLUDE( "VERSION.cmake" )
SET(PLUGIN_VERSION "${PLUGIN_VERSION_MAJOR}.${PLUGIN_VERSION_MINOR}.${PLUGIN_VERSION_PATCH}" )
#INCLUDE( "VERSION.cmake" )
#SET(PLUGIN_VERSION "${PLUGIN_VERSION_MAJOR}.${PLUGIN_VERSION_MINOR}.${PLUGIN_VERSION_PATCH}" )

SET(VERSION_MAJOR ${PLUGIN_VERSION_MAJOR})
SET(VERSION_MINOR "${PLUGIN_VERSION_MINOR}${PLUGIN_VERSION_PATCH}")
SET(VERSION_DATE ${PLUGIN_VERSION_DATE})
#SET(VERSION_MAJOR ${PLUGIN_VERSION_MAJOR})
#SET(VERSION_MINOR "${PLUGIN_VERSION_MINOR}${PLUGIN_VERSION_PATCH}")
#SET(VERSION_DATE ${PLUGIN_VERSION_DATE})

#SET(CMAKE_BUILD_TYPE Debug)

Expand Down
15 changes: 11 additions & 4 deletions VERSION.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
SET(PLUGIN_VERSION_MAJOR "1")
SET(PLUGIN_VERSION_MINOR "0")
SET(PLUGIN_VERSION_PATCH "010")
SET(PLUGIN_VERSION_DATE "2019-07-26")
SET(VERSION_MAJOR "1")
SET(VERSION_MINOR "0")
SET(VERSION_PATCH "11")
SET(VERSION_DATE "2019-09-08")
SET(NAME_SUFFIX "ov50")
##############################
SET(PLUGIN_VERSION_MAJOR "${VERSION_MAJOR}")
SET(PLUGIN_VERSION_MINOR "${VERSION_MINOR}")
SET(PLUGIN_VERSION_PATCH "${VERSION_PATCH}")
SET(PLUGIN_VERSION_DATE ${VERSION_DATE})
SET(PLUGIN_NAME_SUFFIX ${NAME_SUFFIX})
4 changes: 2 additions & 2 deletions buildosx/InstallOSX/tactics_pi.pkgproj.in
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@
<key>LOCATION</key>
<integer>0</integer>
<key>NAME</key>
<string>${VERBOSE_NAME}-Plugin</string>
<string>${VERBOSE_NAME}-Plugin-${NAME_SUFFIX}_${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}</string>
<key>OVERWRITE_PERMISSIONS</key>
<false/>
<key>USE_HFS+_COMPRESSION</key>
Expand Down Expand Up @@ -1334,7 +1334,7 @@
</dict>
</array>
<key>NAME</key>
<string>${VERBOSE_NAME}-Plugin_${VERSION_MAJOR}.${VERSION_MINOR}</string>
<string>${VERBOSE_NAME}-Plugin-${NAME_SUFFIX}_${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}</string>
<key>REFERENCE_FOLDER_PATH</key>
<string>.</string>
</dict>
Expand Down
21 changes: 19 additions & 2 deletions cmake/PluginConfigure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ IF (COMMAND cmake_policy)
CMAKE_POLICY(SET CMP0011 OLD)
ENDIF (COMMAND cmake_policy)

MESSAGE (STATUS "*** Staging to build ${PACKAGE_NAME} ***")
MESSAGE (STATUS "*** Building ${PACKAGE_NAME} ***")

configure_file(cmake/version.h.in ${PROJECT_SOURCE_DIR}/src/version.h)
SET(PACKAGE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}" )
#SET(PACKAGE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}" )

#SET(CMAKE_BUILD_TYPE Debug)
#SET(CMAKE_VERBOSE_MAKEFILE ON)
Expand Down Expand Up @@ -78,3 +78,20 @@ SET(BUILD_SHARED_LIBS TRUE)

FIND_PACKAGE(Gettext REQUIRED)

MESSAGE (STATUS "*** Staging to build ${PACKAGE_NAME} ***")

include ("VERSION.cmake")
configure_file(${PROJECT_SOURCE_DIR}/cmake/wxWTranslateCatalog.h.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include/wxWTranslateCatalog.h)

# Do the version.h configuration into the build output directory,
# thereby allowing building from a read-only source tree.
IF(NOT SKIP_VERSION_CONFIG)
configure_file(${PROJECT_SOURCE_DIR}/cmake/version.h.in ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include/version.h)
configure_file(cmake/wxWTranslateCatalog.h.in ${PROJECT_SOURCE_DIR}/src/wxWTranslateCatalog.h)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/include)
ENDIF(NOT SKIP_VERSION_CONFIG)

SET(PLUGIN_VERSION "${PLUGIN_VERSION_MAJOR}.${PLUGIN_VERSION_MINOR}.${PLUGIN_VERSION_PATCH}-${NAME_SUFFIX}" )

INCLUDE_DIRECTORIES(BEFORE ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/src)

7 changes: 4 additions & 3 deletions cmake/PluginPackage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@

SET(CPACK_PACKAGE_NAME "${PACKAGE_NAME}")
SET(CPACK_PACKAGE_VENDOR "opencpn.org")
SET(PACKAGE_VERSION "${PLUGIN_VERSION_MAJOR}.${PLUGIN_VERSION_MINOR}.${PLUGIN_VERSION_PATCH}-${PLUGIN_NAME_SUFFIX}" )
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${CPACK_PACKAGE_NAME} ${PACKAGE_VERSION})
SET(CPACK_PACKAGE_VERSION ${PACKAGE_VERSION})
SET(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
SET(CPACK_PACKAGE_VERSION_MAJOR ${PLUGIN_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${PLUGIN_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${PLUGIN_VERSION_PATCH})
SET(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_CURRENT_BINARY_DIR};${PACKAGE_NAME};ALL;/")
SET(CPACK_PACKAGE_EXECUTABLES OpenCPN ${PACKAGE_NAME})

Expand Down
5 changes: 4 additions & 1 deletion cmake/version.h.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#define PLUGIN_VERSION_MAJOR ${VERSION_MAJOR}
#define PLUGIN_VERSION_MINOR ${VERSION_MINOR}
#define PLUGIN_VERSION_DATE "${VERSION_DATE}"
#define PLUGIN_VERSION_PATCH ${VERSION_PATCH}
#define PLUGIN_VERSION_DATE ${VERSION_DATE}
#define PLUGIN_NAME_SUFFIX ${NAME_SUFFIX}

42 changes: 42 additions & 0 deletions cmake/wxWTranslateCatalog.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/******************************************************************************
* $Id: ocpn_draw_pi.h,v 1.0 2015/01/28 01:54:37 jongough Exp $
*
* Project: OpenCPN
* Purpose: Redefine _() macro to allow usage of catalog
* Author: Jon Gough
*
***************************************************************************
* Copyright (C) 2010 by David S. Register *
* $EMAIL$ *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************
*/
#ifndef _ODCATTRANS_H_
#define _ODCATTRANS_H_

#ifndef WXINTL_NO_GETTEXT_MACRO
#ifdef _
#undef _
#endif // _
#if wxCHECK_VERSION(3,0,0)
#define _(s) wxGetTranslation((s), wxS("opencpn-${PROJECT_NAME}"))
#else // wxCHECK_VERSION(3,0,0)
#define _(s) wxGetTranslation(wxT(s), wxT("opencpn-${PROJECT_NAME}"))
#endif // wxCHECK_VERSION(3,0,0)
#endif // WXINTL_NO_GETTEXT_MACRO

#endif
25 changes: 20 additions & 5 deletions src/avg_wind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ AvgWind::AvgWind()
m_AvgTime = 360; //value is in Seconds --> 6 min
m_DegRangePort = 0.0;
m_DegRangeStb = 0.0;
m_AvgWindDir = NAN;
for (int i = 0; i < AVG_WIND_RECORDS; i++) {
m_WindDirArray[i] = NAN;
m_signedWindDirArray[i] = NAN;
Expand Down Expand Up @@ -88,16 +89,20 @@ void AvgWind::CalcAvgWindDir(double CurWindDir)
}
m_WindDirArray[0] = CurWindDir;
double rad = (90 - CurWindDir)*M_PI / 180.;
if (m_SampleCount == 1) {
mDblsinExpSmoothWindDir->SetInitVal(sin(rad));
mDblcosExpSmoothWindDir->SetInitVal(cos(rad));
}

m_ExpsinSmoothArrayWindDir[0] = mDblsinExpSmoothWindDir->GetSmoothVal(sin(rad));
m_ExpcosSmoothArrayWindDir[0] = mDblcosExpSmoothWindDir->GetSmoothVal(cos(rad));

//Problem Norddurchgang: 355° - 10° ...
//solution via atan2 function...
//calculation of arithmetical mean value
double sinAvgDir = 0;
double cosAvgDir = 0;
rad = 0;
double sinAvgDir = 0.0;
double cosAvgDir = 0.0;
rad = 0.0;
int samples = m_SampleCount < m_AvgTime ? m_SampleCount : m_AvgTime;
for (i = 0; i < samples; i++) {
rad = (90. - m_WindDirArray[i])*M_PI / 180.;
Expand Down Expand Up @@ -154,6 +159,7 @@ int AvgWind::GetSampleCount()
{
return m_SampleCount;
}

//************************************************************************************************************************
// History of wind direction
//************************************************************************************************************************
Expand All @@ -163,7 +169,17 @@ TacticsInstrument(parent, id, title, OCPN_DBP_STC_TWD)
{
SetDrawSoloInPane(true);
m_WindDir = NAN;
m_AvgWindDir = NAN;
m_TopLineHeight = 30;
m_TitleHeight = 10;
m_SliderHeight = 0;
m_availableHeight = 0;
m_width = 0;
m_height = 0;
m_cx = 0;
m_Legend = 0;
m_ratioW = NAN;
m_ratioH = NAN;
m_IsRunning = false;
m_SampleCount = 0;
m_Legend = 3;
Expand All @@ -172,14 +188,13 @@ TacticsInstrument(parent, id, title, OCPN_DBP_STC_TWD)
m_DegRangeStb = 0.0;
wxSize size = GetClientSize();
m_cx = size.x / 2;

m_AvgTimeSlider = new wxSlider(this, wxID_ANY, m_AvgTime / 60, 6, 30, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS | wxSL_BOTTOM | wxSL_HORIZONTAL | wxFULL_REPAINT_ON_RESIZE | wxSL_VALUE_LABEL);
m_AvgTimeSlider->SetPageSize(2);
m_AvgTimeSlider->SetLineSize(2);
m_AvgTimeSlider->SetTickFreq(2);
m_AvgTimeSlider->SetValue(m_AvgTime/60);
m_AvgTimeSlider->Connect(wxEVT_COMMAND_SLIDER_UPDATED, wxCommandEventHandler(TacticsInstrument_AvgWindDir::OnAvgTimeSliderUpdated), NULL, this);
int w;
int w=0;
m_AvgTimeSlider->GetSize(&w, &m_SliderHeight);

//we process data 1/s ...
Expand Down
5 changes: 3 additions & 2 deletions src/avg_wind.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#include "instrument.h"
#include "dial.h"
#include "performance.h"

// class for calculation of the average wind direction
class AvgWind
{
public:
Expand All @@ -67,12 +67,13 @@ class AvgWind
int m_SampleCount;
double m_DegRangeStb, m_DegRangePort; //live max-, min values
int m_AvgTime; // in [secs]
double m_WindDir,m_AvgWindDir;
double m_AvgWindDir;
double m_WindDirArray[AVG_WIND_RECORDS], m_signedWindDirArray[AVG_WIND_RECORDS];
double m_ExpSmoothSignedWindDirArray[AVG_WIND_RECORDS], m_ExpsinSmoothArrayWindDir[AVG_WIND_RECORDS], m_ExpcosSmoothArrayWindDir[AVG_WIND_RECORDS]; //30 min with 60sec each
DoubleExpSmooth *mDblsinExpSmoothWindDir, *mDblcosExpSmoothWindDir;

};
// class for the AverageWind Instrument
class TacticsInstrument_AvgWindDir : public TacticsInstrument
{
public:
Expand Down
Loading

0 comments on commit e97aede

Please sign in to comment.