view Discovery/Inc/text_multilanguage.h @ 224:ceecabfddb57 div-fixes-3

Bugfix, deco: fix 2 (small) problems with calculated ceiling This fixes 1 trivial, and 1 not really trivial bug in the calculation of the ceiling. When simulating a bounce dive to 80m, things become clear (tried this on a CCR dive, fixed setpoint 1.2bar, about 15 minutes of bottom time). Closely watch the behavior of the ceiling data. At some point during the ascent, the ceiling begins to decrease in 10cm steps. Then suddenly (while still ascending), the ceiling increases again with 1m, does not change for some time, and then suddenly steps 1.1m less deep. While not very relevant to real deco diving, it is simply wrong. The reason for this is subtle. The algorithm used to find the ceiling is a sort of linear search, stepping down a meter, overshoot the depth, and search back in 10cm steps. It seems some numerical instability. Fixing this, was a bit more computational intensive search by stepping up down in equal steps of 10cm. But, I'm pretty sure that things can be speeded up here, as a ceiling does not change fast, so it should be not that difficult to limit the search space, or use a binary search algorithm instead. The trivial second problem fixed, is that the ceiling ends at the surface and not at 1m depth. This small issue became visible after changing the step down size above. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author Jan Mulder <jlmulder@xs4all.nl>
date Sun, 31 Mar 2019 19:35:51 +0200
parents cc9c18075e00
children 2bb1db22b5f5
line wrap: on
line source

///////////////////////////////////////////////////////////////////////////////
/// -*- coding: UTF-8 -*-
///
/// \file   Discovery/Inc/text_multilanguage.h
/// \brief  Header file of TXT Multilanguage Support
/// \author heinrichs weikamp gmbh
/// \date   20-April-2014
///
/// $Id$
///////////////////////////////////////////////////////////////////////////////
/// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
///
///     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 3 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, see <http://www.gnu.org/licenses/>.
//////////////////////////////////////////////////////////////////////////////

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef TEXT_MULTILINGUAGE_H
#define TEXT_MULTILINGUAGE_H

/* Includes ------------------------------------------------------------------*/
#include <stdint.h>

/* Exported types ------------------------------------------------------------*/

enum LANGUAGES
{
		LANGUAGE_English = 0,
		LANGUAGE_German,
		LANGUAGE_French,
		LANGUAGE_Italian,
		LANGUAGE_Espanol,
		LANGUAGE_END
};
#define NUMBER_OF_LANGUAGES LANGUAGE_END

typedef struct {
		 const uint8_t	code;
		 const uint8_t* text[NUMBER_OF_LANGUAGES];
} tText;
extern const tText text_array[];
extern const tText text_array2[];

/* Text codes ---------------------------------------------------------------*/
	enum TXT_MULTILANGUAGE
	{
		TXT_Language = '\x80',
		TXT_LanguageName,
		TXT_Depth,
		TXT_Divetime,
		TXT_MaxDepth,
		TXT_AvgDepth,
		TXT_Ceiling,
		TXT_ActualGradient,
		TXT_Stopwatch,
		TXT_Decostop,
		TXT_Nullzeit,
		TXT_ppO2,
		TXT_TTS,
		TXT_CNS,
		TXT_Temperature,
		TXT_FutureTTS,
		TXT_Gas,
		TXT_Time,
		TXT_Date,
		TXT_Format,
		TXT_Warning,
		TXT_o2Sensors,
		TXT_Brightness,
		TXT_Cave,
		TXT_Eco,
		TXT_Normal,
		TXT_Bright,
		TXT_Ultrabright,
		/* */
		TXT_OC_Gas_Edit,
		TXT_Diluent_Gas_Edit,
		TXT_Mix,
		TXT_First,
		TXT_Deco,
		TXT_Travel,
		TXT_Inactive,
		TXT_ChangeDepth,
		TXT_Active,
		TXT_Default,
		TXT_Type,
		/* */
		TXT_Setpoint_Edit,
		/* */
		TXT_DecoAlgorithm,
		TXT_ZHL16GF,
		TXT_aGF,
		TXT_VPM,
		TXT_SafetyStop,
		TXT_low_high,
		TXT_ppO2Name,
		TXT_Minimum,
		TXT_Maximum,
		TXT_Minutes,
		TXT_Seconds,
		TXT_CCRmode,
		TXT_AtemGasVorrat,
		TXT_LiterproMinute,
		TXT_Reserve,
		TXT_Salinity,
		TXT_DiveMode,
		TXT_OpenCircuit,
		TXT_ClosedCircuit,
		TXT_Apnoe,
		TXT_Gauge,
		TXT_Sensor,
		TXT_FixedSP,
		TXT_Decoparameters,
		TXT_LastDecostop,
		TXT_Fallback,
		/* */
		TXT_DateAndTime,
		TXT_DateConfig,
		TXT_TimeConfig,
		TXT_Daylightsaving,
		/* */
		TXT_Logbook,
		TXT_LogbookEmpty,
		/* */
		TXT_Start_Calculation,
		/* */
		TXT_Information,
		/* */
		TXT_END,
		/* */
		// unused TXT_Conservatism,
		// unused TXT_enter,
		// unused TXT_down,
		// unused TXT_Change,
		// unused TXT_Luftintegration,
		// unused TXT_FirmwareUpdate,
		// unused TXT_ppo2_setting,
		// unused TXT_Yes,
		// unused TXT_No,

		TXT_MINIMAL = '\xFE',
		TXT_2BYTE 	= '\xFF',
	};

/* Text codes ---------------------------------------------------------------*/
/* don't use the chars before as those break if(text == '\n') etc. pp.*/
	enum TXT2BYTE_MULTILANGUAGE
	{
		TXT2BYTE_START = '\x1F',
		TXT2BYTE_ResetMenu,
		TXT2BYTE_LogbookOffset,
		TXT2BYTE_AreYouSure,
		TXT2BYTE_Abort,
		TXT2BYTE_RebootRTE,
		TXT2BYTE_ResetAll,
		TXT2BYTE_ResetDeco,
		TXT2BYTE_ResetLogbook,
		TXT2BYTE_RebootMainCPU,
		TXT2BYTE_Exit,
		/* */
		TXT2BYTE_ShowDebug,
		TXT2BYTE_PleaseUpdate,
		TXT2BYTE_RTE,
		TXT2BYTE_Fonts,
		/* */
		TXT2BYTE_ResetStopwatch,
		TXT2BYTE_SetMarker,
		TXT2BYTE_CompassHeading,
		/* */
		TXT2BYTE_Simulator,
		TXT2BYTE_StartSimulator,
		TXT2BYTE_Intervall,
		TXT2BYTE_SimDiveTime,
		TXT2BYTE_SimMaxDepth,
		TXT2BYTE_SimTravelGas,
		TXT2BYTE_SimDecoGas,
		TXT2BYTE_SimConsumption,
		TXT2BYTE_SimSummary,
		TXT2BYTE_SimDecTo,
		TXT2BYTE_SimLevel,
		TXT2BYTE_SimAscTo,
		TXT2BYTE_SimSurface,
		TXT2BYTE_CalculateDeco,
		TXT2BYTE_Calculating,
		TXT2BYTE_PleaseWait,

		/* */
		TXT2BYTE_Decolist,
		/* */
		TXT2BYTE_Bluetooth,
		TXT2BYTE_ButtonSensitivity,
		TXT2BYTE_SpecialDiveGas,
		TXT2BYTE_SpecialDiveGasMenu,
		TXT2BYTE_SpecialDiveGasMenuCCR,
		TXT2BYTE_CompassCalib,
		TXT2BYTE_UseSensor,
		/* */
		TXT2BYTE_WarnDecoMissed,
		TXT2BYTE_WarnPPO2Low,
		TXT2BYTE_WarnPPO2High,
		TXT2BYTE_WarnBatteryLow,
		TXT2BYTE_WarnSensorLinkLost,
		TXT2BYTE_WarnFallback,
		TXT2BYTE_WarnCnsHigh,
		/* */
		TXT2BYTE_O2monitor,
		TXT2BYTE_O2voltage,
		TXT2BYTE_Tissues,
		TXT2BYTE_Nitrogen,
		TXT2BYTE_Helium,
		TXT2BYTE_CNS,
		TXT2BYTE_OTU,
		TXT2BYTE_Profile,
		TXT2BYTE_Compass,
		TXT2BYTE_SafetyStop2,
		TXT2BYTE_noFly,
		TXT2BYTE_Desaturation,
		TXT2BYTE_TimeSinceLastDive,
		TXT2BYTE_ButtonLogbook,
		TXT2BYTE_ButtonMenu,
		TXT2BYTE_ButtonView,
		TXT2BYTE_ButtonBack,
		TXT2BYTE_ButtonEnter,
		TXT2BYTE_ButtonNext,
		TXT2BYTE_ButtonMinus,
		TXT2BYTE_ButtonPlus,
		TXT2BYTE_SimFollowDecoStops,
		/* */
		TXT2BYTE_Usage_Battery,
		TXT2BYTE_Usage_Dives,
		TXT2BYTE_Usage_Environment,
		/* */
		TXT2BYTE_ChargeCycles,
		TXT2BYTE_LowestVoltage,
		TXT2BYTE_HoursOfOperation,
		TXT2BYTE_NumberOfDives,
		TXT2BYTE_AmbientTemperature,
		/* */
		TXT2BYTE_Bottle,
		TXT2BYTE_WirelessSender,
		TXT2BYTE_WirelessDisconnect,
		/* */
		TXT2BYTE_Gaslist,
		TXT2BYTE_Clock,
		TXT2BYTE_Sunday,
		TXT2BYTE_Monday,
		TXT2BYTE_Tuesday,
		TXT2BYTE_Wednesday,
		TXT2BYTE_Thursday,
		TXT2BYTE_Friday,
		TXT2BYTE_Saturday,
		/* */
		TXT2BYTE_Layout,
		TXT2BYTE_Units,
		TXT2BYTE_Units_metric,
		TXT2BYTE_Units_feet,
		TXT2BYTE_Farbschema,
		TXT2BYTE_Customviews,
		TXT2BYTE_CViewTimeout,
		TXT2BYTE_CViewStandard,
		TXT2BYTE_CornerTimeout,
		TXT2BYTE_CornerStandard,
		TXT2BYTE_SetToMOD,
		/* */
		TXT2BYTE_HUDbattery,
		TXT2BYTE_LowerIsLess,
		TXT2BYTE_DiveMenuQ,
		TXT2BYTE_DiveQuitQ,
		TXT2BYTE_DiveBearingQ,
		TXT2BYTE_DiveResetAvgQ,
		/* */
		TXT2BYTE_ExtraDisplay,
		TXT2BYTE_ExtraBigFont,
		TXT2BYTE_ExtraDecoGame,
		TXT2BYTE_ExtraNone,
		/* */
		TXT2BYTE_DecoDataLost,
		TXT2BYTE_Info,
		TXT2BYTE_Korrekturwerte,
		TXT2BYTE_SetBearing,
		TXT2BYTE_ResetBearing,
		TXT2BYTE_Sensor,
		TXT2BYTE_Maintenance,
		TXT2BYTE_SetBatteryCharge,
		TXT2BYTE_SetFactoryDefaults,
		TXT2BYTE_Reboot,
		TXT2BYTE_ButtonLeft,
		TXT2BYTE_ButtonMitte,
		TXT2BYTE_ButtonRight,
		/* */
		TXT2BYTE_Summary,
		TXT2BYTE_ApneaLast,
		TXT2BYTE_ApneaTotal,
		TXT2BYTE_ApneaSurface,
		/* */
		TXT2BYTE_FLIPDISPLAY,
		TXT2BYTE_END

		// unused TXT2BYTE_Button1,
		// unused TXT2BYTE_Button2,
		// unused TXT2BYTE_Button3,
		// unused TXT2BYTE_Button4,

};

#endif /* TEXT_MULTILINGUAGE_H */