38
|
1 ///////////////////////////////////////////////////////////////////////////////
|
|
2 /// -*- coding: UTF-8 -*-
|
|
3 ///
|
|
4 /// \file Discovery/Src/tMenuSetpoint.c
|
|
5 /// \brief
|
|
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 "tMenu.h"
|
|
31 #include "tMenuSetpoint.h"
|
|
32 #include "unit.h"
|
|
33
|
|
34 /* Private function prototypes -----------------------------------------------*/
|
|
35
|
|
36 /* Exported functions --------------------------------------------------------*/
|
|
37
|
|
38 uint32_t tMSP_refresh(uint8_t line,
|
|
39 char *text,
|
|
40 uint16_t *tab,
|
|
41 char *subtext)
|
|
42 {
|
|
43 const SSetpointLine * pSetpointLine;
|
|
44
|
|
45 uint8_t textPointer, setpoint_cbar, sp_high, depthUp, first; // active
|
|
46
|
|
47 if(actual_menu_content == MENU_SURFACE)
|
|
48 pSetpointLine = settingsGetPointer()->setpoint;
|
|
49 else
|
|
50 pSetpointLine = stateUsed->diveSettings.setpoint;
|
|
51
|
|
52 textPointer = 0;
|
|
53 *tab = 130;
|
|
54 *subtext = 0;
|
|
55
|
662
|
56 if((actual_menu_content == MENU_SURFACE) || (stateUsed->diveSettings.diveMode != DIVEMODE_PSCR)) /* do not show setpoints in PSCR mode */
|
38
|
57 {
|
662
|
58 for(int spId=1;spId<=NUM_GASES;spId++)
|
|
59 {
|
|
60 if(line && (line != spId))
|
|
61 {
|
|
62 first = pSetpointLine[spId].note.ub.first;
|
|
63 if(first == 0)
|
|
64 {
|
|
65 strcpy(&text[textPointer],
|
|
66 "\t"
|
|
67 "\177"
|
|
68 "*"
|
|
69 "\n\r"
|
|
70 );
|
|
71 textPointer += 5;
|
|
72 }
|
|
73 else
|
|
74 {
|
|
75 strcpy(&text[textPointer],"\n\r");
|
|
76 textPointer += 2;
|
|
77 }
|
|
78 }
|
|
79 else
|
|
80 {
|
|
81 setpoint_cbar = pSetpointLine[spId].setpoint_cbar;
|
|
82 depthUp = pSetpointLine[spId].depth_meter;
|
|
83 //active = pSetpointLine[spId].note.ub.active;
|
|
84 first = pSetpointLine[spId].note.ub.first;
|
38
|
85
|
662
|
86 strcpy(&text[textPointer],"\020"); // if(active) always active
|
|
87 textPointer += 1;
|
38
|
88
|
662
|
89 sp_high = setpoint_cbar / 100;
|
38
|
90
|
662
|
91 text[textPointer++] = 'S';
|
|
92 text[textPointer++] = 'P';
|
|
93 text[textPointer++] = '0' + spId;
|
|
94 text[textPointer++] = '\t';
|
38
|
95
|
662
|
96 if((first == 0) || (actual_menu_content != MENU_SURFACE))
|
|
97 strcpy(&text[textPointer++],"\177");
|
38
|
98
|
662
|
99 char color = '\031';
|
|
100 if(depthUp)
|
|
101 color = '\020';
|
38
|
102
|
662
|
103 textPointer += snprintf(&text[textPointer], 57,
|
|
104 "* "
|
|
105 "%u.%02u"
|
|
106 "\016\016"
|
|
107 " bar"
|
|
108 "\017"
|
|
109 "\034"
|
|
110 " "
|
|
111 "\016\016"
|
|
112 " "
|
|
113 "\017"
|
|
114 "%c"
|
|
115 "%3u"
|
|
116 "\016\016"
|
|
117 " %c%c"
|
|
118 "\017"
|
|
119 "\035"
|
|
120 "\n\r",
|
|
121 sp_high, setpoint_cbar - (100 * sp_high),
|
|
122 color,
|
|
123 unit_depth_integer(depthUp),
|
|
124 unit_depth_char1(),
|
|
125 unit_depth_char2()
|
|
126 );
|
|
127 }
|
|
128 }
|
38
|
129 }
|
|
130 if((actual_menu_content != MENU_SURFACE) /*&& (line == 0)*/)
|
|
131 {
|
|
132 text[textPointer++] = '\020';
|
|
133 text[textPointer++] = TXT_2BYTE;
|
|
134 text[textPointer++] = TXT2BYTE_UseSensor;
|
|
135 text[textPointer++] = '\n';
|
|
136 text[textPointer++] = '\r';
|
662
|
137
|
|
138
|
|
139 if(stateUsed->diveSettings.diveMode == DIVEMODE_PSCR)
|
|
140 {
|
|
141 textPointer += snprintf(&text[textPointer], 20,"\020%c", TXT_SimPpo2);
|
|
142 }
|
38
|
143 text[textPointer++] = 0;
|
|
144 }
|
650
|
145 else
|
|
146 {
|
|
147 text[textPointer++] = '\020';
|
|
148 text[textPointer++] = TXT_2BYTE;
|
|
149 text[textPointer++] = TXT2BYTE_AutomaticSP;
|
|
150 text[textPointer++] = '\002';
|
|
151 if(settingsGetPointer()->autoSetpoint)
|
|
152 text[textPointer++] = '\005';
|
|
153 else
|
|
154 text[textPointer++] = '\006';
|
|
155 text[textPointer++] = 0;
|
|
156 }
|
38
|
157 return StMSP;
|
|
158 }
|