Mercurial > public > ostc4
comparison Discovery/Src/tMenuSetpoint.c @ 38:5f11787b4f42
include in ostc4 repository
author | heinrichsweikamp |
---|---|
date | Sat, 28 Apr 2018 11:52:34 +0200 |
parents | |
children | 1f557e5f4b5a |
comparison
equal
deleted
inserted
replaced
37:ccc45c0e1ea2 | 38:5f11787b4f42 |
---|---|
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 | |
56 for(int spId=1;spId<=NUM_GASES;spId++) | |
57 { | |
58 if(line && (line != spId)) | |
59 { | |
60 first = pSetpointLine[spId].note.ub.first; | |
61 if(first == 0) | |
62 { | |
63 strcpy(&text[textPointer], | |
64 "\t" | |
65 "\177" | |
66 "*" | |
67 "\n\r" | |
68 ); | |
69 textPointer += 5; | |
70 } | |
71 else | |
72 { | |
73 strcpy(&text[textPointer],"\n\r"); | |
74 textPointer += 2; | |
75 } | |
76 } | |
77 else | |
78 { | |
79 setpoint_cbar = pSetpointLine[spId].setpoint_cbar; | |
80 depthUp = pSetpointLine[spId].depth_meter; | |
81 //active = pSetpointLine[spId].note.ub.active; | |
82 first = pSetpointLine[spId].note.ub.first; | |
83 | |
84 strcpy(&text[textPointer],"\020"); // if(active) always active | |
85 textPointer += 1; | |
86 | |
87 sp_high = setpoint_cbar / 100; | |
88 | |
89 text[textPointer++] = 'S'; | |
90 text[textPointer++] = 'P'; | |
91 text[textPointer++] = '0' + spId; | |
92 text[textPointer++] = '\t'; | |
93 | |
94 if((first == 0) || (actual_menu_content != MENU_SURFACE)) | |
95 strcpy(&text[textPointer++],"\177"); | |
96 | |
97 char color = '\021'; | |
98 if(depthUp) | |
99 color = '\020'; | |
100 | |
101 textPointer += snprintf(&text[textPointer], 57, | |
102 "* " | |
103 "%u.%02u" | |
104 "\016\016" | |
105 " bar" | |
106 "\017" | |
107 "\034" | |
108 " " | |
109 "\016\016" | |
110 " " | |
111 "\017" | |
112 "%c" | |
113 "%3u" | |
114 "\016\016" | |
115 " %c%c" | |
116 "\017" | |
117 "\035" | |
118 "\n\r", | |
119 sp_high, setpoint_cbar - (100 * sp_high), | |
120 color, | |
121 unit_depth_integer(depthUp), | |
122 unit_depth_char1(), | |
123 unit_depth_char2() | |
124 ); | |
125 } | |
126 } | |
127 if((actual_menu_content != MENU_SURFACE) /*&& (line == 0)*/) | |
128 { | |
129 text[textPointer++] = '\020'; | |
130 text[textPointer++] = TXT_2BYTE; | |
131 text[textPointer++] = TXT2BYTE_UseSensor; | |
132 text[textPointer++] = '\n'; | |
133 text[textPointer++] = '\r'; | |
134 text[textPointer++] = 0; | |
135 } | |
136 return StMSP; | |
137 } |