annotate Discovery/Src/logbook_miniLive.c @ 599:5a8f9126e4cb

Bugfix T3 skip deactivated views: I previous version the OSTC hangs if only conditional views (like decoplan which is only displayed in case of deco time) are switched. Rootcause was that the select function could never switch to another view because no visible view was available. To avoid this use case a fallback option has been added. In case no other view is available, the current view will be kept. In case no view at all (even no conditional view) is available then a switch to the "None" view will be done independend if it is enabled or not. T3_Profile: Added functionalty to show max depth and divetime of a profile provided by the replay block.
author Ideenmodellierer
date Mon, 04 Jan 2021 21:48:31 +0100
parents 0a3836643173
children 2cb0a97a07ad
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 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 * @copyright heinrichs weikamp
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 * @file logbook_miniLive.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 * @author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 * @date 13-March-2015
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 * @since 13-March-2015
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 * @brief little logbook for during the dive
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 * @bug
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 * @warning
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 * @attention
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 * <h2><center>&copy; COPYRIGHT(c) 2015 heinrichs weikamp</center></h2>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /* Includes ------------------------------------------------------------------*/
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
21
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
22
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
23 #include <string.h>
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 #include "logbook_miniLive.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 #include "data_exchange.h"
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
26 #include "logbook.h"
38
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 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 * @brief t7_updateMiniLiveLogbook. / Create depth samples for view during dive
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 * @author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 * @date 13-March-2015
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 #define MLLsize (296)
300
5ca177d2df5d cleanup: remove commented/unused code, make static
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
39 static uint16_t MLLdataDepth[MLLsize];
5ca177d2df5d cleanup: remove commented/unused code, make static
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
40 static uint16_t MLLpointer = 0;
5ca177d2df5d cleanup: remove commented/unused code, make static
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
41 static uint8_t MLLtickIntervallSeconds = 2;
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
42
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
43 /* Replay Block data storage */
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
44 #define DEPTH_DATA_LENGTH (1800u) /* Resolution: 5 hours dive, sampling every 10 seconds */
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
45 uint16_t depthdata[DEPTH_DATA_LENGTH];
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
46 uint16_t livedepthdata[DEPTH_DATA_LENGTH * 2];
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
47 static uint16_t historyIndex = 0;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
48
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
49 static uint8_t ReplayDataResolution = 2; /* Time represented by one sample (second) */
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
50 static uint16_t ReplayDataLength = 0; /* Number of data entries */
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
51 static uint16_t ReplayDataMaxDepth = 0;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
52 static uint16_t ReplayDataMinutes = 0;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
53 static uint16_t ReplayDataOffset = 0xFFFF; /* Stepbackwards format used by log functions */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 uint16_t *getMiniLiveLogbookPointerToData(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 return MLLdataDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 uint16_t getMiniLiveLogbookActualDataLength(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 return MLLpointer;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
66 void compressBuffer_uint16(uint16_t* pdata, uint16_t size)
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
67 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
68 uint16_t* pTarget = pdata;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
69 uint16_t* pSource = pdata;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
71 uint16_t index = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
73 for(index = 0; index < size/2; index++)
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
74 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
75 *pTarget = *pSource++;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
76 *pTarget += *pSource++;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
77 *pTarget++ /= 2;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
78 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
79 memset(pTarget,0,size/2);
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
80 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
81
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 void updateMiniLiveLogbook( _Bool checkOncePerSecond)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 static uint8_t bDiveMode = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 static uint32_t last_second = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 static uint8_t secondsCount = 0;
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
87 static uint8_t historysecondsCount = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 if(checkOncePerSecond)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 uint32_t now = current_second();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 if( last_second == now)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 last_second = now;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 secondsCount++;
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
97 historysecondsCount++;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 if(!bDiveMode)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 if((stateUsed->mode == MODE_DIVE) && (stateUsed->lifeData.dive_time_seconds >= 5))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 secondsCount = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 MLLtickIntervallSeconds = 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 bDiveMode = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 MLLpointer = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 for(int i=0;i<MLLsize;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 MLLdataDepth[i] = 0;
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
109
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
110 for(historyIndex = 0; historyIndex < DEPTH_DATA_LENGTH; historyIndex++)
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
111 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
112 livedepthdata[historyIndex] = 0xFFFF;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
113 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
114 historysecondsCount = 0;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
115 historyIndex = 0;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
116 livedepthdata[historyIndex++] = 0; /* start at 0 */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 else if(stateUsed->mode == MODE_DIVE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 bDiveMode = 3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 //
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 if(secondsCount >= MLLtickIntervallSeconds)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 secondsCount = 0;
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
126 /* in case of a buffer overrun the buffer is divided and the first half is filled with a compressed image of the complete buffer */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 if((MLLpointer >= MLLsize) && (MLLtickIntervallSeconds < 127))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 MLLpointer = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 MLLtickIntervallSeconds *= 2;
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
131
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
132 compressBuffer_uint16(MLLdataDepth,MLLsize);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 MLLpointer = MLLsize/2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 if(MLLpointer < MLLsize)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 MLLdataDepth[MLLpointer++] = (int)(stateUsed->lifeData.depth_meter * 10);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 }
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
138 if(historysecondsCount > ReplayDataResolution)
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
139 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
140 historysecondsCount = 0;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
141
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
142 if(historyIndex >= 2*DEPTH_DATA_LENGTH) /* compress data */
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
143 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
144 ReplayDataResolution *= 2;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
145 compressBuffer_uint16(livedepthdata,2*DEPTH_DATA_LENGTH);
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
146 historyIndex = DEPTH_DATA_LENGTH;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
147 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
148 livedepthdata[historyIndex++] = (int)(stateUsed->lifeData.depth_meter * 100);
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
149 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 else if(bDiveMode == 3)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 //End of Dive
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 for(int i=0;i<MLLsize;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 MLLdataDepth[i] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 bDiveMode = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
160 uint8_t prepareReplayLog(uint8_t StepBackwards)
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
161 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
162 uint8_t retVal = 0;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
163 uint16_t dataLength = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
165 SLogbookHeader logbookHeader;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
166
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
167 if(ReplayDataOffset == StepBackwards) /* Entry already selected => reset selection */
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
168 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
169 ReplayDataOffset = 0xFFFF;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
170 ReplayDataResolution = 2;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
171 retVal = 1;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
172 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
173 else
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
174 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
175 ReplayDataOffset = StepBackwards;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
176 logbook_getHeader(StepBackwards ,&logbookHeader);
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
177
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
178 dataLength = logbook_readSampleData(StepBackwards, DEPTH_DATA_LENGTH, depthdata,NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
179
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
180 if( dataLength == DEPTH_DATA_LENGTH) /* log data has been compressed to fit into buffer */
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
181 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
182 ReplayDataResolution = (logbookHeader.diveTimeMinutes * 60 + logbookHeader.diveTimeSeconds) / dataLength;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
183 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
184 else
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
185 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
186 ReplayDataResolution = logbookHeader.samplingRate;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
187 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
188 ReplayDataLength = dataLength;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
189 ReplayDataMaxDepth = logbookHeader.maxDepth;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
190 ReplayDataMinutes = logbookHeader.diveTimeMinutes;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
191 if(dataLength != 0)
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
192 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
193 retVal = 1;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
194 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
195 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
196 return retVal;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
197 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
198
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
199 uint8_t getReplayInfo(uint16_t** pReplayData, uint16_t* DataLength, uint16_t* MaxDepth, uint16_t* diveMinutes)
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
200 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
201 uint8_t retVal = 0;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
202
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
203 if((ReplayDataOffset != 0xFFFF) && (pReplayData != NULL) && (DataLength != NULL) && (MaxDepth != NULL))
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
204 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
205 *pReplayData = depthdata;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
206 *DataLength = ReplayDataLength;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
207 *MaxDepth = ReplayDataMaxDepth;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
208 *diveMinutes = ReplayDataMinutes;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
209 retVal = 1;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
210 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
211
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
212 return retVal;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
213 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
214
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
215 uint16_t *getMiniLiveReplayPointerToData(void)
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
216 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
217 return livedepthdata;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
218 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
219 uint16_t getMiniLiveReplayLength(void)
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
220 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
221 return historyIndex;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
222 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
223
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
224 uint16_t getReplayOffset(void)
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
225 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
226 return ReplayDataOffset;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
227 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
228
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
229 uint16_t getReplayDataResolution(void)
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
230 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
231 return ReplayDataResolution;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
232 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/