annotate Discovery/Src/tMenuPlanner.c @ 911:a2523e19f59a Evo_2_23

VPMTable deco stop visualization: The current deco stop will change from white to green to indicate that the diver is in the region where the stop time is counted down.
author Ideenmodellierer
date Tue, 15 Oct 2024 20:00:37 +0200
parents 52df13712fa3
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/tMenuPlanner.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief Deco Planner and Simulator
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 19-Dec-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 <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 "tMenuPlanner.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 "settings.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 #include "unit.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 #define STD_depth (50)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 #define STD_intervall (0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 #define STD_divetime (20)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 uint16_t tMplan_depth_meter = STD_depth, tMplan_intervall_time_minutes = STD_intervall, tMplan_dive_time_minutes = STD_divetime;
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 38
diff changeset
44 uint16_t tMplan_depth_editor;
38
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 tMPlanner_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 textPointer;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 textPointer = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 *tab = 400;//550;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 *subtext = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 uint8_t tMplan_gasConsumTravel = settingsGetPointer()->gasConsumption_travel_l_min;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 uint8_t tMplan_gasConsumDeco = settingsGetPointer()->gasConsumption_deco_l_min;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 // SSettings *data = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 if(line == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 strcpy(subtext,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 "\005"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 "a b c d e f g h i k l"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 "\n\r"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 "m n o p q r s t u v w"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 "\n\r"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 "x y z A B"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 "\006"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 if(line == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 tMplan_depth_meter = STD_depth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 tMplan_intervall_time_minutes = STD_intervall;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 tMplan_dive_time_minutes = STD_divetime;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 if((line == 0) || (line == 1))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 text[textPointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 text[textPointer++] = TXT2BYTE_StartSimulator;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 strcpy(&text[textPointer],"\n\r");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 textPointer += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 if((line == 0) || (line == 2))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 text[textPointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 text[textPointer++] = TXT2BYTE_Intervall;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 text[textPointer++] = '\t';
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 38
diff changeset
92 textPointer += snprintf(&text[textPointer],30,"%u \016\016min\017",tMplan_intervall_time_minutes);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 strcpy(&text[textPointer],"\n\r");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 textPointer += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 if((line == 0) || (line == 3))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 text[textPointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 text[textPointer++] = TXT2BYTE_SimDiveTime;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 text[textPointer++] = '\t';
567
1c95f811967c -Add 12HR Time Support
izzni
parents: 38
diff changeset
101 textPointer += snprintf(&text[textPointer],30,"%u \016\016min\017",tMplan_dive_time_minutes);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 strcpy(&text[textPointer],"\n\r");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 textPointer += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 if((line == 0) || (line == 4))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 text[textPointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 text[textPointer++] = TXT2BYTE_SimMaxDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 text[textPointer++] = '\t';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 textPointer += snprintf(&text[textPointer],30,"%u\016\016 %c%c\017",
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 unit_depth_integer(tMplan_depth_meter),
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 unit_depth_char1(),
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 unit_depth_char2()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 strcpy(&text[textPointer],"\n\r");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 textPointer += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 if((line == 0) || (line == 5))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 text[textPointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 text[textPointer++] = TXT2BYTE_CalculateDeco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 strcpy(&text[textPointer],"\n\r");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 textPointer += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 if((line == 0) || (line == 6))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 text[textPointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 text[textPointer++] = TXT2BYTE_SimConsumption;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 text[textPointer++] = '\t';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 textPointer += snprintf(&text[textPointer],30,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 "%u"
679
52df13712fa3 cleanup: Use correct "per" symbol
Jan Mulder <jan@jlmulder.nl>
parents: 567
diff changeset
133 "\016\016 l/min\017",
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 tMplan_gasConsumTravel);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 text[textPointer++] = ' ';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 text[textPointer++] = ' ';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 textPointer += snprintf(&text[textPointer],30,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 "\016\016deco\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 " %u"
679
52df13712fa3 cleanup: Use correct "per" symbol
Jan Mulder <jan@jlmulder.nl>
parents: 567
diff changeset
140 "\016\016 l/min\017",
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 tMplan_gasConsumDeco);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 strcpy(&text[textPointer],"\n\r");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 textPointer += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 return StMPLAN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148