diff options
-rw-r--r-- | src/opendeco.c | 10 | ||||
-rw-r--r-- | src/output.c | 21 | ||||
-rw-r--r-- | src/output.h | 1 |
3 files changed, 21 insertions, 11 deletions
diff --git a/src/opendeco.c b/src/opendeco.c index 04984a9..6f8711e 100644 --- a/src/opendeco.c +++ b/src/opendeco.c @@ -52,8 +52,10 @@ void print_gas_use(void) { static char gasbuf[12]; - wprintf(L"\n"); + wprintf(L"\nRMV dive: %.2f%lc/min\n", RMV_DIVE, LTR); + wprintf(L"RMV deco: %.2f%lc/min\n\n", RMV_DECO, LTR); + wprintf(L"Gas use:\n", RMV_DECO, LTR); for (int i = 0; i < 10; i++) { if (gas_usage[i].gas) { format_gas(gasbuf, len(gasbuf), gas_usage[i].gas); @@ -223,9 +225,11 @@ int main(int argc, char *argv[]) decoinfo_t di = calc_deco(&ds, depth, gas, deco_gasses, nof_gasses, &print_segment_callback); /* output deco info and disclaimer */ - print_gas_use(); - wprintf(L"\nNDL: %i TTS: %i TTS @+5: %i\n", (int) floor(di.ndl), (int) ceil(di.tts), (int) ceil(di_plus5.tts)); + wprintf(L"\nNDL: %imin TTS: %imin TTS @+5: %imin\n", (int) floor(di.ndl), (int) ceil(di.tts), + (int) ceil(di_plus5.tts)); print_planfoot(&ds); + print_gas_use(); + print_disclaimer(); /* cleanup */ free(deco_gasses); diff --git a/src/output.c b/src/output.c index 04352d5..6d24b65 100644 --- a/src/output.c +++ b/src/output.c @@ -6,6 +6,8 @@ #include "output.h" +#define DEPTHUNIT ((UNITS == METRIC) ? "m " : "ft") + void format_mm_ss(char *buf, size_t buflen, double time) { double mm; @@ -68,7 +70,7 @@ int scan_gas(gas_t *gas, char *str) void print_planhead(void) { wprintf(L"DIVE PLAN\n\n"); - wprintf(L" %-1s %-5s %-8s %-7s %1s %-9s %-4s %-3s\n", "", "Depth", "Duration", "Runtime", "", "Gas", "pO2", + wprintf(L" %-1s %6s %8s %-7s %1s %-9s %4s %5s\n", "", "Depth", "Duration", "Runtime", "", "Gas", "pO2", "EAD"); } @@ -77,7 +79,7 @@ void print_planline(wchar_t sign, double depth, double time, double runtime, con static char gasbuf[11]; static char runbuf[8]; static char pO2buf[5]; - static char eadbuf[4]; + static char eadbuf[6]; static char timbuf[16]; static gas_t last_gas; @@ -99,15 +101,15 @@ void print_planline(wchar_t sign, double depth, double time, double runtime, con /* only print ead and pO2 on stops */ if (sign == LVL) { - snprintf(eadbuf, 4, "%3i", ead_x); + snprintf(eadbuf, 6, "%3i%s", ead_x, DEPTHUNIT); snprintf(pO2buf, 5, "%4.2f", ppO2(depth, gas)); } else { - snprintf(eadbuf, 4, "%3s", "-"); + snprintf(eadbuf, 6, "%5s", "-"); snprintf(pO2buf, 5, "%4s", "-"); } - wprintf(L" %lc %4i%s %8s %-7s %lc %-9s %s %s\n", sign, depth_x, (UNITS == METRIC) ? "m" : "ft", timbuf, - runbuf, swi, gasbuf, pO2buf, eadbuf); + wprintf(L" %lc %4i%2s %8s %-7s %lc %-9s %s %s\n", sign, depth_x, DEPTHUNIT, timbuf, runbuf, swi, gasbuf, + pO2buf, eadbuf); } void print_planfoot(const decostate_t *ds) @@ -135,7 +137,10 @@ void print_planfoot(const decostate_t *ds) wprintf(L"\nDeco model: Buhlmann %s\n", model); wprintf(L"Conservatism: GF %i/%i, Rq = %s\n", ds->gflo, ds->gfhi, rq); - wprintf(L"Surface pressure: %4.3fbar\n\n", SURFACE_PRESSURE); + wprintf(L"Surface pressure: %4.3fbar\n", SURFACE_PRESSURE); +} - wprintf(L"WARNING: DIVE PLAN MAY BE INACCURATE AND MAY CONTAIN\nERRORS THAT COULD LEAD TO INJURY OR DEATH.\n"); +void print_disclaimer(void) +{ + wprintf(L"\nWARNING: DIVE PLAN MAY BE INACCURATE AND MAY CONTAIN\nERRORS THAT COULD LEAD TO INJURY OR DEATH.\n"); } diff --git a/src/output.h b/src/output.h index 083cef0..ca390d4 100644 --- a/src/output.h +++ b/src/output.h @@ -17,6 +17,7 @@ void print_planhead(void); void print_planline(wchar_t sign, double depth, double time, double runtime, const gas_t *gas); void print_planfoot(const decostate_t *ds); +void print_disclaimer(void); int scan_gas(gas_t *gas, char *str); void format_gas(char *buf, size_t buflen, const gas_t *gas); |