# HG changeset patch
# User Jan Mulder <jlmulder@xs4all.nl>
# Date 1553240199 -3600
# Node ID ac58a9fb92acd7310314ca64b9c1cd627402ce4d
# Parent  878dc9e0dbc5f9aab8be89350564593c83920c4c
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>

diff -r 878dc9e0dbc5 -r ac58a9fb92ac Discovery/Src/logbook.c
--- 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