Mercurial > public > ostc4
comparison Discovery/Src/t3.c @ 602:2cb0a97a07ad
Added replay data scaling in case life data is longer than replay block
Minor: variable name changes
author | Ideenmodellierer |
---|---|
date | Tue, 05 Jan 2021 20:35:01 +0100 |
parents | 7ef2d310287d |
children | c56ed16dbd39 |
comparison
equal
deleted
inserted
replaced
601:7ef2d310287d | 602:2cb0a97a07ad |
---|---|
181 } | 181 } |
182 | 182 |
183 void t3_miniLiveLogProfile(void) | 183 void t3_miniLiveLogProfile(void) |
184 { | 184 { |
185 SWindowGimpStyle wintemp; | 185 SWindowGimpStyle wintemp; |
186 uint16_t datalength = 0; | 186 uint16_t replayDataLength = 0; |
187 uint16_t liveDataLength = 0; | |
188 uint16_t drawDataLength = 0; | |
187 uint16_t* pReplayData; | 189 uint16_t* pReplayData; |
188 uint16_t max_depth = 10; | 190 uint16_t max_depth = 10; |
189 char text[TEXTSIZE]; | 191 char text[TEXTSIZE]; |
190 point_t start, stop; | 192 point_t start, stop; |
191 uint8_t doNotDrawLifeData = 0; | |
192 | |
193 uint16_t diveMinutes = 0; | 193 uint16_t diveMinutes = 0; |
194 | 194 |
195 wintemp.left = t3c1.WindowX0; | 195 wintemp.left = t3c1.WindowX0; |
196 wintemp.right = t3c1.WindowX0 + CV_PROFILE_WIDTH; | 196 wintemp.right = t3c1.WindowX0 + CV_PROFILE_WIDTH; |
197 wintemp.top = 480 - BigFontSeperationTopBottom + 5; | 197 wintemp.top = 480 - BigFontSeperationTopBottom + 5; |
204 | 204 |
205 GFX_draw_line(&t3screen, start, stop, CLUT_Font020); | 205 GFX_draw_line(&t3screen, start, stop, CLUT_Font020); |
206 | 206 |
207 if(getReplayOffset() != 0xFFFF) | 207 if(getReplayOffset() != 0xFFFF) |
208 { | 208 { |
209 getReplayInfo(&pReplayData, &datalength, &max_depth, &diveMinutes); | 209 getReplayInfo(&pReplayData, &replayDataLength, &max_depth, &diveMinutes); |
210 } | 210 } |
211 | 211 |
212 if(max_depth < (uint16_t)(stateUsed->lifeData.max_depth_meter * 100)) | 212 if(max_depth < (uint16_t)(stateUsed->lifeData.max_depth_meter * 100)) |
213 { | 213 { |
214 max_depth = (uint16_t)(stateUsed->lifeData.max_depth_meter * 100); | 214 max_depth = (uint16_t)(stateUsed->lifeData.max_depth_meter * 100); |
215 } | 215 } |
216 if(datalength != 0) | 216 |
217 liveDataLength = getMiniLiveReplayLength(); | |
218 | |
219 if(replayDataLength > liveDataLength) | |
220 { | |
221 drawDataLength = replayDataLength; | |
222 } | |
223 else | |
224 { | |
225 drawDataLength = liveDataLength; | |
226 } | |
227 | |
228 if(drawDataLength < CV_PROFILE_WIDTH) | |
217 { | 229 { |
218 GFX_graph_print(&t3screen, &wintemp, 0,1,0, max_depth, pReplayData, datalength, CLUT_Font031, NULL); | 230 drawDataLength = CV_PROFILE_WIDTH; |
219 } | 231 } |
220 else | |
221 { | |
222 datalength = getMiniLiveReplayLength(); | |
223 if(datalength < CV_PROFILE_WIDTH) | |
224 { | |
225 if(datalength < 3) /* wait for some data entries to start graph */ | |
226 { | |
227 doNotDrawLifeData = 1; | |
228 } | |
229 datalength = CV_PROFILE_WIDTH; | |
230 } | |
231 diveMinutes = 0; /* do not show divetime because it is already shown in the upper field */ | |
232 } | |
233 | |
234 | 232 |
235 if(diveMinutes != 0) | 233 if(diveMinutes != 0) |
236 { | 234 { |
237 snprintf(text,TEXTSIZE,"\002%dmin",diveMinutes); | 235 snprintf(text,TEXTSIZE,"\002%dmin",diveMinutes); |
238 GFX_write_string(&FontT42,&t3c1,text,1); | 236 GFX_write_string(&FontT42,&t3c1,text,1); |
239 } | 237 } |
240 | 238 |
241 snprintf(text,TEXTSIZE,"\002%01.1fm", max_depth / 100.0); | 239 snprintf(text,TEXTSIZE,"\002%01.1fm", max_depth / 100.0); |
242 GFX_write_string(&FontT42,&t3c1,text,0); | 240 GFX_write_string(&FontT42,&t3c1,text,0); |
243 | 241 |
244 if(!doNotDrawLifeData) | 242 if(replayDataLength != 0) |
245 { | 243 { |
246 GFX_graph_print(&t3screen, &wintemp, 0,1,0, max_depth, getMiniLiveReplayPointerToData(), datalength, CLUT_Font030, NULL); | 244 GFX_graph_print(&t3screen, &wintemp, 0,1,0, max_depth, pReplayData, drawDataLength, CLUT_Font031, NULL); |
245 } | |
246 | |
247 if(liveDataLength > 3) | |
248 { | |
249 GFX_graph_print(&t3screen, &wintemp, 0,1,0, max_depth, getMiniLiveReplayPointerToData(), drawDataLength, CLUT_Font030, NULL); | |
247 } | 250 } |
248 } | 251 } |
249 | 252 |
250 | 253 |
251 void t3_refresh(void) | 254 void t3_refresh(void) |