annotate Discovery/Src/tMenuPlanner.c @ 542:6960df7ddb09

Added new t3 view showing first deco stop and tts in parallel: TTS and deco stop may already be shown individually. Now also available in one view where TTS is limited to 99minutes (switch to hours) to avoid string overlap.
author Ideenmodellierer
date Sat, 10 Oct 2020 21:02:05 +0200
parents 5f11787b4f42
children 1c95f811967c
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;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 uint32_t tMPlanner_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 uint8_t textPointer;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 textPointer = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 *tab = 400;//550;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 *subtext = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 uint8_t tMplan_gasConsumTravel = settingsGetPointer()->gasConsumption_travel_l_min;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 uint8_t tMplan_gasConsumDeco = settingsGetPointer()->gasConsumption_deco_l_min;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 // SSettings *data = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 if(line == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 strcpy(subtext,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 "\005"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 "a b c d e f g h i k l"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 "\n\r"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 "m n o p q r s t u v w"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 "\n\r"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 "x y z A B"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 "\006"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 if(line == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 tMplan_depth_meter = STD_depth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 tMplan_intervall_time_minutes = STD_intervall;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 tMplan_dive_time_minutes = STD_divetime;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 if((line == 0) || (line == 1))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 text[textPointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 text[textPointer++] = TXT2BYTE_StartSimulator;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 strcpy(&text[textPointer],"\n\r");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 textPointer += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 if((line == 0) || (line == 2))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 text[textPointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 text[textPointer++] = TXT2BYTE_Intervall;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 text[textPointer++] = '\t';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 textPointer += snprintf(&text[textPointer],30,"%u'",tMplan_intervall_time_minutes);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 strcpy(&text[textPointer],"\n\r");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 textPointer += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 if((line == 0) || (line == 3))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 text[textPointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 text[textPointer++] = TXT2BYTE_SimDiveTime;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 text[textPointer++] = '\t';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 textPointer += snprintf(&text[textPointer],30,"%u'",tMplan_dive_time_minutes);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 strcpy(&text[textPointer],"\n\r");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 textPointer += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 if((line == 0) || (line == 4))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 text[textPointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 text[textPointer++] = TXT2BYTE_SimMaxDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 text[textPointer++] = '\t';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 textPointer += snprintf(&text[textPointer],30,"%u\016\016 %c%c\017",
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 unit_depth_integer(tMplan_depth_meter),
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 unit_depth_char1(),
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 unit_depth_char2()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 strcpy(&text[textPointer],"\n\r");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 textPointer += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 if((line == 0) || (line == 5))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 text[textPointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 text[textPointer++] = TXT2BYTE_CalculateDeco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 strcpy(&text[textPointer],"\n\r");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 textPointer += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 if((line == 0) || (line == 6))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 text[textPointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 text[textPointer++] = TXT2BYTE_SimConsumption;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 text[textPointer++] = '\t';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 textPointer += snprintf(&text[textPointer],30,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 "%u"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 "\016\016 l\\min\017",
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 tMplan_gasConsumTravel);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 text[textPointer++] = ' ';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 text[textPointer++] = ' ';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 textPointer += snprintf(&text[textPointer],30,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 "\016\016deco\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 " %u"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 "\016\016 l\\min\017",
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 tMplan_gasConsumDeco);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 strcpy(&text[textPointer],"\n\r");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 textPointer += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 return StMPLAN;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147