annotate Discovery/Src/logbook_miniLive.c @ 610:ae7f8333c900

Added access to logbook marker data: In previous version event data could only be stored in memory but read back and usage in the OSTC itself was not supported. After the events like a marker set by the diver may be retrieved from the log. Added visualization of markers to T3_Profile view
author Ideenmodellierer
date Thu, 14 Jan 2021 20:38:28 +0100
parents c56ed16dbd39
children bf574fb3efa0
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"
603
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
27 #include "tHome.h"
38
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 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 * @brief t7_updateMiniLiveLogbook. / Create depth samples for view during dive
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 * @author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 * @date 13-March-2015
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
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 #define MLLsize (296)
300
5ca177d2df5d cleanup: remove commented/unused code, make static
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
40 static uint16_t MLLdataDepth[MLLsize];
5ca177d2df5d cleanup: remove commented/unused code, make static
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
41 static uint16_t MLLpointer = 0;
5ca177d2df5d cleanup: remove commented/unused code, make static
Jan Mulder <jlmulder@xs4all.nl>
parents: 38
diff changeset
42 static uint8_t MLLtickIntervallSeconds = 2;
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
43
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
44 /* Replay Block data storage */
602
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
45 #define DEPTH_DATA_LENGTH (1800u) /* Resolution: 1 hours dive, sampling every 2 seconds */
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
46 uint16_t ReplayDepthData[DEPTH_DATA_LENGTH];
610
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
47 uint8_t ReplayMarkerData[DEPTH_DATA_LENGTH];
602
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
48 uint16_t liveDepthData[DEPTH_DATA_LENGTH];
603
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
49 uint16_t liveDecoData[DEPTH_DATA_LENGTH];
602
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
50 static uint16_t lifeDataIndex = 0;
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
51
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
52 static uint8_t ReplayDataResolution = 2; /* Time represented by one sample (second) */
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
53 static uint16_t ReplayDataLength = 0; /* Number of data entries */
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
54 static uint16_t ReplayDataMaxDepth = 0;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
55 static uint16_t ReplayDataMinutes = 0;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
56 static uint16_t ReplayDataOffset = 0xFFFF; /* Stepbackwards format used by log functions */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 uint16_t *getMiniLiveLogbookPointerToData(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 return MLLdataDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 uint16_t getMiniLiveLogbookActualDataLength(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 return MLLpointer;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
69 void compressBuffer_uint16(uint16_t* pdata, uint16_t size)
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
70 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
71 uint16_t* pTarget = pdata;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
72 uint16_t* pSource = pdata;
610
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
73 uint16_t result = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
75 uint16_t index = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
77 for(index = 0; index < size/2; index++)
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 *pTarget = *pSource++;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
80 *pTarget += *pSource++;
610
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
81 result = *pTarget /= 2;
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
82 if((*pTarget != 0) && (result == 0)) /* avoid termination of information by round up to 1 */
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
83 {
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
84 *pTarget++ = 1;
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
85 }
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
86 else
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
87 {
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
88 *pTarget++ = result;
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
89 }
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
90 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
91 memset(pTarget,0,size/2);
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
92 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
93
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 void updateMiniLiveLogbook( _Bool checkOncePerSecond)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 static uint8_t bDiveMode = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 static uint32_t last_second = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 static uint8_t secondsCount = 0;
602
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
99 static uint8_t lifesecondsCount = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100
603
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
101 const SDecoinfo* pDecoinfo;
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
102 uint8_t stopDepth = 0;
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
103 uint16_t stopTime = 0;
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
104
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 if(checkOncePerSecond)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 uint32_t now = current_second();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 if( last_second == now)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 return;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 last_second = now;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 secondsCount++;
602
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
113 lifesecondsCount++;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 if(!bDiveMode)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 if((stateUsed->mode == MODE_DIVE) && (stateUsed->lifeData.dive_time_seconds >= 5))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 secondsCount = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 MLLtickIntervallSeconds = 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 bDiveMode = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 MLLpointer = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 for(int i=0;i<MLLsize;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 MLLdataDepth[i] = 0;
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
125
602
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
126 for(lifeDataIndex = 0; lifeDataIndex < DEPTH_DATA_LENGTH; lifeDataIndex++)
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
127 {
602
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
128 liveDepthData[lifeDataIndex] = 0xFFFF;
603
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
129 liveDecoData[lifeDataIndex] = 0xFFFF;
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
130 }
602
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
131 lifesecondsCount = 0;
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
132 lifeDataIndex = 0;
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
133 liveDepthData[lifeDataIndex++] = 0; /* start at 0 */
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 else if(stateUsed->mode == MODE_DIVE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 bDiveMode = 3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 //
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 if(secondsCount >= MLLtickIntervallSeconds)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 secondsCount = 0;
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
143 /* 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
144 if((MLLpointer >= MLLsize) && (MLLtickIntervallSeconds < 127))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 MLLpointer = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 MLLtickIntervallSeconds *= 2;
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
148
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
149 compressBuffer_uint16(MLLdataDepth,MLLsize);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 MLLpointer = MLLsize/2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 if(MLLpointer < MLLsize)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 MLLdataDepth[MLLpointer++] = (int)(stateUsed->lifeData.depth_meter * 10);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 }
602
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
155 if(lifesecondsCount >= ReplayDataResolution)
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
156 {
602
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
157 lifesecondsCount = 0;
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
158
602
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
159 if(lifeDataIndex >= DEPTH_DATA_LENGTH) /* compress data */
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
160 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
161 ReplayDataResolution *= 2;
602
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
162 compressBuffer_uint16(liveDepthData,DEPTH_DATA_LENGTH);
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
163 compressBuffer_uint16(ReplayDepthData,DEPTH_DATA_LENGTH); /* also compress Replay data to siplify mapping between live and replay data */
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
164 lifeDataIndex = DEPTH_DATA_LENGTH / 2;
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
165 }
603
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
166 liveDepthData[lifeDataIndex] = (int)(stateUsed->lifeData.depth_meter * 100);
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
167 if(stateUsed->diveSettings.deco_type.ub.standard == VPM_MODE)
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
168 {
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
169 pDecoinfo = &stateUsed->decolistVPM;
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
170 }
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
171 else
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
172 {
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
173 pDecoinfo = &stateUsed->decolistBuehlmann;
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
174 }
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
175 tHome_findNextStop(pDecoinfo->output_stop_length_seconds, &stopDepth, &stopTime);
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
176 if(stopDepth)
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
177 {
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
178 liveDecoData[lifeDataIndex] = stopDepth * 100;
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
179 }
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
180 else
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
181 {
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
182 liveDecoData[lifeDataIndex] = 0xFFFF;
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
183 }
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
184 lifeDataIndex++;
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
185 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 else if(bDiveMode == 3)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 //End of Dive
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 for(int i=0;i<MLLsize;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 MLLdataDepth[i] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 bDiveMode = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
196 uint8_t prepareReplayLog(uint8_t StepBackwards)
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 uint8_t retVal = 0;
610
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
199 uint16_t index = 0;
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
200 uint16_t dataLength = 0;
610
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
201 uint8_t markerDetected = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
203 SLogbookHeader logbookHeader;
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 if(ReplayDataOffset == StepBackwards) /* Entry already selected => reset selection */
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
206 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
207 ReplayDataOffset = 0xFFFF;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
208 ReplayDataResolution = 2;
602
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
209 ReplayDataLength = 0;
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
210 ReplayDataMaxDepth = 0;
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
211 ReplayDataMinutes = 0;
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
212
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
213 retVal = 1;
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 else
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 ReplayDataOffset = StepBackwards;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
218 logbook_getHeader(StepBackwards ,&logbookHeader);
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
219
610
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
220 dataLength = logbook_readSampleData(StepBackwards, DEPTH_DATA_LENGTH, ReplayDepthData,NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ReplayMarkerData);
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
221
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
222 /* check if a marker is provided. If not disable marker functionality for the replay block */
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
223 for(index = 0; index < dataLength; index++)
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
224 {
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
225 if(ReplayMarkerData[index] != 0)
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
226 {
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
227 markerDetected = 1;
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
228 break;
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
229 }
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
230 }
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
231 if(markerDetected == 0)
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
232 {
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
233 ReplayMarkerData[0] = 0xFF;
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
234 }
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
235
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
236 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
237 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
238 ReplayDataResolution = (logbookHeader.diveTimeMinutes * 60 + logbookHeader.diveTimeSeconds) / dataLength;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
239 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
240 else
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
241 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
242 ReplayDataResolution = logbookHeader.samplingRate;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
243 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
244 ReplayDataLength = dataLength;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
245 ReplayDataMaxDepth = logbookHeader.maxDepth;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
246 ReplayDataMinutes = logbookHeader.diveTimeMinutes;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
247 if(dataLength != 0)
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
248 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
249 retVal = 1;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
250 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
251 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
252 return retVal;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
253 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
254
610
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
255 uint8_t getReplayInfo(uint16_t** pReplayData, uint8_t** pReplayMarker, uint16_t* DataLength, uint16_t* MaxDepth, uint16_t* diveMinutes)
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
256 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
257 uint8_t retVal = 0;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
258
610
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
259 if((ReplayDataOffset != 0xFFFF) && (pReplayData != NULL) && (DataLength != NULL) && (MaxDepth != NULL) && (pReplayMarker != 0))
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
260 {
602
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
261 *pReplayData = ReplayDepthData;
610
ae7f8333c900 Added access to logbook marker data:
Ideenmodellierer
parents: 603
diff changeset
262 *pReplayMarker = ReplayMarkerData;
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
263 *DataLength = ReplayDataLength;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
264 *MaxDepth = ReplayDataMaxDepth;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
265 *diveMinutes = ReplayDataMinutes;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
266 retVal = 1;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
267 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
268
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
269 return retVal;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
270 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
271
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
272 uint16_t *getMiniLiveReplayPointerToData(void)
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
273 {
602
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
274 return liveDepthData;
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
275 }
603
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
276 uint16_t *getMiniLiveDecoPointerToData(void)
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
277 {
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
278 return liveDecoData;
c56ed16dbd39 T3 profile view: Added visualization of deco data
Ideenmodellierer
parents: 602
diff changeset
279 }
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
280 uint16_t getMiniLiveReplayLength(void)
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
281 {
602
2cb0a97a07ad Added replay data scaling in case life data is longer than replay block
Ideenmodellierer
parents: 598
diff changeset
282 return lifeDataIndex;
598
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
283 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
284
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
285 uint16_t getReplayOffset(void)
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
286 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
287 return ReplayDataOffset;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
288 }
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
289
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
290 uint16_t getReplayDataResolution(void)
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
291 {
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
292 return ReplayDataResolution;
0a3836643173 New replay block for T3 profile:
Ideenmodellierer
parents: 300
diff changeset
293 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/