annotate Discovery/Src/tInfoPreDive.c @ 937:d461d9e89e3c Evo_2_23

Compile switch for RTE sleep debug: there was already a compiler switch for enabling debugging while RTE is in sleep but the switches were distributed across the code => to make selection easier they are now part of the configuration.h
author Ideenmodellierer
date Tue, 10 Dec 2024 20:59:37 +0100
parents fce639612464
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
845
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
1 ///////////////////////////////////////////////////////////////////////////////
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
2 /// -*- coding: UTF-8 -*-
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
3 ///
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
4 /// \file Discovery/Src/tInfoPredive.c
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
5 /// \brief Show information which might be of interest during predive checks
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
6 /// \author heinrichs weikamp gmbh
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
7 /// \date 23-Feb-2015
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
8 ///
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
9 /// \details
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
10 ///
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
11 /// $Id$
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
12 ///////////////////////////////////////////////////////////////////////////////
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
14 ///
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
15 /// This program is free software: you can redistribute it and/or modify
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
16 /// it under the terms of the GNU General Public License as published by
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
17 /// the Free Software Foundation, either version 3 of the License, or
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
18 /// (at your option) any later version.
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
19 ///
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
20 /// This program is distributed in the hope that it will be useful,
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
23 /// GNU General Public License for more details.
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
24 ///
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
25 /// You should have received a copy of the GNU General Public License
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
27 //////////////////////////////////////////////////////////////////////////////
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
28
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
29 /* Includes ------------------------------------------------------------------*/
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
30
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
31 #include "gfx_engine.h"
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
32 #include "gfx_fonts.h"
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
33 #include "tHome.h"
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
34 #include "tInfo.h"
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
35 #include "tInfoPreDive.h"
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
36 #include "tMenuEdit.h"
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
37 #include "data_exchange_main.h"
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
38
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
39 #include <string.h>
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
40 #include <inttypes.h>
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
41
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
42 #define MEASURE_INTERVALL (10u) /* refresh function should be called every 100ms => one second interval */
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
43 #define HISTORY_BUF_SIZE (240u) /* store 240 entries a one second */
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
44 #define INVALID_PRESSURE_VALUE (0xFFFF)
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
45 #define DELTA_SHIFT (50) /* the graph printers do not support negative values => shift data into positiv area (assumes pressure range +- 300mBar) */
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
46
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
47 /* Private variables ---------------------------------------------------------*/
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
48 static uint16_t surfacePressureStart = INVALID_PRESSURE_VALUE;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
49 static uint16_t surfaceTemperatureStart = 0;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
50 static uint16_t pressureHistory[HISTORY_BUF_SIZE];
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
51 static uint8_t pressureHistoryIndex = 0;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
52 static uint16_t temperatureHistory[HISTORY_BUF_SIZE];
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
53 static uint8_t temperatureHistoryIndex = 0;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
54 static uint8_t measureCnt = MEASURE_INTERVALL;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
55 static uint8_t referenceSensor = 0xff;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
56
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
57 /* Exported functions --------------------------------------------------------*/
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
58
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
59
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
60
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
61 static void storePressureValue(int16_t deltapressure_mBar)
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
62 {
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
63 uint16_t newValue = DELTA_SHIFT - deltapressure_mBar; /* invert value because graph is drawing larger values to bottom direction */
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
64 if(pressureHistoryIndex + 2 < HISTORY_BUF_SIZE)
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
65 {
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
66 pressureHistoryIndex++;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
67 pressureHistory[pressureHistoryIndex] = newValue;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
68 pressureHistoryIndex++;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
69 pressureHistory[pressureHistoryIndex] = newValue;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
70 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
71 else
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
72 {
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
73 memcpy (&pressureHistory[0],&pressureHistory[2],sizeof(pressureHistory) - 2);
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
74 pressureHistory[pressureHistoryIndex] = newValue;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
75 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
76 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
77
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
78 static void storeTemperatureValue(uint16_t temperature)
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
79 {
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
80 uint16_t newValue = temperature; /* todo: consider negativ temperature */
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
81 if(temperatureHistoryIndex + 2 < HISTORY_BUF_SIZE)
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
82 {
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
83 temperatureHistoryIndex++;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
84 temperatureHistory[temperatureHistoryIndex] = newValue;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
85 temperatureHistoryIndex++;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
86 temperatureHistory[temperatureHistoryIndex] = newValue;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
87 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
88 else
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
89 {
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
90 memcpy (&temperatureHistory[0],&temperatureHistory[2],sizeof(temperatureHistory) - 2);
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
91 temperatureHistory[temperatureHistoryIndex] = newValue;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
92 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
93 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
94
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
95 void openInfo_PreDive()
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
96 {
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
97 const SDiveState *pStateReal = stateRealGetPointer();
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
98 uint8_t index = 0;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
99 SSensorDataDiveO2* pDiveO2Data = NULL;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
100 SSettings *pSettings = settingsGetPointer();
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
101 set_globalState(StIPREDIVE);
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
102
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
103 surfacePressureStart = 0;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
104 pressureHistoryIndex = 0;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
105 referenceSensor = 0xff;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
106
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
107 for(index = 0; index < EXT_INTERFACE_MUX_OFFSET; index++)
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
108 {
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
109 if((pSettings->ext_sensor_map[index] == SENSOR_DIGO2M) && pStateReal->lifeData.ppO2Sensor_bar[index] != 0)
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
110 {
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
111 referenceSensor = index;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
112 pDiveO2Data = (SSensorDataDiveO2*)stateRealGetPointer()->lifeData.extIf_sensor_data[index];
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
113 if(pDiveO2Data->pressure != 0)
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
114 {
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
115 surfacePressureStart = pDiveO2Data->pressure / 1000;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
116 surfaceTemperatureStart = pDiveO2Data->temperature;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
117 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
118 break;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
119 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
120 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
121 for(index = 0; index < HISTORY_BUF_SIZE; index++)
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
122 {
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
123 pressureHistory[index] = DELTA_SHIFT;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
124 temperatureHistory[index] = 0;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
125 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
126 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
127
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
128 void refreshInfo_PreDive(GFX_DrawCfgScreen s)
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
129 {
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
130 const SDiveState *pStateReal = stateRealGetPointer();
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
131 static int16_t deltaPressure = 0;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
132 static uint16_t temperature = 0;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
133 SSettings *pSettings = settingsGetPointer();
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
134 uint8_t index = 0;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
135 char text[31];
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
136 SSensorDataDiveO2* pDiveO2Data = NULL;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
137 point_t start, stop;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
138
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
139 SWindowGimpStyle wintempppO2;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
140 SWindowGimpStyle wintemptemp;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
141
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
142 if(--measureCnt == 0)
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
143 {
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
144 measureCnt = MEASURE_INTERVALL;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
145 pDiveO2Data = (SSensorDataDiveO2*)stateRealGetPointer()->lifeData.extIf_sensor_data[referenceSensor];
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
146 if(pDiveO2Data->pressure != 0)
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
147 {
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
148 if(surfacePressureStart == 0)
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
149 {
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
150 surfacePressureStart = pDiveO2Data->pressure / 1000;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
151 surfaceTemperatureStart = pDiveO2Data->temperature;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
152 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
153 deltaPressure = (pDiveO2Data->pressure / 1000) - surfacePressureStart;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
154 storePressureValue(deltaPressure);
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
155 temperature = pDiveO2Data->temperature;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
156 storeTemperatureValue(temperature);
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
157 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
158 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
159
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
160 text[0] = '\001';
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
161 text[1] = TXT_PreDive;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
162 text[2] = 0;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
163 tInfo_write_content_simple( 30, 770, ME_Y_LINE_BASE, &FontT48, text, CLUT_MenuPageHardware);
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
164
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
165 for(index = 0; index < EXT_INTERFACE_MUX_OFFSET; index++)
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
166 {
849
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
167 if((pSettings->ext_sensor_map[index] == SENSOR_DIGO2M) || (pSettings->ext_sensor_map[index] == SENSOR_ANALOG))
845
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
168 {
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
169 snprintf(text,32,"%c%c%d: %01.2f", TXT_2BYTE, TXT2BYTE_Sensor, index, pStateReal->lifeData.ppO2Sensor_bar[index]);
849
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
170 tInfo_write_content_simple( 5, 780, ME_Y_LINE1 + (index * ME_Y_LINE_STEP), &FontT48, text, CLUT_Font020);
845
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
171 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
172 else if(pSettings->ext_sensor_map[index] == SENSOR_CO2M)
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
173 {
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
174 snprintf(text,32,"CO2: %4ld", pStateReal->lifeData.CO2_data.CO2_ppm);
849
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
175 tInfo_write_content_simple( 5, 780, ME_Y_LINE5, &FontT48, text, CLUT_Font020);
845
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
176 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
177 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
178
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
179 wintempppO2.left = 350;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
180 wintempppO2.right = 590;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
181
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
182 wintemptemp.left = 350;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
183 wintemptemp.right = 590;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
184
849
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
185 wintempppO2.top = ME_Y_LINE3;
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
186 wintempppO2.bottom = wintempppO2.top + DELTA_SHIFT * 2;
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
187 wintemptemp.top = ME_Y_LINE5;
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
188 wintemptemp.bottom = wintemptemp.top + DELTA_SHIFT * 2;
845
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
189
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
190 start.x = wintempppO2.left - 5;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
191 start.y = 480 - wintemptemp.bottom - 5;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
192 stop.x = wintempppO2.right- start.x + 5;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
193 stop.y = DELTA_SHIFT * 2 + 10;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
194 GFX_draw_box(&s, start, stop,1, CLUT_Font020);
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
195
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
196 start.y = 480 - wintempppO2.bottom - 5;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
197 GFX_draw_box(&s, start, stop,1, CLUT_Font020);
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
198
849
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
199 if(pSettings->FlipDisplay)
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
200 {
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
201 wintempppO2.left = 800 - 590;
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
202 wintempppO2.right = 800 - 350;
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
203 wintemptemp.left = 800 - 590;
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
204 wintemptemp.right = 800 - 350;
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
205 }
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
206 GFX_graph_print(&s, &wintempppO2, 1,1,0, DELTA_SHIFT * 2, pressureHistory, HISTORY_BUF_SIZE, CLUT_Font030, NULL);
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
207
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
208 GFX_graph_print(&s, &wintemptemp, 1,1, surfaceTemperatureStart - 2000, surfaceTemperatureStart + 10000, temperatureHistory, HISTORY_BUF_SIZE, CLUT_Font030, NULL);
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
209
845
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
210 /* Graph labeling */
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
211 snprintf(text,32,"%c%c", TXT_2BYTE, TXT2BYTE_CounterLung);
849
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
212 tInfo_write_content_simple( 350, 795, ME_Y_LINE2, &FontT48, text, CLUT_Font020);
845
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
213
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
214 snprintf(text,32,"\002\016\016%c%c", TXT_2BYTE, TXT2BYTE_Pressure);
849
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
215 tInfo_write_content_simple( 500, 795, ME_Y_LINE3, &FontT48, text, CLUT_Font020);
845
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
216 snprintf(text,32,"\002%d",deltaPressure);
849
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
217 tInfo_write_content_simple( 500, 795, ME_Y_LINE4, &FontT48, text, CLUT_Font020);
845
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
218 snprintf(text,32,"\002\016\016%c",TXT_Temperature);
849
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
219 tInfo_write_content_simple( 300, 795, ME_Y_LINE5, &FontT48, text, CLUT_Font020);
845
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
220 snprintf(text,32,"\002%2.2f",(temperature / 1000.0));
849
fce639612464 Consider flipped screen for Predive menu:
Ideenmodellierer
parents: 845
diff changeset
221 tInfo_write_content_simple( 300, 795, ME_Y_LINE6, &FontT48, text, CLUT_Font020);
845
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
222 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
223
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
224 void sendActionToInfoPreDive(uint8_t sendAction)
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
225 {
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
226 switch(sendAction)
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
227 {
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
228 case ACTION_BUTTON_BACK:
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
229 // exitInfo();
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
230 exitMenuEdit_to_Menu_with_Menu_Update();
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
231 break;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
232
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
233 case ACTION_BUTTON_ENTER:
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
234 break;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
235 case ACTION_BUTTON_NEXT:
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
236 break;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
237 case ACTION_TIMEOUT:
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
238 case ACTION_MODE_CHANGE:
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
239 case ACTION_IDLE_TICK:
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
240 case ACTION_IDLE_SECOND:
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
241 default:
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
242 break;
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
243 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
244 }
17d9d6eddd8d Added new PreDiveCheck info page:
Ideenmodellierer
parents:
diff changeset
245