annotate Discovery/Src/tMenuXtra.c @ 655:980b4aa60a0e

Added count down timer for scrubber time: The countdown is performed in case CCR mode and scrubber timer are active
author Ideenmodellierer
date Sun, 25 Apr 2021 20:42:56 +0200
parents 890440ab993a
children 1b995079c045
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/tMenuXtra.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief Menu Xtra - Specials in Divemode like Reset Stopwatch
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 02-Mar-2015
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 <stdio.h>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 #include <string.h>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #include "tMenu.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 #include "tStructure.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 #include "tMenuXtra.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 #include "text_multilanguage.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 #include "data_central.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 #include "simulation.h"
609
1b243c6c7067 Bugfix: CalibViewport were shown even in case the compile switch had not been set:
Ideenmodellierer
parents: 547
diff changeset
38 #include "configuration.h"
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 uint32_t tMXtra_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 uint8_t textPointer;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 textPointer = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 *tab = 500;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 *subtext = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
50 /* DIVE MODE */
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
51 if(actual_menu_content != MENU_SURFACE)
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 {
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
53 if((line == 0) || (line == 1))
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
54 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
55 text[textPointer++] = TXT_2BYTE;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
56 text[textPointer++] = TXT2BYTE_ResetStopwatch;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
57 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
58 strcpy(&text[textPointer],"\n\r");
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
59 textPointer += 2;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
60 /*
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
61 if((line == 0) || (line == 2))
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
62 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
63 text[textPointer++] = TXT_2BYTE;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
64 text[textPointer++] = TXT2BYTE_ResetAvgDepth;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
65 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
66 strcpy(&text[textPointer],"\n\r");
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
67 textPointer += 2;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
68 */
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
69 if((line == 0) || (line == 2))
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
70 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
71 text[textPointer++] = TXT_2BYTE;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
72 text[textPointer++] = TXT2BYTE_CompassHeading;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
73 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
74 strcpy(&text[textPointer],"\n\r");
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
75 textPointer += 2;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
77 if((line == 0) || (line == 3))
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
78 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
79 text[textPointer++] = TXT_2BYTE;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
80 text[textPointer++] = TXT2BYTE_SetMarker;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
81 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
82 strcpy(&text[textPointer],"\n\r");
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
83 textPointer += 2;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84
609
1b243c6c7067 Bugfix: CalibViewport were shown even in case the compile switch had not been set:
Ideenmodellierer
parents: 547
diff changeset
85 #ifdef ENABLE_MOTION_CONTROL
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
86 if((line == 0) || (line == 4))
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
87 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
88 text[textPointer++] = TXT_2BYTE;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
89 text[textPointer++] = TXT2BYTE_CalibView;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
90 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
91 strcpy(&text[textPointer],"\n\r");
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
92 textPointer += 2;
609
1b243c6c7067 Bugfix: CalibViewport were shown even in case the compile switch had not been set:
Ideenmodellierer
parents: 547
diff changeset
93 #endif
547
12f8745c8a94 Added viewport calibration to dive menu:
Ideenmodellierer
parents: 347
diff changeset
94
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
95 if(is_stateUsedSetToSim())
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
96 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
97 if((line == 0) || (line == 5))
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
98 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
99 text[textPointer++] = TXT_2BYTE;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
100 text[textPointer++] = TXT2BYTE_SimFollowDecoStops;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
101 text[textPointer++] = ' ';
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
102 text[textPointer++] = ' ';
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
103 if(simulation_get_heed_decostops())
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
104 text[textPointer++] = '\005';
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
105 else
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
106 text[textPointer++] = '\006';
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
107 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
108 strcpy(&text[textPointer],"\n\r");
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
109 textPointer += 2;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
110 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
111 else
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
112 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
113 if((line == 0) || (line == 5)) /* end dive mode only used during real dives */
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
114 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
115 text[textPointer++] = TXT_2BYTE;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
116 text[textPointer++] = TXT2BYTE_EndDiveMode;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
117 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
118 strcpy(&text[textPointer],"\n\r");
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
119 textPointer += 2;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
120 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
121 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
122 else /* Surface MODE */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 {
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
124 if((line == 0) || (line == 1))
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 {
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
126 textPointer += snprintf(&text[textPointer], 60,\
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
127 "%c"
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
128 "\016\016(%c)\17"
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
129 "\002"
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
130 "%u"
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
131 "\016\016"
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
132 " %c"
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
133 "\017"
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
134 ,TXT_ScrubTime
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
135 ,TXT_Maximum
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
136 ,settingsGetPointer()->scrubTimerMax
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
137 ,TXT_Minutes
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
138 );
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 strcpy(&text[textPointer],"\n\r");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 textPointer += 2;
654
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
142 if((line == 0) || (line == 2))
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
143 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
144 textPointer += snprintf(&text[textPointer], 60,\
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
145 "%c\002%03u\016\016 %c\017"
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
146 ,TXT_ScrubTimeReset
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
147 ,settingsGetPointer()->scrubTimerCur
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
148 ,TXT_Minutes);
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
149 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
150 strcpy(&text[textPointer],"\n\r");
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
151 textPointer += 2;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
152 if((line == 0) || (line == 3))
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
153 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
154 switch(settingsGetPointer()->scrubTimerMode)
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
155 {
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
156 case SCRUB_TIMER_OFF:
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
157 default: textPointer += snprintf(&text[textPointer], 60,"%c\002%c%c",TXT_ScrubTimeMode, TXT_2BYTE, TXT2BYTE_MoCtrlNone );
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
158 break;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
159 case SCRUB_TIMER_MINUTES: textPointer += snprintf(&text[textPointer], 60,"%c\002%c",TXT_ScrubTimeMode, TXT_Minutes );
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
160 break;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
161 case SCRUB_TIMER_PERCENT: textPointer += snprintf(&text[textPointer], 60,"%c\002%c",TXT_ScrubTimeMode, TXT_Percent );
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
162 break;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
163 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
164 }
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
165 strcpy(&text[textPointer],"\n\r");
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
166 textPointer += 2;
890440ab993a Introduced new menu tab for addition CCR options:
Ideenmodellierer
parents: 609
diff changeset
167
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 return StMXTRA;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171