Mercurial > public > ostc4
diff Discovery/Src/logbook.c @ 199:ac58a9fb92ac div-fixes-cleaup-2
Bugfix: fix initial CNS data in the logbook header
Apparently, there has been confusion in the past about the data format of the
CNS data in the logbook. This seems to be partially fixed back in 2015, but
this fix forgot that the initial CNS data is also in the logbook header.
So, now, the logbook header also stores the initial CNS data in a correct way,
which fixes the problem of strange CNS values at the very start of repetitive
dives, that get reset in the dive profile after the first CNS sample data comes
along.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Fri, 22 Mar 2019 08:36:39 +0100 |
parents | f23b9055436f |
children | 2bb1db22b5f5 |
line wrap: on
line diff
--- a/Discovery/Src/logbook.c Thu Mar 21 15:28:47 2019 +0100 +++ b/Discovery/Src/logbook.c Fri Mar 22 08:36:39 2019 +0100 @@ -238,7 +238,7 @@ header.dateDay = Sdate.Date; header.timeHour = Stime.Hours; header.timeMinute = Stime.Minutes; - header.cnsAtBeginning = (uint16_t)((pInfo->lifeData.cns * 100) + 0.5f); + header.cnsAtBeginning = (uint16_t)pInfo->lifeData.cns; header.surfacePressure_mbar = (uint16_t)(pInfo->lifeData.pressure_surface_bar * 1000); header.firmwareVersionHigh = firmwareVersion_16bit_high(); header.firmwareVersionLow = firmwareVersion_16bit_low(); @@ -609,8 +609,7 @@ if(divisor.cns == 0) { divisor.cns = smallHeader.cnsDivisor - 1; - //addU16(&sample[length], (uint16_t)(state.lifeData.cns * 100.0f + 0.5f)); - addU16(&sample[length], (uint16_t)(state.lifeData.cns)); // hw 151110 cns is 0 to 100 % and more (not 0 to 1.00 and more) + addU16(&sample[length], (uint16_t)state.lifeData.cns); length += 2; } else