Changeset a1c5125 in subsurface


Ignore:
Timestamp:
Feb 3, 2017, 2:45:30 AM (3 weeks ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
fbaeeec
Parents:
1d86620
git-author:
Stefan Fuchs <sfuchs@…> (01/31/17 07:02:12)
git-committer:
Dirk Hohndel <dirk@…> (02/03/17 02:45:30)
Message:

Add ATM pressure and altitude to diveplan

Print the ATM pressure and the altitude used for calculation into the resulting diveplan.
Moved this info together with the deco model info below the runtime table.
There is one drawback in this implementation: Altitude will be recalculated from surface pressure and therefore may differ slightly from altitude entered in the UI.

Signed-off-by: Stefan Fuchs <sfuchs@…>
Signed-off-by: Dirk Hohndel <dirk@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/planner.c

    r7725842 ra1c5125  
    581581
    582582        len = show_disclaimer ? snprintf(buffer, sz_buffer, "<div><b>%s<b></div><br>", disclaimer) : 0;
    583         if (decoMode() == BUEHLMANN){
    584                 snprintf(temp, sz_temp, translate("gettextFromC", "based on Bühlmann ZHL-16C with GFlow = %d and GFhigh = %d"),
    585                         diveplan->gflow, diveplan->gfhigh);
    586         } else if (decoMode() == VPMB){
    587                 int temp_len;
    588                 if (diveplan->vpmb_conservatism == 0)
    589                         temp_len = snprintf(temp, sz_temp, "%s", translate("gettextFromC", "based on VPM-B at nominal conservatism"));
    590                 else
    591                         temp_len = snprintf(temp, sz_temp, translate("gettextFromC", "based on VPM-B at +%d conservatism"), diveplan->vpmb_conservatism);
    592                 if(diveplan->eff_gflow)
    593                         temp_len += snprintf(temp + temp_len, sz_temp - temp_len,  translate("gettextFromC", ", effective GF=%d/%d"), diveplan->eff_gflow
    594                                              , diveplan->eff_gfhigh);
    595 
    596         } else if (decoMode() == RECREATIONAL){
    597                 snprintf(temp, sz_temp, translate("gettextFromC", "recreational mode based on Bühlmann ZHL-16B with GFlow = %d and GFhigh = %d"),
    598                         diveplan->gflow, diveplan->gfhigh);
    599         }
     583
    600584        if (diveplan->surface_interval > 60) {
    601                 len += snprintf(buffer + len, sz_buffer - len, "<div><b>%s %d:%02d)</b><br>%s</div>",
     585                len += snprintf(buffer + len, sz_buffer - len, "<div><b>%s %d:%02d)</b></div>",
    602586                                translate("gettextFromC", "Subsurface dive plan (surface interval "),
    603                                 FRACTION(diveplan->surface_interval / 60, 60),
    604                                 temp);
     587                                FRACTION(diveplan->surface_interval / 60, 60));
    605588        } else {
    606                 len += snprintf(buffer + len, sz_buffer - len, "<div><b>%s</b><br>%s</div>",
    607                                 translate("gettextFromC", "Subsurface dive plan"),
    608                                 temp);
    609         }
     589                len += snprintf(buffer + len, sz_buffer - len, "<div><b>%s</b></div>",
     590                                translate("gettextFromC", "Subsurface dive plan"));
     591        }
     592       
    610593        len += snprintf(buffer + len, sz_buffer - len, translate("gettextFromC", "<div>Runtime: %dmin</div><br>"),
    611594                        diveplan_duration(diveplan));
     
    806789        if (!plan_verbatim)
    807790                len += snprintf(buffer + len, sz_buffer - len, "</tbody></table></div>");
    808 
     791       
     792        /* Print the CNS and OTU next.*/
    809793        dive->cns = 0;
    810794        dive->maxcns = 0;
     
    813797        len += snprintf(buffer + len, sz_buffer - len, "<div><br>%s: %i%%", temp, dive->cns);
    814798        snprintf(temp, sz_temp, "%s", translate("gettextFromC", "OTU"));
    815         len += snprintf(buffer + len, sz_buffer - len, "<br>%s: %i</div>", temp, dive->otu);
    816 
     799        len += snprintf(buffer + len, sz_buffer - len, "<br>%s: %i</div>", temp, dive->otu);   
     800       
     801        /* Print the settings for the diveplan next. */
     802        if (decoMode() == BUEHLMANN){
     803                snprintf(temp, sz_temp, translate("gettextFromC", "Deco model: Bühlmann ZHL-16C with GFlow = %d and GFhigh = %d"),
     804                        diveplan->gflow, diveplan->gfhigh);
     805        } else if (decoMode() == VPMB){
     806                int temp_len;
     807                if (diveplan->vpmb_conservatism == 0)
     808                        temp_len = snprintf(temp, sz_temp, "%s", translate("gettextFromC", "Deco model: VPM-B at nominal conservatism"));
     809                else
     810                        temp_len = snprintf(temp, sz_temp, translate("gettextFromC", "Deco model: VPM-B at +%d conservatism"), diveplan->vpmb_conservatism);
     811                if(diveplan->eff_gflow)
     812                        temp_len += snprintf(temp + temp_len, sz_temp - temp_len,  translate("gettextFromC", ", effective GF=%d/%d"), diveplan->eff_gflow
     813                                             , diveplan->eff_gfhigh);
     814
     815        } else if (decoMode() == RECREATIONAL){
     816                snprintf(temp, sz_temp, translate("gettextFromC", "Deco model: Recreational mode based on Bühlmann ZHL-16B with GFlow = %d and GFhigh = %d"),
     817                        diveplan->gflow, diveplan->gfhigh);
     818        }
     819        len += snprintf(buffer + len, sz_buffer - len, "<div><br>%s</div>",temp);
     820               
     821        const char *depth_unit;
     822        int altitude = (int) get_depth_units((int) (log(1013.0 / diveplan->surface_pressure) * 7800000), NULL, &depth_unit);
     823       
     824        len += snprintf(buffer + len, sz_buffer - len, translate("gettextFromC", "<div>ATM pressure: %dmbar (%d%s)</div>"),
     825                        diveplan->surface_pressure,
     826                        altitude,
     827                        depth_unit);
     828       
     829        /* Print the gas consumption next.*/   
    817830        if (dive->dc.divemode == CCR)
    818831                snprintf(temp, sz_temp, "%s", translate("gettextFromC", "Gas consumption (CCR legs excluded):"));
Note: See TracChangeset for help on using the changeset viewer.