comparison Discovery/Src/logbook.c @ 281:54d14bc2083c

Fix typos (There are still many...) Limit stored NDL within 0 to 240 mins (Since it's 8bit UINT only) - I asume this is was a bug causing bad NDL readings in the logbook when downloaded with libdivecomputer
author heinrichsweikamp
date Wed, 01 May 2019 14:39:46 +0200
parents 2e58a4094770
children 04cdeff80254
comparison
equal deleted inserted replaced
280:ae27d6185d51 281:54d14bc2083c
125 125
126 126
127 /** 127 /**
128 ****************************************************************************** 128 ******************************************************************************
129 * @brief logbook_getCurrentHeader. / 129 * @brief logbook_getCurrentHeader. /
130 * @author Peter Ryser 130 * @author heinrichs weikamp
131 * @version V0.0.1 131 * @version V0.0.1
132 * @date 22-April-2014 132 * @date 22-April-2014
133 ****************************************************************************** 133 ******************************************************************************
134 * 134 *
135 * @return SLogbookHeader*: 135 * @return SLogbookHeader*:
156 156
157 157
158 /** 158 /**
159 ****************************************************************************** 159 ******************************************************************************
160 * @brief logbook_getHeader. / 160 * @brief logbook_getHeader. /
161 * @author Peter Ryser 161 * @author heinrichs weikamp
162 * @version V0.0.1 162 * @version V0.0.1
163 * @date 22-April-2014 163 * @date 22-April-2014
164 ****************************************************************************** 164 ******************************************************************************
165 * 165 *
166 * @param StepBackwards : 0 Last lokbook entry, 1 second to last entry, etc. 166 * @param StepBackwards : 0 Last lokbook entry, 1 second to last entry, etc.
180 ****************************************************************************** 180 ******************************************************************************
181 * @brief logbook_initNewdiveProfile. / 181 * @brief logbook_initNewdiveProfile. /
182 * creates header and smallHeader from diveState and global Settings 182 * creates header and smallHeader from diveState and global Settings
183 * and writes new lookboock entry on flash device 183 * and writes new lookboock entry on flash device
184 * diveState 184 * diveState
185 * @author Peter Ryser 185 * @author heinrichs weikamp
186 * @version V0.0.1 186 * @version V0.0.1
187 * @date 22-April-2014 187 * @date 22-April-2014
188 ****************************************************************************** 188 ******************************************************************************
189 * 189 *
190 * @param SDiveState* pInfo: Input 190 * @param SDiveState* pInfo: Input
315 } 315 }
316 316
317 /** 317 /**
318 ****************************************************************************** 318 ******************************************************************************
319 * @brief clear_divisor / clears divisor struct 319 * @brief clear_divisor / clears divisor struct
320 * @author Peter Ryser 320 * @author heinrichs weikamp
321 * @version V0.0.1 321 * @version V0.0.1
322 * @date 22-April-2014 322 * @date 22-April-2014
323 ****************************************************************************** 323 ******************************************************************************
324 * 324 *
325 */ 325 */
336 336
337 337
338 /** 338 /**
339 ****************************************************************************** 339 ******************************************************************************
340 * @brief add16. / adds 16 bit variable to 8 bit array 340 * @brief add16. / adds 16 bit variable to 8 bit array
341 * @author Peter Ryser 341 * @author heinrichs weikamp
342 * @version V0.0.1 342 * @version V0.0.1
343 * @date 22-April-2014 343 * @date 22-April-2014
344 ****************************************************************************** 344 ******************************************************************************
345 * 345 *
346 * @param uint8_t *pos: Output 8 bit array 346 * @param uint8_t *pos: Output 8 bit array
357 } 357 }
358 358
359 /** 359 /**
360 ****************************************************************************** 360 ******************************************************************************
361 * @brief logbook_writeSample. / Writes one logbook sampl 361 * @brief logbook_writeSample. / Writes one logbook sampl
362 * @author Peter Ryser 362 * @author heinrichs weikamp
363 * @date 22-April-2014 363 * @date 22-April-2014
364 * @version V0.0.2 364 * @version V0.0.2
365 * @since 20-June-2016 365 * @since 20-June-2016
366 * @bug Deco/NDL Status fixed in V0.0.2 366 * @bug Deco/NDL Status fixed in V0.0.2
367 367
424 if(state->warnings.slowWarning) 424 if(state->warnings.slowWarning)
425 { 425 {
426 eventByte1.uw = 1; 426 eventByte1.uw = 1;
427 } 427 }
428 // sub bit 4 to 7 428 // sub bit 4 to 7
429 if(state->events.manuelGasSet) 429 if(state->events.manualGasSet)
430 { 430 {
431 eventByte1.ub.bit4 = 1; 431 eventByte1.ub.bit4 = 1;
432 } 432 }
433 if(state->events.gasChange) 433 if(state->events.gasChange)
434 { 434 {
454 { 454 {
455 sample[length] = eventByte2.uw; 455 sample[length] = eventByte2.uw;
456 length++; 456 length++;
457 } 457 }
458 //Add EventInfos 458 //Add EventInfos
459 if(state->events.manuelGasSet) 459 if(state->events.manualGasSet)
460 { 460 {
461 //manual gas in %O2 & %He 461 //manual gas in %O2 & %He
462 sample[length] = state->events.info_manuelGasSetO2; 462 sample[length] = state->events.info_manualGasSetO2;
463 length += 1; 463 length += 1;
464 sample[length] = state->events.info_manuelGasSetHe; 464 sample[length] = state->events.info_manualGasSetHe;
465 length += 1; 465 length += 1;
466 } 466 }
467 if(state->events.gasChange) 467 if(state->events.gasChange)
468 { 468 {
469 //Current gas (gasid) 469 //Current gas (gasid)
519 if(pDecoinfo->output_ndl_seconds > 0) 519 if(pDecoinfo->output_ndl_seconds > 0)
520 { 520 {
521 sample[length] = 0; 521 sample[length] = 0;
522 length += 1; 522 length += 1;
523 sample[length] = (uint8_t)pDecoinfo->output_ndl_seconds / 60; 523 sample[length] = (uint8_t)pDecoinfo->output_ndl_seconds / 60;
524
525 // Limit stored sample within 0 to 240 mins (Since it's 8bit UINT only)
526 if ((pDecoinfo->output_ndl_seconds / 60) > 240) sample[length] = 240;
527 if ((pDecoinfo->output_ndl_seconds / 60) < 0) sample[length] = 0;
528
524 length += 1; 529 length += 1;
525 } 530 }
526 else if(pDecoinfo->output_time_to_surface_seconds) 531 else if(pDecoinfo->output_time_to_surface_seconds)
527 { 532 {
528 tHome_findNextStop(pDecoinfo->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds); 533 tHome_findNextStop(pDecoinfo->output_stop_length_seconds, &nextstopDepthMeter, &nextstopLengthSeconds);
628 } 633 }
629 634
630 /** 635 /**
631 ****************************************************************************** 636 ******************************************************************************
632 * @brief readSample. / Reads data of one logbook sample 637 * @brief readSample. / Reads data of one logbook sample
633 * @author Peter Ryser 638 * @author heinrichs weikamp
634 * @version V0.0.1 639 * @version V0.0.1
635 * @date 22-April-2014 640 * @date 22-April-2014
636 ****************************************************************************** 641 ******************************************************************************
637 * 642 *
638 * @param int32_t* depth: output Value 643 * @param int32_t* depth: output Value
867 return bytesRead; 872 return bytesRead;
868 } 873 }
869 /** 874 /**
870 ****************************************************************************** 875 ******************************************************************************
871 * @brief logbook_readSampleData. / Reads sample data of whole logbook entry 876 * @brief logbook_readSampleData. / Reads sample data of whole logbook entry
872 * @author Peter Ryser 877 * @author heinrichs weikamp
873 * @version V0.0.1 878 * @version V0.0.1
874 * @date 22-April-2014 879 * @date 22-April-2014
875 ****************************************************************************** 880 ******************************************************************************
876 * 881 *
877 * @param uint8_t StepBackwards: witch lookbook entry? 882 * @param uint8_t StepBackwards: witch lookbook entry?
1536 1541
1537 1542
1538 /** 1543 /**
1539 ****************************************************************************** 1544 ******************************************************************************
1540 * @brief logbook_readSampleData. / Reads sample data of whole logbook entry 1545 * @brief logbook_readSampleData. / Reads sample data of whole logbook entry
1541 * @author Peter Ryser 1546 * @author heinrichs weikamp
1542 * @version V0.0.1 1547 * @version V0.0.1
1543 * @date 22-April-2014 1548 * @date 22-April-2014
1544 ****************************************************************************** 1549 ******************************************************************************
1545 * 1550 *
1546 * @param uint8_t StepBackwards: witch lookbook entry? 1551 * @param uint8_t StepBackwards: witch lookbook entry?