From ec87ac16a26c5f7e7974b5c3ce84ab4f5db683fd Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 1 Apr 2013 14:58:35 +0200 Subject: [PATCH] ComputerSettings: move to src/Computer/ .. and split the header. --- Makefile | 4 +- build/harness.mk | 3 +- build/test.mk | 8 +- src/Audio/VegaVoice.cpp | 2 +- .../VegaVoiceSettings.cpp} | 29 +++--- .../VegaVoiceSettings.hpp} | 31 +++--- src/Blackboard/ComputerSettingsBlackboard.hpp | 2 +- src/CalculationThread.hpp | 2 +- src/Computer/AutoQNH.cpp | 2 +- src/Computer/BasicComputer.cpp | 2 +- src/Computer/CirclingComputer.cpp | 2 +- .../ConditionMonitor/ConditionMonitorSunset.cpp | 2 +- src/Computer/CuComputer.cpp | 2 +- src/Computer/Events.cpp | 2 +- src/Computer/GlideComputer.cpp | 3 +- src/Computer/GlideComputerAirData.cpp | 2 +- src/Computer/GlideComputerBlackboard.cpp | 1 - src/Computer/GlideRatioCalculator.cpp | 2 +- src/Computer/RouteComputer.cpp | 1 - .../Settings.cpp} | 24 +---- .../Settings.hpp} | 82 +--------------- src/Computer/TaskComputer.cpp | 2 +- src/Computer/ThermalBandComputer.cpp | 2 +- src/Computer/TraceComputer.cpp | 2 +- src/Computer/WarningComputer.cpp | 2 +- src/Computer/Wind/Computer.cpp | 2 +- .../Wind/Settings.cpp} | 25 ++--- src/Computer/Wind/Settings.hpp | 105 +++++++++++++++++++++ src/Dialogs/Settings/dlgBasicSettings.cpp | 2 +- src/Dialogs/Traffic/TeamCodeDialog.cpp | 2 +- src/Dialogs/Waypoint/WaypointInfoWidget.cpp | 2 +- src/Dialogs/Waypoint/dlgWaypointDetails.cpp | 1 - src/Dialogs/dlgAnalysis.cpp | 2 +- src/Gauge/GaugeFLARM.cpp | 2 +- src/Input/InputEventsActions.cpp | 2 +- src/Logger/Logger.cpp | 2 +- src/Menu/ExpandMacros.cpp | 2 +- src/Plane/PlaneGlue.cpp | 2 +- src/PopupMessage.cpp | 1 - src/Profile/ComputerProfile.cpp | 2 +- src/Renderer/AirspaceRenderer.cpp | 1 - src/Renderer/FlightStatisticsRenderer.cpp | 2 +- src/Renderer/ThermalBandRenderer.cpp | 2 +- src/Renderer/WaypointRenderer.cpp | 2 +- src/UtilsSettings.cpp | 2 +- src/Waypoint/HomeGlue.cpp | 1 - src/Waypoint/WaypointGlue.cpp | 1 - test/src/AnalyseFlight.cpp | 2 +- test/src/DebugReplay.cpp | 2 +- test/src/RunCirclingWind.cpp | 2 +- test/src/test_replay_olc.cpp | 2 +- 51 files changed, 189 insertions(+), 200 deletions(-) copy src/{Blackboard/ComputerSettingsBlackboard.hpp => Audio/VegaVoiceSettings.cpp} (70%) copy src/{Blackboard/ComputerSettingsBlackboard.hpp => Audio/VegaVoiceSettings.hpp} (68%) rename src/{ComputerSettings.cpp => Computer/Settings.cpp} (81%) rename src/{ComputerSettings.hpp => Computer/Settings.hpp} (73%) copy src/{Blackboard/ComputerSettingsBlackboard.hpp => Computer/Wind/Settings.cpp} (72%) create mode 100644 src/Computer/Wind/Settings.hpp diff --git a/Makefile b/Makefile index 8ca87cdb0..5d3bf598f 100644 --- a/Makefile +++ b/Makefile @@ -447,6 +447,7 @@ XCSOAR_SOURCES := \ $(SRC)/Computer/Wind/Store.cpp \ $(SRC)/Computer/Wind/WindEKF.cpp \ $(SRC)/Computer/Wind/WindEKFGlue.cpp \ + $(SRC)/Computer/Wind/Settings.cpp \ \ $(SRC)/CrossSection/AirspaceXSRenderer.cpp \ $(SRC)/CrossSection/TerrainXSRenderer.cpp \ @@ -617,7 +618,7 @@ XCSOAR_SOURCES := \ $(SRC)/SystemSettings.cpp \ $(SRC)/Audio/Settings.cpp \ $(SRC)/Audio/VarioSettings.cpp \ - $(SRC)/ComputerSettings.cpp \ + $(SRC)/Computer/Settings.cpp \ $(SRC)/MergeThread.cpp \ $(SRC)/CalculationThread.cpp \ $(SRC)/DisplayMode.cpp \ @@ -682,6 +683,7 @@ XCSOAR_SOURCES := \ $(SRC)/Version.cpp \ $(SRC)/Audio/Sound.cpp \ $(SRC)/Audio/VegaVoice.cpp \ + $(SRC)/Audio/VegaVoiceSettings.cpp \ $(SRC)/Compatibility/fmode.c \ $(SRC)/Profile/Profile.cpp \ $(SRC)/Profile/Earth.cpp \ diff --git a/build/harness.mk b/build/harness.mk index fee452dd3..daedbc841 100644 --- a/build/harness.mk +++ b/build/harness.mk @@ -10,7 +10,8 @@ HARNESS_SOURCES = \ $(SRC)/Replay/IgcReplay.cpp \ $(SRC)/Replay/TaskAutoPilot.cpp \ $(SRC)/Replay/AircraftSim.cpp \ - $(SRC)/ComputerSettings.cpp \ + $(SRC)/Computer/Settings.cpp \ + $(SRC)/Computer/Wind/Settings.cpp \ $(SRC)/TeamCode/Settings.cpp \ $(SRC)/Logger/Settings.cpp \ $(SRC)/Tracking/TrackingSettings.cpp \ diff --git a/build/test.mk b/build/test.mk index d62473269..6bead6491 100644 --- a/build/test.mk +++ b/build/test.mk @@ -1648,7 +1648,9 @@ RUN_MAP_WINDOW_SOURCES = \ $(SRC)/Look/NOAALook.cpp \ $(SRC)/ResourceLoader.cpp \ $(SRC)/MapSettings.cpp \ - $(SRC)/ComputerSettings.cpp \ + $(SRC)/Computer/Settings.cpp \ + $(SRC)/Computer/Wind/Settings.cpp \ + $(SRC)/Audio/VegaVoiceSettings.cpp \ $(SRC)/TeamCode/Settings.cpp \ $(SRC)/Logger/Settings.cpp \ $(SRC)/Tracking/TrackingSettings.cpp \ @@ -2181,6 +2183,7 @@ RUN_ANALYSIS_SOURCES = \ $(SRC)/Computer/AutoQNH.cpp \ $(SRC)/Computer/CirclingComputer.cpp \ $(SRC)/Computer/Wind/Computer.cpp \ + $(SRC)/Computer/Wind/Settings.cpp \ $(SRC)/Computer/ContestComputer.cpp \ $(SRC)/Computer/TraceComputer.cpp \ $(SRC)/Computer/WarningComputer.cpp \ @@ -2198,13 +2201,14 @@ RUN_ANALYSIS_SOURCES = \ $(SRC)/Computer/CuComputer.cpp \ $(SRC)/Audio/Settings.cpp \ $(SRC)/Audio/VarioSettings.cpp \ + $(SRC)/Audio/VegaVoiceSettings.cpp \ $(SRC)/UISettings.cpp \ $(SRC)/DisplaySettings.cpp \ $(SRC)/PageSettings.cpp \ $(SRC)/InfoBoxes/InfoBoxSettings.cpp \ $(SRC)/Gauge/VarioSettings.cpp \ $(SRC)/Gauge/TrafficSettings.cpp \ - $(SRC)/ComputerSettings.cpp \ + $(SRC)/Computer/Settings.cpp \ $(SRC)/TeamCode/TeamCode.cpp \ $(SRC)/TeamCode/Settings.cpp \ $(SRC)/Logger/Settings.cpp \ diff --git a/src/Audio/VegaVoice.cpp b/src/Audio/VegaVoice.cpp index d6135d465..af6272f8a 100644 --- a/src/Audio/VegaVoice.cpp +++ b/src/Audio/VegaVoice.cpp @@ -22,7 +22,7 @@ Copyright_License { */ #include "Audio/VegaVoice.hpp" -#include "ComputerSettings.hpp" +#include "VegaVoiceSettings.hpp" #include "Units/Units.hpp" #include "NMEA/Info.hpp" #include "NMEA/Derived.hpp" diff --git a/src/Blackboard/ComputerSettingsBlackboard.hpp b/src/Audio/VegaVoiceSettings.cpp similarity index 70% copy from src/Blackboard/ComputerSettingsBlackboard.hpp copy to src/Audio/VegaVoiceSettings.cpp index b8eeba945..e3e5cb3d9 100644 --- a/src/Blackboard/ComputerSettingsBlackboard.hpp +++ b/src/Audio/VegaVoiceSettings.cpp @@ -21,22 +21,17 @@ Copyright_License { } */ -#ifndef COMPUTER_SETTINGS_BLACKBOARD_HPP -#define COMPUTER_SETTINGS_BLACKBOARD_HPP +#include "VegaVoiceSettings.hpp" -#include "ComputerSettings.hpp" -#include "Compiler.h" - -class ComputerSettingsBlackboard +void +VoiceSettings::SetDefaults() { -protected: - ComputerSettings computer_settings; - -public: - gcc_const - const ComputerSettings& GetComputerSettings() const { - return computer_settings; - } -}; - -#endif + voice_climb_rate_enabled = false; + voice_terrain_enabled = false; + voice_waypoint_distance_enabled = false; + voice_task_altitude_difference_enabled = false; + voice_mac_cready_enabled = false; + voice_new_waypoint_enabled = false; + voice_in_sector_enabled = false; + voice_airspace_enabled = false; +} diff --git a/src/Blackboard/ComputerSettingsBlackboard.hpp b/src/Audio/VegaVoiceSettings.hpp similarity index 68% copy from src/Blackboard/ComputerSettingsBlackboard.hpp copy to src/Audio/VegaVoiceSettings.hpp index b8eeba945..5710a5069 100644 --- a/src/Blackboard/ComputerSettingsBlackboard.hpp +++ b/src/Audio/VegaVoiceSettings.hpp @@ -21,22 +21,21 @@ Copyright_License { } */ -#ifndef COMPUTER_SETTINGS_BLACKBOARD_HPP -#define COMPUTER_SETTINGS_BLACKBOARD_HPP - -#include "ComputerSettings.hpp" -#include "Compiler.h" - -class ComputerSettingsBlackboard -{ -protected: - ComputerSettings computer_settings; - -public: - gcc_const - const ComputerSettings& GetComputerSettings() const { - return computer_settings; - } +#ifndef XCSOAR_VEGA_VOICE_SETTINGS_HPP +#define XCSOAR_VEGA_VOICE_SETTINGS_HPP + +struct VoiceSettings { + // vegavoice stuff + bool voice_climb_rate_enabled; + bool voice_terrain_enabled; + bool voice_waypoint_distance_enabled; + bool voice_task_altitude_difference_enabled; + bool voice_mac_cready_enabled; + bool voice_new_waypoint_enabled; + bool voice_in_sector_enabled; + bool voice_airspace_enabled; + + void SetDefaults(); }; #endif diff --git a/src/Blackboard/ComputerSettingsBlackboard.hpp b/src/Blackboard/ComputerSettingsBlackboard.hpp index b8eeba945..cabeafe5b 100644 --- a/src/Blackboard/ComputerSettingsBlackboard.hpp +++ b/src/Blackboard/ComputerSettingsBlackboard.hpp @@ -24,7 +24,7 @@ Copyright_License { #ifndef COMPUTER_SETTINGS_BLACKBOARD_HPP #define COMPUTER_SETTINGS_BLACKBOARD_HPP -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" #include "Compiler.h" class ComputerSettingsBlackboard diff --git a/src/CalculationThread.hpp b/src/CalculationThread.hpp index b61966fbb..5d021cd4c 100644 --- a/src/CalculationThread.hpp +++ b/src/CalculationThread.hpp @@ -26,7 +26,7 @@ Copyright_License { #include "Thread/WorkerThread.hpp" #include "Thread/Mutex.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" class GlideComputer; diff --git a/src/Computer/AutoQNH.cpp b/src/Computer/AutoQNH.cpp index e527ee64f..8820f1ce2 100644 --- a/src/Computer/AutoQNH.cpp +++ b/src/Computer/AutoQNH.cpp @@ -24,7 +24,7 @@ Copyright_License { #include "AutoQNH.hpp" #include "NMEA/Info.hpp" #include "NMEA/Derived.hpp" -#include "ComputerSettings.hpp" +#include "Settings.hpp" #include "Engine/Waypoint/Waypoints.hpp" void diff --git a/src/Computer/BasicComputer.cpp b/src/Computer/BasicComputer.cpp index 0e9f2f06f..815612fd4 100644 --- a/src/Computer/BasicComputer.cpp +++ b/src/Computer/BasicComputer.cpp @@ -24,7 +24,7 @@ Copyright_License { #include "BasicComputer.hpp" #include "NMEA/MoreData.hpp" #include "NMEA/Derived.hpp" -#include "ComputerSettings.hpp" +#include "Settings.hpp" #include "Atmosphere/AirDensity.hpp" #define fixed_inv_g fixed(1.0/9.81) diff --git a/src/Computer/CirclingComputer.cpp b/src/Computer/CirclingComputer.cpp index 4bc58465d..6e2f189c0 100644 --- a/src/Computer/CirclingComputer.cpp +++ b/src/Computer/CirclingComputer.cpp @@ -24,7 +24,7 @@ Copyright_License { #include "CirclingComputer.hpp" #include "NMEA/MoreData.hpp" #include "NMEA/Derived.hpp" -#include "ComputerSettings.hpp" +#include "Settings.hpp" #include "Math/LowPassFilter.hpp" #include "Util/Clamp.hpp" diff --git a/src/Computer/ConditionMonitor/ConditionMonitorSunset.cpp b/src/Computer/ConditionMonitor/ConditionMonitorSunset.cpp index 1434a786b..cd9b7160a 100644 --- a/src/Computer/ConditionMonitor/ConditionMonitorSunset.cpp +++ b/src/Computer/ConditionMonitor/ConditionMonitorSunset.cpp @@ -29,7 +29,7 @@ Copyright_License { #include "Language/Language.hpp" #include "Message.hpp" #include "Math/SunEphemeris.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" bool ConditionMonitorSunset::CheckCondition(const NMEAInfo &basic, diff --git a/src/Computer/CuComputer.cpp b/src/Computer/CuComputer.cpp index 3d3d9878e..6b75c2a4b 100644 --- a/src/Computer/CuComputer.cpp +++ b/src/Computer/CuComputer.cpp @@ -22,7 +22,7 @@ Copyright_License { */ #include "CuComputer.hpp" -#include "ComputerSettings.hpp" +#include "Settings.hpp" #include "Atmosphere/Temperature.hpp" struct NMEAInfo; diff --git a/src/Computer/Events.cpp b/src/Computer/Events.cpp index d7afdb19d..88620a1fe 100644 --- a/src/Computer/Events.cpp +++ b/src/Computer/Events.cpp @@ -25,7 +25,7 @@ Copyright_License { #include "Input/InputQueue.hpp" #include "NMEA/MoreData.hpp" #include "NMEA/Derived.hpp" -#include "ComputerSettings.hpp" +#include "Settings.hpp" void GlideComputerEvents::Reset() diff --git a/src/Computer/GlideComputer.cpp b/src/Computer/GlideComputer.cpp index c400670c1..b8f891d87 100644 --- a/src/Computer/GlideComputer.cpp +++ b/src/Computer/GlideComputer.cpp @@ -22,12 +22,11 @@ Copyright_License { */ #include "GlideComputer.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" #include "NMEA/Info.hpp" #include "NMEA/Derived.hpp" #include "ConditionMonitor/ConditionMonitors.hpp" #include "GlideComputerInterface.hpp" -#include "ComputerSettings.hpp" #include "Logger/Logger.hpp" #include "Engine/Waypoint/Waypoints.hpp" diff --git a/src/Computer/GlideComputerAirData.cpp b/src/Computer/GlideComputerAirData.cpp index 4e16b5952..5a447924d 100644 --- a/src/Computer/GlideComputerAirData.cpp +++ b/src/Computer/GlideComputerAirData.cpp @@ -24,7 +24,7 @@ Copyright_License { #include "GlideComputerAirData.hpp" #include "GlideComputer.hpp" -#include "ComputerSettings.hpp" +#include "Settings.hpp" #include "Math/LowPassFilter.hpp" #include "Terrain/RasterTerrain.hpp" #include "ThermalBase.hpp" diff --git a/src/Computer/GlideComputerBlackboard.cpp b/src/Computer/GlideComputerBlackboard.cpp index a384dd3bf..2adb65ed7 100644 --- a/src/Computer/GlideComputerBlackboard.cpp +++ b/src/Computer/GlideComputerBlackboard.cpp @@ -23,7 +23,6 @@ Copyright_License { */ #include "GlideComputerBlackboard.hpp" -#include "ComputerSettings.hpp" #include "NMEA/Info.hpp" #include "NMEA/Derived.hpp" diff --git a/src/Computer/GlideRatioCalculator.cpp b/src/Computer/GlideRatioCalculator.cpp index ebfcf5d74..5cd1b0134 100644 --- a/src/Computer/GlideRatioCalculator.cpp +++ b/src/Computer/GlideRatioCalculator.cpp @@ -23,7 +23,7 @@ Copyright_License { #include "GlideRatioCalculator.hpp" #include "Math/LowPassFilter.hpp" -#include "ComputerSettings.hpp" +#include "Settings.hpp" #include "Util/Macros.hpp" #include diff --git a/src/Computer/RouteComputer.cpp b/src/Computer/RouteComputer.cpp index 1e7e9408a..04a672a91 100644 --- a/src/Computer/RouteComputer.cpp +++ b/src/Computer/RouteComputer.cpp @@ -30,7 +30,6 @@ Copyright_License { #include "NMEA/Derived.hpp" #include "NMEA/Aircraft.hpp" #include "Navigation/Aircraft.hpp" -#include "ComputerSettings.hpp" #include diff --git a/src/ComputerSettings.cpp b/src/Computer/Settings.cpp similarity index 81% rename from src/ComputerSettings.cpp rename to src/Computer/Settings.cpp index 5430f2165..149e19f5b 100644 --- a/src/ComputerSettings.cpp +++ b/src/Computer/Settings.cpp @@ -21,22 +21,13 @@ Copyright_License { } */ -#include "ComputerSettings.hpp" +#include "Settings.hpp" #include "Engine/Waypoint/Waypoint.hpp" #include "OS/Clock.hpp" #include "Asset.hpp" #include "Atmosphere/Temperature.hpp" void -WindSettings::SetDefaults() -{ - circling_wind = true; - zig_zag_wind = true; - use_external_wind = true; - manual_wind_available.Clear(); -} - -void PolarSettings::SetDefaults() { degradation_factor = fixed(1); @@ -46,19 +37,6 @@ PolarSettings::SetDefaults() } void -VoiceSettings::SetDefaults() -{ - voice_climb_rate_enabled = false; - voice_terrain_enabled = false; - voice_waypoint_distance_enabled = false; - voice_task_altitude_difference_enabled = false; - voice_mac_cready_enabled = false; - voice_new_waypoint_enabled = false; - voice_in_sector_enabled = false; - voice_airspace_enabled = false; -} - -void PlacesOfInterestSettings::ClearHome() { home_waypoint = -1; diff --git a/src/ComputerSettings.hpp b/src/Computer/Settings.hpp similarity index 73% rename from src/ComputerSettings.hpp rename to src/Computer/Settings.hpp index 69b74353d..735b42b11 100644 --- a/src/ComputerSettings.hpp +++ b/src/Computer/Settings.hpp @@ -38,6 +38,8 @@ Copyright_License { #include "Airspace/AirspaceComputerSettings.hpp" #include "TeamCode/Settings.hpp" #include "Plane/Plane.hpp" +#include "Wind/Settings.hpp" +#include "Audio/VegaVoiceSettings.hpp" #include @@ -48,72 +50,6 @@ struct Waypoint; // control of calculations, these only changed by user interface // but are used read-only by calculations -/** AutoWindMode (not in use) */ -enum AutoWindModeBits -{ - /** 0: Manual */ - AUTOWIND_NONE = 0, - /** 1: Circling */ - AUTOWIND_CIRCLING, - /** 2: ZigZag */ - AUTOWIND_ZIGZAG, - /** 3: Both */ -}; - -/** - * Wind calculator settings - */ -struct WindSettings { - /** - * Use the circling algorithm to calculate the wind? - */ - bool circling_wind; - - /** - * Use the EKF algorithm to calculate the wind? (formerly known as - * "zig zag") - */ - bool zig_zag_wind; - - /** - * If enabled, then the wind vector received from external devices - * overrides XCSoar's internal wind calculation. - */ - bool use_external_wind; - - /** - * This is the manual wind set by the pilot. Validity is set when - * changeing manual wind but does not expire. - */ - SpeedVector manual_wind; - Validity manual_wind_available; - - void SetDefaults(); - - bool IsAutoWindEnabled() const { - return circling_wind || zig_zag_wind; - } - - bool CirclingWindEnabled() const { - return circling_wind; - } - - bool ZigZagWindEnabled() const { - return zig_zag_wind; - } - - unsigned GetLegacyAutoWindMode() const { - return (circling_wind ? 0x1 : 0x0) | (zig_zag_wind ? 0x2 : 0x0); - } - - void SetLegacyAutoWindMode(unsigned mode) { - circling_wind = (mode & 0x1) != 0; - zig_zag_wind = (mode & 0x2) != 0; - } -}; - -static_assert(std::is_trivial::value, "type is not trivial"); - /** * Glide polar settings */ @@ -157,20 +93,6 @@ struct PolarSettings { } }; -struct VoiceSettings { - // vegavoice stuff - bool voice_climb_rate_enabled; - bool voice_terrain_enabled; - bool voice_waypoint_distance_enabled; - bool voice_task_altitude_difference_enabled; - bool voice_mac_cready_enabled; - bool voice_new_waypoint_enabled; - bool voice_in_sector_enabled; - bool voice_airspace_enabled; - - void SetDefaults(); -}; - /** * Options for tracking places of interest as alternates */ diff --git a/src/Computer/TaskComputer.cpp b/src/Computer/TaskComputer.cpp index c2e83b7c5..2e98222d0 100644 --- a/src/Computer/TaskComputer.cpp +++ b/src/Computer/TaskComputer.cpp @@ -29,7 +29,7 @@ Copyright_License { #include "NMEA/Aircraft.hpp" #include "NMEA/MoreData.hpp" #include "NMEA/Derived.hpp" -#include "ComputerSettings.hpp" +#include "Settings.hpp" #include diff --git a/src/Computer/ThermalBandComputer.cpp b/src/Computer/ThermalBandComputer.cpp index 65d63ec1a..0f41f71bd 100644 --- a/src/Computer/ThermalBandComputer.cpp +++ b/src/Computer/ThermalBandComputer.cpp @@ -24,7 +24,7 @@ Copyright_License { #include "ThermalBandComputer.hpp" #include "NMEA/MoreData.hpp" #include "NMEA/Derived.hpp" -#include "ComputerSettings.hpp" +#include "Settings.hpp" void ThermalBandComputer::Reset() diff --git a/src/Computer/TraceComputer.cpp b/src/Computer/TraceComputer.cpp index 445c72c46..d1bcb26a4 100644 --- a/src/Computer/TraceComputer.cpp +++ b/src/Computer/TraceComputer.cpp @@ -22,7 +22,7 @@ Copyright_License { */ #include "TraceComputer.hpp" -#include "ComputerSettings.hpp" +#include "Settings.hpp" #include "NMEA/MoreData.hpp" #include "NMEA/Derived.hpp" #include "Asset.hpp" diff --git a/src/Computer/WarningComputer.cpp b/src/Computer/WarningComputer.cpp index 4453695c3..7a58a7911 100644 --- a/src/Computer/WarningComputer.cpp +++ b/src/Computer/WarningComputer.cpp @@ -22,7 +22,7 @@ Copyright_License { */ #include "WarningComputer.hpp" -#include "ComputerSettings.hpp" +#include "Settings.hpp" #include "NMEA/Aircraft.hpp" #include "NMEA/MoreData.hpp" #include "NMEA/Derived.hpp" diff --git a/src/Computer/Wind/Computer.cpp b/src/Computer/Wind/Computer.cpp index 5dfaf071f..b567c52e3 100644 --- a/src/Computer/Wind/Computer.cpp +++ b/src/Computer/Wind/Computer.cpp @@ -22,7 +22,7 @@ Copyright_License { */ #include "Computer.hpp" -#include "ComputerSettings.hpp" +#include "Settings.hpp" #include "NMEA/MoreData.hpp" #include "NMEA/Derived.hpp" diff --git a/src/Blackboard/ComputerSettingsBlackboard.hpp b/src/Computer/Wind/Settings.cpp similarity index 72% copy from src/Blackboard/ComputerSettingsBlackboard.hpp copy to src/Computer/Wind/Settings.cpp index b8eeba945..b8f8c369a 100644 --- a/src/Blackboard/ComputerSettingsBlackboard.hpp +++ b/src/Computer/Wind/Settings.cpp @@ -21,22 +21,13 @@ Copyright_License { } */ -#ifndef COMPUTER_SETTINGS_BLACKBOARD_HPP -#define COMPUTER_SETTINGS_BLACKBOARD_HPP +#include "Settings.hpp" -#include "ComputerSettings.hpp" -#include "Compiler.h" - -class ComputerSettingsBlackboard +void +WindSettings::SetDefaults() { -protected: - ComputerSettings computer_settings; - -public: - gcc_const - const ComputerSettings& GetComputerSettings() const { - return computer_settings; - } -}; - -#endif + circling_wind = true; + zig_zag_wind = true; + use_external_wind = true; + manual_wind_available.Clear(); +} diff --git a/src/Computer/Wind/Settings.hpp b/src/Computer/Wind/Settings.hpp new file mode 100644 index 000000000..f4f374703 --- /dev/null +++ b/src/Computer/Wind/Settings.hpp @@ -0,0 +1,105 @@ +/* +Copyright_License { + + XCSoar Glide Computer - http://www.xcsoar.org/ + Copyright (C) 2000-2013 The XCSoar Project + A detailed list of copyright holders can be found in the file "AUTHORS". + + 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +} +*/ + +#ifndef XCSOAR_WIND_SETTINGS_HPP +#define XCSOAR_WIND_SETTINGS_HPP + +#include "Geo/SpeedVector.hpp" +#include "NMEA/Validity.hpp" + +#include + +#include + +struct Waypoint; + +// control of calculations, these only changed by user interface +// but are used read-only by calculations + +/** AutoWindMode (not in use) */ +enum AutoWindModeBits +{ + /** 0: Manual */ + AUTOWIND_NONE = 0, + /** 1: Circling */ + AUTOWIND_CIRCLING, + /** 2: ZigZag */ + AUTOWIND_ZIGZAG, + /** 3: Both */ +}; + +/** + * Wind calculator settings + */ +struct WindSettings { + /** + * Use the circling algorithm to calculate the wind? + */ + bool circling_wind; + + /** + * Use the EKF algorithm to calculate the wind? (formerly known as + * "zig zag") + */ + bool zig_zag_wind; + + /** + * If enabled, then the wind vector received from external devices + * overrides XCSoar's internal wind calculation. + */ + bool use_external_wind; + + /** + * This is the manual wind set by the pilot. Validity is set when + * changeing manual wind but does not expire. + */ + SpeedVector manual_wind; + Validity manual_wind_available; + + void SetDefaults(); + + bool IsAutoWindEnabled() const { + return circling_wind || zig_zag_wind; + } + + bool CirclingWindEnabled() const { + return circling_wind; + } + + bool ZigZagWindEnabled() const { + return zig_zag_wind; + } + + unsigned GetLegacyAutoWindMode() const { + return (circling_wind ? 0x1 : 0x0) | (zig_zag_wind ? 0x2 : 0x0); + } + + void SetLegacyAutoWindMode(unsigned mode) { + circling_wind = (mode & 0x1) != 0; + zig_zag_wind = (mode & 0x2) != 0; + } +}; + +static_assert(std::is_trivial::value, "type is not trivial"); + +#endif diff --git a/src/Dialogs/Settings/dlgBasicSettings.cpp b/src/Dialogs/Settings/dlgBasicSettings.cpp index 9a3743ecb..104e813a3 100644 --- a/src/Dialogs/Settings/dlgBasicSettings.cpp +++ b/src/Dialogs/Settings/dlgBasicSettings.cpp @@ -25,7 +25,7 @@ Copyright_License { #include "Dialogs/WidgetDialog.hpp" #include "Protection.hpp" #include "Blackboard/DeviceBlackboard.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" #include "Units/Units.hpp" #include "Formatter/UserUnits.hpp" #include "Atmosphere/Temperature.hpp" diff --git a/src/Dialogs/Traffic/TeamCodeDialog.cpp b/src/Dialogs/Traffic/TeamCodeDialog.cpp index 35b0877ff..9c7a26954 100644 --- a/src/Dialogs/Traffic/TeamCodeDialog.cpp +++ b/src/Dialogs/Traffic/TeamCodeDialog.cpp @@ -35,7 +35,7 @@ #include "UIGlobals.hpp" #include "FLARM/FlarmDetails.hpp" #include "FLARM/Glue.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" #include "Screen/Layout.hpp" #include "Util/StringUtil.hpp" #include "Compiler.h" diff --git a/src/Dialogs/Waypoint/WaypointInfoWidget.cpp b/src/Dialogs/Waypoint/WaypointInfoWidget.cpp index 508ecbc38..b1894d482 100644 --- a/src/Dialogs/Waypoint/WaypointInfoWidget.cpp +++ b/src/Dialogs/Waypoint/WaypointInfoWidget.cpp @@ -29,7 +29,7 @@ Copyright_License { #include "Engine/Util/Gradient.hpp" #include "NMEA/MoreData.hpp" #include "NMEA/Derived.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" #include "Math/SunEphemeris.hpp" #include "Util/StaticString.hpp" #include "Util/Macros.hpp" diff --git a/src/Dialogs/Waypoint/dlgWaypointDetails.cpp b/src/Dialogs/Waypoint/dlgWaypointDetails.cpp index 5c0147e6f..b4128c110 100644 --- a/src/Dialogs/Waypoint/dlgWaypointDetails.cpp +++ b/src/Dialogs/Waypoint/dlgWaypointDetails.cpp @@ -34,7 +34,6 @@ Copyright_License { #include "Form/Button.hpp" #include "Widget/DockWindow.hpp" #include "Engine/Waypoint/Waypoint.hpp" -#include "ComputerSettings.hpp" #include "LocalPath.hpp" #include "Screen/Canvas.hpp" #include "Screen/Bitmap.hpp" diff --git a/src/Dialogs/dlgAnalysis.cpp b/src/Dialogs/dlgAnalysis.cpp index 374db7a2e..487be16cb 100644 --- a/src/Dialogs/dlgAnalysis.cpp +++ b/src/Dialogs/dlgAnalysis.cpp @@ -32,7 +32,7 @@ Copyright_License { #include "Form/Button.hpp" #include "CrossSection/CrossSectionWindow.hpp" #include "Task/ProtectedTaskManager.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" #include "Screen/Canvas.hpp" #include "Screen/Layout.hpp" #include "Screen/Key.h" diff --git a/src/Gauge/GaugeFLARM.cpp b/src/Gauge/GaugeFLARM.cpp index ef8e67d74..fc18c77e1 100644 --- a/src/Gauge/GaugeFLARM.cpp +++ b/src/Gauge/GaugeFLARM.cpp @@ -27,7 +27,7 @@ Copyright_License { #include "FlarmTrafficWindow.hpp" #include "Blackboard/LiveBlackboard.hpp" #include "NMEA/MoreData.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" #include "PageActions.hpp" #ifdef USE_GDI diff --git a/src/Input/InputEventsActions.cpp b/src/Input/InputEventsActions.cpp index f6e67de07..5af06a0a3 100644 --- a/src/Input/InputEventsActions.cpp +++ b/src/Input/InputEventsActions.cpp @@ -49,7 +49,7 @@ doc/html/advanced/input/ALL http://xcsoar.sourceforge.net/advanced/input/ #include "LogFile.hpp" #include "Device/Parser.hpp" #include "UIState.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" #include "MapSettings.hpp" #include "Math/FastMath.h" #include "Dialogs/Dialogs.h" diff --git a/src/Logger/Logger.cpp b/src/Logger/Logger.cpp index 5d4f1b5c6..e6c18bea0 100644 --- a/src/Logger/Logger.cpp +++ b/src/Logger/Logger.cpp @@ -31,7 +31,7 @@ #include "Task/ProtectedTaskManager.hpp" #include "Engine/Task/Ordered/OrderedTask.hpp" #include "Asset.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" #include "IGCFileCleanup.hpp" void diff --git a/src/Menu/ExpandMacros.cpp b/src/Menu/ExpandMacros.cpp index 47d963186..00b8f043b 100644 --- a/src/Menu/ExpandMacros.cpp +++ b/src/Menu/ExpandMacros.cpp @@ -28,7 +28,7 @@ Copyright_License { #include "MainWindow.hpp" #include "Interface.hpp" #include "Gauge/BigTrafficWidget.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" #include "Components.hpp" #include "MapSettings.hpp" #include "Simulator.hpp" diff --git a/src/Plane/PlaneGlue.cpp b/src/Plane/PlaneGlue.cpp index ad56e0512..857aa9fe9 100644 --- a/src/Plane/PlaneGlue.cpp +++ b/src/Plane/PlaneGlue.cpp @@ -28,7 +28,7 @@ Copyright_License { #include "Polar/Polar.hpp" #include "Polar/Parser.hpp" #include "Polar/PolarGlue.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" #include /* for MAX_PATH */ diff --git a/src/PopupMessage.cpp b/src/PopupMessage.cpp index b8a9a627b..27db93ff2 100644 --- a/src/PopupMessage.cpp +++ b/src/PopupMessage.cpp @@ -31,7 +31,6 @@ Copyright_License { #include "LocalPath.hpp" #include "Audio/Sound.hpp" #include "LogFile.hpp" -#include "ComputerSettings.hpp" #include "Language/Language.hpp" #include "StatusMessage.hpp" #include "UISettings.hpp" diff --git a/src/Profile/ComputerProfile.cpp b/src/Profile/ComputerProfile.cpp index efd4667d5..62a843f40 100644 --- a/src/Profile/ComputerProfile.cpp +++ b/src/Profile/ComputerProfile.cpp @@ -27,7 +27,7 @@ Copyright_License { #include "Profile/TrackingProfile.hpp" #include "Profile/Profile.hpp" #include "ContestProfile.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" namespace Profile { static void Load(WindSettings &settings); diff --git a/src/Renderer/AirspaceRenderer.cpp b/src/Renderer/AirspaceRenderer.cpp index e5e83b00a..fa1c1440c 100644 --- a/src/Renderer/AirspaceRenderer.cpp +++ b/src/Renderer/AirspaceRenderer.cpp @@ -22,7 +22,6 @@ Copyright_License { */ #include "AirspaceRenderer.hpp" -#include "ComputerSettings.hpp" #include "MapSettings.hpp" #include "Projection/WindowProjection.hpp" #include "Screen/Canvas.hpp" diff --git a/src/Renderer/FlightStatisticsRenderer.cpp b/src/Renderer/FlightStatisticsRenderer.cpp index bf0c946fa..598d1c5dd 100644 --- a/src/Renderer/FlightStatisticsRenderer.cpp +++ b/src/Renderer/FlightStatisticsRenderer.cpp @@ -36,7 +36,7 @@ Copyright_License { #include "Formatter/TimeFormatter.hpp" #include "Units/Units.hpp" #include "Language/Language.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" #include "MapSettings.hpp" #include "GlideSolvers/GlidePolar.hpp" #include "Projection/ChartProjection.hpp" diff --git a/src/Renderer/ThermalBandRenderer.cpp b/src/Renderer/ThermalBandRenderer.cpp index 2aa511f26..e93cf494d 100644 --- a/src/Renderer/ThermalBandRenderer.cpp +++ b/src/Renderer/ThermalBandRenderer.cpp @@ -25,7 +25,7 @@ Copyright_License { #include "ChartRenderer.hpp" #include "NMEA/MoreData.hpp" #include "NMEA/Derived.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" #include "Screen/Canvas.hpp" #include "Look/ThermalBandLook.hpp" #include diff --git a/src/Renderer/WaypointRenderer.cpp b/src/Renderer/WaypointRenderer.cpp index 571ff925e..07d782c3a 100644 --- a/src/Renderer/WaypointRenderer.cpp +++ b/src/Renderer/WaypointRenderer.cpp @@ -26,7 +26,7 @@ Copyright_License { #include "WaypointIconRenderer.hpp" #include "WaypointLabelList.hpp" #include "Projection/MapWindowProjection.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" #include "Task/Visitors/TaskPointVisitor.hpp" #include "Engine/Util/Gradient.hpp" #include "Engine/Waypoint/Waypoint.hpp" diff --git a/src/UtilsSettings.cpp b/src/UtilsSettings.cpp index 782442e17..fe1d32835 100644 --- a/src/UtilsSettings.cpp +++ b/src/UtilsSettings.cpp @@ -26,7 +26,7 @@ Copyright_License { #include "Look/Look.hpp" #include "MainWindow.hpp" #include "MapWindow/GlueMapWindow.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" #include "MapSettings.hpp" #include "Terrain/RasterTerrain.hpp" #include "Waypoint/WaypointDetailsReader.hpp" diff --git a/src/Waypoint/HomeGlue.cpp b/src/Waypoint/HomeGlue.cpp index d1e8da197..f4d55c0bb 100644 --- a/src/Waypoint/HomeGlue.cpp +++ b/src/Waypoint/HomeGlue.cpp @@ -22,7 +22,6 @@ Copyright_License { */ #include "WaypointGlue.hpp" -#include "ComputerSettings.hpp" #include "Profile/Profile.hpp" #include "Blackboard/DeviceBlackboard.hpp" #include "LogFile.hpp" diff --git a/src/Waypoint/WaypointGlue.cpp b/src/Waypoint/WaypointGlue.cpp index 4800a33c4..025039bdd 100644 --- a/src/Waypoint/WaypointGlue.cpp +++ b/src/Waypoint/WaypointGlue.cpp @@ -22,7 +22,6 @@ Copyright_License { */ #include "WaypointGlue.hpp" -#include "ComputerSettings.hpp" #include "Profile/Profile.hpp" #include "Util/StringUtil.hpp" #include "LogFile.hpp" diff --git a/test/src/AnalyseFlight.cpp b/test/src/AnalyseFlight.cpp index dc8361242..ae67ac9d7 100644 --- a/test/src/AnalyseFlight.cpp +++ b/test/src/AnalyseFlight.cpp @@ -32,7 +32,7 @@ #include "JSON/GeoWriter.hpp" #include "FlightPhaseDetector.hpp" #include "FlightPhaseJSON.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" struct Result { BrokenDateTime takeoff_time, release_time, landing_time; diff --git a/test/src/DebugReplay.cpp b/test/src/DebugReplay.cpp index ab73f7eae..119f2054b 100644 --- a/test/src/DebugReplay.cpp +++ b/test/src/DebugReplay.cpp @@ -28,7 +28,7 @@ Copyright_License { #include "IO/FileLineReader.hpp" #include "OS/PathName.hpp" #include "Device/Register.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" DebugReplay::DebugReplay(NLineReader *_reader) :reader(_reader), glide_polar(fixed(1)) diff --git a/test/src/RunCirclingWind.cpp b/test/src/RunCirclingWind.cpp index 963cd023b..0616bfdc4 100644 --- a/test/src/RunCirclingWind.cpp +++ b/test/src/RunCirclingWind.cpp @@ -26,7 +26,7 @@ Copyright_License { #include "OS/Args.hpp" #include "DebugReplay.hpp" #include "Formatter/TimeFormatter.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" #include #include diff --git a/test/src/test_replay_olc.cpp b/test/src/test_replay_olc.cpp index a93f65334..60697e654 100644 --- a/test/src/test_replay_olc.cpp +++ b/test/src/test_replay_olc.cpp @@ -4,7 +4,7 @@ #include "Computer/TraceComputer.hpp" #include "Computer/FlyingComputer.hpp" #include "Engine/Contest/ContestManager.hpp" -#include "ComputerSettings.hpp" +#include "Computer/Settings.hpp" #include "OS/PathName.hpp" #include "OS/FileUtil.hpp" #include "IO/FileLineReader.hpp" -- 2.11.4.GIT