Changeset abbb0a2 in subsurface


Ignore:
Timestamp:
Apr 20, 2017, 10:57:11 AM (5 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
ff5c04e
Parents:
89b914e
git-author:
Jan Mulder <jlmulder@…> (04/19/17 23:43:48)
git-committer:
Dirk Hohndel <dirk@…> (04/20/17 10:57:11)
Message:

Handle CCR setpoint when replanning a dive

When replanning a dive, the setpoint information from the profile waypoints
were reset to 0, resulting in a dive that has a dive mode of CCR, but only with
OC legs in the profile. This is just wrong, and is corrected here. Notice
that there is no averaging involved (in the reduction of a replanned real
dive that has more than 100 waypoints) as is done for depth. This is just
fine for setpoint data.

Signed-off-by: Jan Mulder <jlmulder@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • qt-models/diveplannermodel.cpp

    ra5d54b0 rabbb0a2  
    7070        int depthsum = 0;
    7171        int samplecount = 0;
     72        o2pressure_t last_sp;
    7273        bool oldRec = recalc;
    7374        struct divecomputer *dc = &(d->dc);
     
    9899        int j = 0;
    99100        int cylinderid = 0;
     101        last_sp.mbar = 0;
    100102        for (int i = 0; i < plansamples - 1; i++) {
    101103                while (j * plansamples <= i * dc->samples) {
     
    103105                        if (s.time.seconds != 0 && (!hasMarkedSamples || s.manually_entered)) {
    104106                                depthsum += s.depth.mm;
     107                                last_sp = s.setpoint;
    105108                                ++samplecount;
    106109                                newtime = s.time;
     
    111114                        cylinderid = get_cylinderid_at_time(d, dc, lasttime);
    112115                        if (newtime.seconds - lastrecordedtime.seconds > 10) {
    113                                 addStop(depthsum / samplecount, newtime.seconds, cylinderid, 0, true);
     116                                addStop(depthsum / samplecount, newtime.seconds, cylinderid, last_sp.mbar, true);
    114117                                lastrecordedtime = newtime;
    115118                        }
     
    120123        }
    121124        // make sure we get the last point right so the duration is correct
    122         if (!hasMarkedSamples) addStop(0, d->dc.duration.seconds,cylinderid, 0, true);
     125        if (!hasMarkedSamples) addStop(0, d->dc.duration.seconds,cylinderid, last_sp.mbar, true);
    123126        recalc = oldRec;
    124127        emitDataChanged();
Note: See TracChangeset for help on using the changeset viewer.