annotate Discovery/Src/tMenuSetpoint.c @ 605:1f665e31aca2

change O2_CALIB_FRACTION_O2 to 0.98 It's common sense that calibrating CCR's with O2 asumes a max. O2 content of 98%
author heinrichsweikamp
date Thu, 07 Jan 2021 09:53:04 +0100
parents 1f557e5f4b5a
children 5f0d3dce5ef4
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/tMenuSetpoint.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief
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 "tMenu.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 #include "tMenuSetpoint.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #include "unit.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 uint32_t tMSP_refresh(uint8_t line,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 char *text,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 uint16_t *tab,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 char *subtext)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 const SSetpointLine * pSetpointLine;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 uint8_t textPointer, setpoint_cbar, sp_high, depthUp, first; // active
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 if(actual_menu_content == MENU_SURFACE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 pSetpointLine = settingsGetPointer()->setpoint;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 pSetpointLine = stateUsed->diveSettings.setpoint;
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 = 130;
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 for(int spId=1;spId<=NUM_GASES;spId++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 if(line && (line != spId))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 first = pSetpointLine[spId].note.ub.first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 if(first == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 strcpy(&text[textPointer],
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 "\t"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 "\177"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 "*"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 "\n\r"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 textPointer += 5;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 strcpy(&text[textPointer],"\n\r");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 textPointer += 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 setpoint_cbar = pSetpointLine[spId].setpoint_cbar;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 depthUp = pSetpointLine[spId].depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 //active = pSetpointLine[spId].note.ub.active;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 first = pSetpointLine[spId].note.ub.first;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 strcpy(&text[textPointer],"\020"); // if(active) always active
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 textPointer += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 sp_high = setpoint_cbar / 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 text[textPointer++] = 'S';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 text[textPointer++] = 'P';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 text[textPointer++] = '0' + spId;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 text[textPointer++] = '\t';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 if((first == 0) || (actual_menu_content != MENU_SURFACE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 strcpy(&text[textPointer++],"\177");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96
525
1f557e5f4b5a Change color ID used in strings for light grey:
Ideenmodellierer
parents: 38
diff changeset
97 char color = '\031';
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 if(depthUp)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 color = '\020';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 textPointer += snprintf(&text[textPointer], 57,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 "* "
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 "%u.%02u"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 " bar"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 "\034"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 " "
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 " "
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 "%c"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 "%3u"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 " %c%c"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 "\035"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 "\n\r",
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 sp_high, setpoint_cbar - (100 * sp_high),
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 color,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 unit_depth_integer(depthUp),
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 unit_depth_char1(),
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 unit_depth_char2()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 if((actual_menu_content != MENU_SURFACE) /*&& (line == 0)*/)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 text[textPointer++] = '\020';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 text[textPointer++] = TXT_2BYTE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 text[textPointer++] = TXT2BYTE_UseSensor;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 text[textPointer++] = '\n';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 text[textPointer++] = '\r';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 text[textPointer++] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 return StMSP;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 }