comparison Discovery/Src/tMenuPlanner.c @ 38:5f11787b4f42

include in ostc4 repository
author heinrichsweikamp
date Sat, 28 Apr 2018 11:52:34 +0200
parents
children 1c95f811967c
comparison
equal deleted inserted replaced
37:ccc45c0e1ea2 38:5f11787b4f42
1 ///////////////////////////////////////////////////////////////////////////////
2 /// -*- coding: UTF-8 -*-
3 ///
4 /// \file Discovery/Src/tMenuPlanner.c
5 /// \brief Deco Planner and Simulator
6 /// \author heinrichs weikamp gmbh
7 /// \date 19-Dec-2014
8 ///
9 /// \details
10 ///
11 /// $Id$
12 ///////////////////////////////////////////////////////////////////////////////
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
14 ///
15 /// This program is free software: you can redistribute it and/or modify
16 /// it under the terms of the GNU General Public License as published by
17 /// the Free Software Foundation, either version 3 of the License, or
18 /// (at your option) any later version.
19 ///
20 /// This program is distributed in the hope that it will be useful,
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 /// GNU General Public License for more details.
24 ///
25 /// You should have received a copy of the GNU General Public License
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
27 //////////////////////////////////////////////////////////////////////////////
28
29 /* Includes ------------------------------------------------------------------*/
30 #include <stdio.h>
31 #include <string.h>
32 #include "tMenu.h"
33 #include "tStructure.h"
34 #include "tMenuPlanner.h"
35 #include "text_multilanguage.h"
36 #include "settings.h"
37 #include "unit.h"
38
39 #define STD_depth (50)
40 #define STD_intervall (0)
41 #define STD_divetime (20)
42
43 uint16_t tMplan_depth_meter = STD_depth, tMplan_intervall_time_minutes = STD_intervall, tMplan_dive_time_minutes = STD_divetime;
44
45 /* Exported functions --------------------------------------------------------*/
46
47 uint32_t tMPlanner_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext)
48 {
49 uint8_t textPointer;
50
51 textPointer = 0;
52 *tab = 400;//550;
53 *subtext = 0;
54
55 uint8_t tMplan_gasConsumTravel = settingsGetPointer()->gasConsumption_travel_l_min;
56 uint8_t tMplan_gasConsumDeco = settingsGetPointer()->gasConsumption_deco_l_min;
57
58 // SSettings *data = settingsGetPointer();
59
60 /*
61 if(line == 0)
62 strcpy(subtext,
63 "\005"
64 "a b c d e f g h i k l"
65 "\n\r"
66 "m n o p q r s t u v w"
67 "\n\r"
68 "x y z A B"
69 "\006"
70 );
71 */
72 if(line == 0)
73 {
74 tMplan_depth_meter = STD_depth;
75 tMplan_intervall_time_minutes = STD_intervall;
76 tMplan_dive_time_minutes = STD_divetime;
77 }
78
79 if((line == 0) || (line == 1))
80 {
81 text[textPointer++] = TXT_2BYTE;
82 text[textPointer++] = TXT2BYTE_StartSimulator;
83 }
84 strcpy(&text[textPointer],"\n\r");
85 textPointer += 2;
86 if((line == 0) || (line == 2))
87 {
88 text[textPointer++] = TXT_2BYTE;
89 text[textPointer++] = TXT2BYTE_Intervall;
90 text[textPointer++] = '\t';
91 textPointer += snprintf(&text[textPointer],30,"%u'",tMplan_intervall_time_minutes);
92 }
93 strcpy(&text[textPointer],"\n\r");
94 textPointer += 2;
95 if((line == 0) || (line == 3))
96 {
97 text[textPointer++] = TXT_2BYTE;
98 text[textPointer++] = TXT2BYTE_SimDiveTime;
99 text[textPointer++] = '\t';
100 textPointer += snprintf(&text[textPointer],30,"%u'",tMplan_dive_time_minutes);
101 }
102 strcpy(&text[textPointer],"\n\r");
103 textPointer += 2;
104 if((line == 0) || (line == 4))
105 {
106 text[textPointer++] = TXT_2BYTE;
107 text[textPointer++] = TXT2BYTE_SimMaxDepth;
108 text[textPointer++] = '\t';
109 textPointer += snprintf(&text[textPointer],30,"%u\016\016 %c%c\017",
110 unit_depth_integer(tMplan_depth_meter),
111 unit_depth_char1(),
112 unit_depth_char2()
113 );
114 }
115 strcpy(&text[textPointer],"\n\r");
116 textPointer += 2;
117 if((line == 0) || (line == 5))
118 {
119 text[textPointer++] = TXT_2BYTE;
120 text[textPointer++] = TXT2BYTE_CalculateDeco;
121 }
122 strcpy(&text[textPointer],"\n\r");
123 textPointer += 2;
124
125 if((line == 0) || (line == 6))
126 {
127 text[textPointer++] = TXT_2BYTE;
128 text[textPointer++] = TXT2BYTE_SimConsumption;
129 text[textPointer++] = '\t';
130 textPointer += snprintf(&text[textPointer],30,
131 "%u"
132 "\016\016 l\\min\017",
133 tMplan_gasConsumTravel);
134 text[textPointer++] = ' ';
135 text[textPointer++] = ' ';
136 textPointer += snprintf(&text[textPointer],30,
137 "\016\016deco\017"
138 " %u"
139 "\016\016 l\\min\017",
140 tMplan_gasConsumDeco);
141 }
142 strcpy(&text[textPointer],"\n\r");
143 textPointer += 2;
144
145 return StMPLAN;
146 }
147