comparison 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
comparison
equal deleted inserted replaced
198:878dc9e0dbc5 199:ac58a9fb92ac
236 header.dateYear = Sdate.Year; 236 header.dateYear = Sdate.Year;
237 header.dateMonth = Sdate.Month; 237 header.dateMonth = Sdate.Month;
238 header.dateDay = Sdate.Date; 238 header.dateDay = Sdate.Date;
239 header.timeHour = Stime.Hours; 239 header.timeHour = Stime.Hours;
240 header.timeMinute = Stime.Minutes; 240 header.timeMinute = Stime.Minutes;
241 header.cnsAtBeginning = (uint16_t)((pInfo->lifeData.cns * 100) + 0.5f); 241 header.cnsAtBeginning = (uint16_t)pInfo->lifeData.cns;
242 header.surfacePressure_mbar = (uint16_t)(pInfo->lifeData.pressure_surface_bar * 1000); 242 header.surfacePressure_mbar = (uint16_t)(pInfo->lifeData.pressure_surface_bar * 1000);
243 header.firmwareVersionHigh = firmwareVersion_16bit_high(); 243 header.firmwareVersionHigh = firmwareVersion_16bit_high();
244 header.firmwareVersionLow = firmwareVersion_16bit_low(); 244 header.firmwareVersionLow = firmwareVersion_16bit_low();
245 header.logbookProfileVersion = LOGBOOK_VERSION; 245 header.logbookProfileVersion = LOGBOOK_VERSION;
246 header.salinity = pSettings->salinity; 246 header.salinity = pSettings->salinity;
607 } 607 }
608 } 608 }
609 if(divisor.cns == 0) 609 if(divisor.cns == 0)
610 { 610 {
611 divisor.cns = smallHeader.cnsDivisor - 1; 611 divisor.cns = smallHeader.cnsDivisor - 1;
612 //addU16(&sample[length], (uint16_t)(state.lifeData.cns * 100.0f + 0.5f)); 612 addU16(&sample[length], (uint16_t)state.lifeData.cns);
613 addU16(&sample[length], (uint16_t)(state.lifeData.cns)); // hw 151110 cns is 0 to 100 % and more (not 0 to 1.00 and more)
614 length += 2; 613 length += 2;
615 } 614 }
616 else 615 else
617 { 616 {
618 divisor.cns--; 617 divisor.cns--;