annotate Discovery/Src/tMenuGas.c @ 947:96cf6c53c934 Evo_2_23

GNSS sleep mode: Backup voltage is now enabled during initialization. Power saving interval has been changed to 20 second active in a 60 minutes cycle.
author Ideenmodellierer
date Sun, 22 Dec 2024 21:14:41 +0100
parents 1b995079c045
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 /// -*- coding: UTF-8 -*-
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 /// \file Discovery/Src/tMenuGas.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief Main Template file for Menu Page Gas, OC only at the moment
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 /// \author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 /// \date 30-April-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 /// \details
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 /// $Id$
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 /// This program is free software: you can redistribute it and/or modify
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 /// it under the terms of the GNU General Public License as published by
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 /// the Free Software Foundation, either version 3 of the License, or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 /// (at your option) any later version.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /// This program is distributed in the hope that it will be useful,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 /// GNU General Public License for more details.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 /// You should have received a copy of the GNU General Public License
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 //////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 #include "tMenu.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 #include "tMenuGas.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #include "check_warning.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 #include "decom.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 #include "unit.h"
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
35 #include "configuration.h"
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 #define OCGAS_STANDARD (0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 #define OCGAS_BAILOUT_INACTIVE (1)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 #define OCGAS_BAILOUT_ACTIVE (2)
647
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
40 #define CCGAS_STANDARD (3)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 uint8_t write_gas(char *text, uint8_t oxygen, uint8_t helium);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 void tMG_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext, uint8_t start, uint8_t gasMode);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 uint32_t tMOG_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 uint8_t gas_mode;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 if((actual_menu_content == MENU_SURFACE) || (stateUsed->diveSettings.ccrOption == 0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 gas_mode = OCGAS_STANDARD;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 {
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 647
diff changeset
58 if (isLoopMode(stateUsed->diveSettings.diveMode))
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 gas_mode = OCGAS_BAILOUT_INACTIVE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 gas_mode = OCGAS_BAILOUT_ACTIVE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 tMG_refresh(line, text, tab, subtext, 0, gas_mode);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 return StMOG;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 uint32_t tMCG_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 tMG_refresh(line, text, tab, subtext, NUM_OFFSET_DILUENT, CCGAS_STANDARD);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 return StMCG;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 void tMG_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext, uint8_t start, uint8_t gasMode)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 const SGasLine * pGasLine;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77
344
3f09b283d993 Removed not used wireless menu items
ideenmodellierer
parents: 38
diff changeset
78 uint8_t gasId, oxygen, helium, depthUp, active, first, typeDeco;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 float fPpO2limitHigh = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 float fPpO2ofGasAtThisDepth = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 //uint8_t senderCode, depthDown,;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 //uint16_t bar;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 uint16_t textPointer, mod, ltr;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 if(actual_menu_content == MENU_SURFACE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 pGasLine = settingsGetPointer()->gas;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 pGasLine = stateUsed->diveSettings.gas;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 if(actualLeftMaxDepth(stateUsed))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_deco) / 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 fPpO2limitHigh = (float)(settingsGetPointer()->ppO2_max_std) / 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 textPointer = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 *tab = 158;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 if((line == 0) && (actual_menu_content == MENU_SURFACE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 strcpy(subtext,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 "\022"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 // " Travel Deco MOD Bottle"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 " First MOD Deco Bottle"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 gasId = start;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 for(int count=1;count<=NUM_GASES;count++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 gasId++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 if(line && (line != count))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 first = pGasLine[gasId].note.ub.first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 if(first == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 strcpy(&text[textPointer],
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 "\t"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 "\177"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 "*"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 "\n\r"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 textPointer += 5;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 strcpy(&text[textPointer],"\n\r");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 textPointer += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 oxygen = pGasLine[gasId].oxygen_percentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 helium = pGasLine[gasId].helium_percentage;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 depthUp = pGasLine[gasId].depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 //depthDown = pGasLine[gasId].depth_meter_travel;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 //senderCode = pGasLine[gasId].note.ub.senderCode;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 active = pGasLine[gasId].note.ub.active;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 first = pGasLine[gasId].note.ub.first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 typeDeco = pGasLine[gasId].note.ub.deco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 mod = calc_MOD(gasId);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 ltr = pGasLine[gasId].bottle_size_liter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 //bar = stateUsed->lifeData.bottle_bar[gasId];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
148 #ifdef ENABLE_UNUSED_GAS_HIDING
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
149 if(pGasLine[gasId].note.ub.off)
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
150 {
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
151 strcpy(&text[textPointer++],"\021");
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
152 }
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
153 else
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
154 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 if(active)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 if(actual_menu_content == MENU_SURFACE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 strcpy(&text[textPointer++],"\020");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 fPpO2ofGasAtThisDepth = (stateUsed->lifeData.pressure_ambient_bar - WATER_VAPOUR_PRESSURE) * pGasLine[gasId].oxygen_percentage / 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 if(fPpO2ofGasAtThisDepth > fPpO2limitHigh)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 strcpy(&text[textPointer++],"\025");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 strcpy(&text[textPointer++],"\020");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 else
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
169 {
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
170 strcpy(&text[textPointer++],"\031");
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
171 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 textPointer += write_gas(&text[textPointer], oxygen, helium);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 strcpy(&text[textPointer++],"\t");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 if(gasMode == OCGAS_BAILOUT_INACTIVE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 textPointer += snprintf(&text[textPointer], 59,\
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 "\024"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 " Bailout"
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
181 "\031"
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 "\034"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 " %3u"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 " %c%c"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 "\035"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 "\n\r",
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 unit_depth_integer(mod),
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 unit_depth_char1(),
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 unit_depth_char2()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 textPointer += snprintf(&text[textPointer], 57,\
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 "\024"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 " Bailout"
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
197 "\031"
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 "\034"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 " %3u"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 "m"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 " %2u"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 "ltr"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 " %3u"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 "bar"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 "\035"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 "\n\r",
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 mod, ltr, bar
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 if(first == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 strcpy(&text[textPointer++],"\177");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 /* color active / inactive for gas changes */
528
a9c195be907e Added new option to gas configuration: "Off":
Ideenmodellierer
parents: 344
diff changeset
223 char color[5] = {'\031','\031','\031','\031','\031'};
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 if(active)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 /* mod */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 color[0] = '\023';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 /* deco */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 if(typeDeco && depthUp)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 color[1] = '\020';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 /* ltr */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 if(ltr)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 color[2] = '\020';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 /* bar */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 if(mod < depthUp)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 color[0] = '\025';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 color[1] = '\025';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 if(typeDeco && !depthUp)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 color[1] = '\025';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 /* output */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 /* MOD */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249 textPointer += snprintf(&text[textPointer], 14,\
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250 "*"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 " "
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 "\034"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 "%c"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 "%3u"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 " %c%c"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 "\017",
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 color[0],
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259 unit_depth_integer(mod),
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 unit_depth_char1(),
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 unit_depth_char2()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 /* deco */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 if(typeDeco)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 textPointer += snprintf(&text[textPointer], 14,\
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 "%c"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269 "%3u"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271 " %c%c"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 "\017",
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 color[1],
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 unit_depth_integer(depthUp),
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275 unit_depth_char1(),
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276 unit_depth_char2()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 text[textPointer++] = '\x7F';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 text[textPointer++] = '\x7F';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283 text[textPointer++] = 3*25 + 20;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285 /* liter */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287 textPointer += snprintf(&text[textPointer], 12,\
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288 "%c"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289 " %2u"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 "ltr"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 , color[2],ltr
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296 /* bar */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
298 textPointer += snprintf(&text[textPointer], 12,\
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
299 "%c"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
300 " %3u"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302 "bar"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303 "\017",
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304 color[3], bar
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 text[textPointer++] = '\035';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308 text[textPointer++] = '\n';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309 text[textPointer++] = '\r';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 text[textPointer] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 /* special gas number #6 in dive mode*/
647
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
316 if(((line == 0) || (line == 6)))
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317 {
647
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
318 if(actual_menu_content != MENU_SURFACE)
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
319 {
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
320 text[textPointer++] = '\020';
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
321 text[textPointer++] = TXT_2BYTE;
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
322 if(start == NUM_OFFSET_DILUENT)
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
323 text[textPointer++] = TXT2BYTE_SpecialDiveGasMenuCCR;
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
324 else
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
325 text[textPointer++] = TXT2BYTE_SpecialDiveGasMenu;
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
326 text[textPointer++] = '\n';
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
327 text[textPointer++] = '\r';
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
328 text[textPointer++] = 0;
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
329 }
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
330 else /* switch to bailout selection in surface mode */
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 647
diff changeset
331 if((isLoopMode(settingsGetPointer()->dive_mode)) || (stateUsed->diveSettings.ccrOption == 1))
647
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
332 {
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
333 text[textPointer++] = '\024';
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
334 if(gasMode == CCGAS_STANDARD)
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
335 {
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
336 textPointer += snprintf(&text[textPointer], 14,"Bailout\n");
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
337 }
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
338 else
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
339 {
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
340 textPointer += snprintf(&text[textPointer], 14,"Diluent\n");
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
341 }
15f6f0b5786c Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents: 528
diff changeset
342 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349 /* write_gas() is used in t7.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351 uint8_t write_gas(char *text, uint8_t oxygen, uint8_t helium)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
352 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353 uint8_t length;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355 if((oxygen == 21) && (helium == 0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 strcpy(text,"Air");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 length = 3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 else if(oxygen == 100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 strcpy(text,"Oxy");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363 length = 3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 else if(helium == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 length = snprintf(text, 7,"NX%u",oxygen);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 else if((oxygen + helium) == 100)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 length = snprintf(text, 7,"HX%u",oxygen);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375 length = snprintf(text, 7,"%u/%u",oxygen,helium);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 if(length > 6)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 strcpy(text,"error");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 length = 5;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384 return length;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385 }