From c67eacf179af07706cf219ca678577cb5e0d917b Mon Sep 17 00:00:00 2001
From: "Robert C. Helling" <hell...@atdotde.de>
Date: Tue, 14 Jun 2016 17:12:57 +0200
Subject: [PATCH] Only setpoint changes with non-zero SP indicate a CCR dive
To: subsurface@subsurface-divelog.org

There might be some spurious setpoint changes at t=0 without
an actual value (I have no idea where those come from). In
any case, those do not indicate that the dive is a CCR dive.

Signed-off-by: Robert C. Helling <hell...@atdotde.de>
---
 core/load-git.c  | 2 +-
 core/parse-xml.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/load-git.c b/core/load-git.c
index be7fac7..9ae4795 100644
--- a/core/load-git.c
+++ b/core/load-git.c
@@ -762,7 +762,7 @@ static void parse_dc_event(char *line, struct membuffer 
*str, void *_dc)
         * Better to mark them being CCR on import so no need for special 
treatments elsewhere on
         * the code.
         */
-       if (ev && event.time.seconds == 0 && event.type == SAMPLE_EVENT_PO2 && 
dc->divemode==OC) {
+       if (ev && event.time.seconds == 0 && event.type == SAMPLE_EVENT_PO2 && 
event.value && xdc->divemode==OC) {
                dc->divemode = CCR;
        }
 
diff --git a/core/parse-xml.c b/core/parse-xml.c
index c79d7a9..3b5a2d7 100644
--- a/core/parse-xml.c
+++ b/core/parse-xml.c
@@ -1663,7 +1663,7 @@ static void event_end(void)
                 * Older logs might mark the dive to be CCR by having an "SP 
change" event at time 0:00. Better
                 * to mark them being CCR on import so no need for special 
treatments elsewhere on the code.
                 */
-               if (ev && cur_event.time.seconds == 0 && cur_event.type == 
SAMPLE_EVENT_PO2 && dc->divemode==OC) {
+               if (ev && cur_event.time.seconds == 0 && cur_event.type == 
SAMPLE_EVENT_PO2 && cur_event.value && dc->divemode==OC) {
                        dc->divemode = CCR;
                }
 
-- 
2.7.4 (Apple Git-66)


This should fix a bug reported in the forum that one cannot change a dive to 
type OC.

Best
Robert

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to