Changeset 4359974 in subsurface


Ignore:
Timestamp:
Jan 3, 2017, 10:28:18 PM (7 weeks ago)
Author:
Subsurface <dirk@…>
Branches:
master
Children:
82bd9e3
Parents:
72bcb64
git-author:
Robert C. Helling <helling@…> (01/03/17 06:14:42)
git-committer:
Subsurface <dirk@…> (01/03/17 22:28:18)
Message:

Display surface interval in diveplan

...instead of just stating "repetitive dive". As requested by
a user.

Signed-off-by: Robert C. Helling <helling@…>

Location:
core
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • core/dive.h

    rc1ef59c r4359974  
    861861        struct divedatapoint *dp;
    862862        int eff_gflow, eff_gfhigh;
    863         bool repetitive;
     863        unsigned int surface_interval;
    864864};
    865865
  • core/divelist.c

    rc1ef59c r4359974  
    362362/* take into account previous dives until there is a 48h gap between dives */
    363363/* return true if this is a repetitive dive */
    364 bool init_decompression(struct dive *dive)
     364unsigned int init_decompression(struct dive *dive)
    365365{
    366366        int i, divenr = -1;
     
    449449        // I do not dare to remove this call. We don't need the result but it might have side effects. Bummer.
    450450        tissue_tolerance_calc(dive, surface_pressure);
    451         return deco_init;
     451        return surface_time;
    452452}
    453453
  • core/divelist.h

    rc1ef59c r4359974  
    1515extern int unsaved_changes(void);
    1616extern void remove_autogen_trips(void);
    17 extern bool init_decompression(struct dive *dive);
     17extern unsigned int init_decompression(struct dive *dive);
    1818
    1919/* divelist core logic functions */
  • core/planner.c

    rc1ef59c r4359974  
    129129
    130130/* returns the tissue tolerance at the end of this (partial) dive */
    131 bool tissue_at_end(struct dive *dive, char **cached_datap)
     131unsigned int tissue_at_end(struct dive *dive, char **cached_datap)
    132132{
    133133        struct divecomputer *dc;
     
    137137        duration_t t0 = {}, t1 = {};
    138138        struct gasmix gas;
    139         bool repetitive = false;
     139        unsigned int surface_interval = 0;
    140140
    141141        if (!dive)
    142                 return false;
     142                return 0;
    143143        if (*cached_datap) {
    144144                restore_deco_state(*cached_datap);
    145145        } else {
    146                 repetitive = init_decompression(dive);
     146                surface_interval = init_decompression(dive);
    147147                cache_deco_state(cached_datap);
    148148        }
    149149        dc = &dive->dc;
    150150        if (!dc->samples)
    151                 return false;
     151                return 0;
    152152        psample = sample = dc->sample;
    153153
     
    192192                t0 = t1;
    193193        }
    194         return repetitive;
     194        return surface_interval;
    195195}
    196196
     
    597597                        diveplan->gflow, diveplan->gfhigh);
    598598        }
    599         len += snprintf(buffer + len, sz_buffer - len, "<div><b>%s%s</b><br>%s</div>",
    600                         translate("gettextFromC", "Subsurface dive plan"),
    601                         diveplan->repetitive ? translate("gettextFromC", " (repetitive)") : "",
    602                         temp);
     599        if (diveplan->surface_interval > 60) {
     600                len += snprintf(buffer + len, sz_buffer - len, "<div><b>%s %d:%02d)</b><br>%s</div>",
     601                                translate("gettextFromC", "Subsurface dive plan (surface interval "),
     602                                FRACTION(diveplan->surface_interval / 60, 60),
     603                                temp);
     604        } else {
     605                len += snprintf(buffer + len, sz_buffer - len, "<div><b>%s</b><br>%s</div>",
     606                                translate("gettextFromC", "Subsurface dive plan"),
     607                                temp);
     608        }
    603609        len += snprintf(buffer + len, sz_buffer - len, translate("gettextFromC", "<div>Runtime: %dmin</div><br>"),
    604610                        diveplan_duration(diveplan));
     
    10871093
    10881094        /* Set tissue tolerance and initial vpmb gradient at start of ascent phase */
    1089         diveplan->repetitive = tissue_at_end(&displayed_dive, cached_datap);
     1095        diveplan->surface_interval = tissue_at_end(&displayed_dive, cached_datap);
    10901096        nuclear_regeneration(clock);
    10911097        vpmb_start_gradient();
Note: See TracChangeset for help on using the changeset viewer.