# HG changeset patch # User heinrichsweikamp # Date 1318486858 -7200 # Node ID a863fd56189c9bc5d4d36ffd1f5b7773d3d2c26d # Parent 9fc8feff27a50a2df688dd59608e7ac05fdf3552# Parent 8f48826393267ba226ec3ee9918ff4f0443f3628 Merge with 478 diff -r 8f4882639326 -r a863fd56189c code_part1/OSTC_code_asm_part1/changelog.txt --- a/code_part1/OSTC_code_asm_part1/changelog.txt Tue Oct 11 21:17:05 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/changelog.txt Thu Oct 13 08:20:58 2011 +0200 @@ -1,5 +1,6 @@ New in 2.02 beta: NEW: Cave divers consomation display and alarm (CF59). +CHANGE: SAC (CF56/CF57) in range 5..50 l/min (no more decimal). NEW: 32MhZ mode: computes twice faster. BUGFIX: Hang when deco table is full (more than 32 stops). diff -r 8f4882639326 -r a863fd56189c code_part1/OSTC_code_asm_part1/customview.asm --- a/code_part1/OSTC_code_asm_part1/customview.asm Tue Oct 11 21:17:05 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/customview.asm Thu Oct 13 08:20:58 2011 +0200 @@ -17,43 +17,53 @@ ; Customviews for divemode ; written by: Matthias Heinrichs, info@heinrichsweikamp.com -; written: 101212 ; history: -; 2010-12-12: [MH] last updated +; 2010-12-12: [MH] First updated ; 2011-01-04: [jDG] Saturation graphs in customview divemode +; 2011-10-10: [jDG] Added Cave live gas counter ; known bugs: ; ToDo: ;============================================================================= ; Show the customview-dependent entry for the divemode menu ; -customview_menu_entry3: -; bcf menu3_active ;=1: menu entry three in divemode menu is active - +customview_menu_entry3: movff menupos3,WREG ; copy dcfsnz WREG,F bra customview_menu3_stopwatch ; Show the stopwatch option in divemode menu dcfsnz WREG,F bra customview_menu3_marker ; Show the marker option in divemode menu dcfsnz WREG,F - bra customview_menu3_clock ; Show the clock option in divemode menu + bra customview_menu3_clock ; Show nothing + dcfsnz WREG,F + bra customview_menu3_lead_tiss ; Show nothing + dcfsnz WREG,F + bra customview_menu3_average ; Show nothing dcfsnz WREG,F - bra customview_menu3_lead_tiss ; Show the leading tissue option in divemode menu - ; Menupos3=0, do nothing + bra customview_menu3_graphs ; Show nothing + dcfsnz WREG,F + bra customview_menu3_ead_end ; Show nothing + dcfsnz WREG,F + bra customview_menu3_@5 ; Show nothing + dcfsnz WREG,F + bra customview_menu3_cave_bailout; Show reset option return +customview_menu3_cave_bailout: customview_menu3_stopwatch: -; bsf menu3_active ; Set Flag DISPLAYTEXT .33 ; ResetAvr return customview_menu3_marker: -; bsf menu3_active ; Set Flag DISPLAYTEXT .30 ; Set Marker return customview_menu3_clock: ; No menu entry -customview_menu3_lead_tiss ; No menu entry +customview_menu3_lead_tiss: +customview_menu3_average: +customview_menu3_graphs: +customview_menu3_ead_end: +customview_menu3_@5: return ;============================================================================= @@ -120,6 +130,7 @@ goto PLED_show_@5 customview_1sec_cave_bailout: + bsf menu3_active ; Set Flag goto PLED_show_cave_bailout ;============================================================================= @@ -168,7 +179,7 @@ ; Show next customview (and delete this flag) customview_toggle: - bcf menu3_active ;=1: menu entry three in divemode menu is active + bcf menu3_active ;=1: menu entry three in divemode menu is active ostc_debug 'X' ; Sends debug-information to screen if debugmode active btfsc FLAG_apnoe_mode ; In Apnoe mode? @@ -238,7 +249,7 @@ call PLED_standard_color DISPLAYTEXT d'151' ; Set Marker? - bsf menu3_active ; Set Flag + bsf menu3_active ; Set Flag bra customview_toggle_exit customview_init_clock: ; Init Clock @@ -288,6 +299,7 @@ iorwf hi,W bz customview_toggle ; No: jump to next Customview ! + bsf menu3_active ; Set Flag call PLED_show_cave_bailout bra customview_toggle_exit diff -r 8f4882639326 -r a863fd56189c code_part1/OSTC_code_asm_part1/definitions.asm --- a/code_part1/OSTC_code_asm_part1/definitions.asm Tue Oct 11 21:17:05 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/definitions.asm Thu Oct 13 08:20:58 2011 +0200 @@ -110,7 +110,7 @@ ;============================================================================= -;#include "../OSTC_code_c_part2/shared_definitions.h" +#include "../OSTC_code_c_part2/shared_definitions.h" #include "ostc2_code/code_part1/OSTC_code_c_part2/shared_definitions.h" ;============================================================================= diff -r 8f4882639326 -r a863fd56189c code_part1/OSTC_code_asm_part1/divemode_menu.asm --- a/code_part1/OSTC_code_asm_part1/divemode_menu.asm Tue Oct 11 21:17:05 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/divemode_menu.asm Thu Oct 13 08:20:58 2011 +0200 @@ -194,15 +194,24 @@ bra timeout_divemenu2 ; Quit divemode menu divemode_menu3: - movff menupos3,temp1 ; copy - dcfsnz temp1,F + dcfsnz menupos3,W ; copy bra toggle_stopwatch ; Toggle Stopwatch/Average register - dcfsnz temp1,F + dcfsnz WREG,F bra set_marker ; Set Marker - dcfsnz temp1,F + dcfsnz WREG,F bra divemode_menu3_nothing ; clock... - dcfsnz temp1,F + dcfsnz WREG,F bra divemode_menu3_nothing ; leading tissue... + dcfsnz WREG,F + bra divemode_menu3_nothing ; Average depth (not resetable) + dcfsnz WREG,F + bra divemode_menu3_nothing ; Graphs... + dcfsnz WREG,F + bra divemode_menu3_nothing ; END/EAD in divemode + dcfsnz WREG,F + bra divemode_menu3_nothing ; Futur TTS... + dcfsnz WREG,F + bra toggle_stopwatch ; Cave bailout prediction. divemode_menu3_nothing: bra timeout_divemenu2 ; Quit divemode menu diff -r 8f4882639326 -r a863fd56189c code_part1/OSTC_code_asm_part1/menu_custom.asm --- a/code_part1/OSTC_code_asm_part1/menu_custom.asm Tue Oct 11 21:17:05 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_custom.asm Thu Oct 13 08:20:58 2011 +0200 @@ -47,7 +47,7 @@ ; define the display format. Also stores min/max bounds into the PROM table. ; And provides surfacemode checking of all parameters. -CF_INT8 EQU 0 ; Default display, 8 or 15 bits values. +CF_INT8 EQU 0 ; Default display, 8 or 15 bits values. CF_PERCENT EQU 1 ; Displays 110% CF_DECI EQU 2 ; Displays 1.6 CF_CENTI EQU 3 ; Displays 1.50 diff -r 8f4882639326 -r a863fd56189c code_part1/OSTC_code_asm_part1/menu_reset.asm --- a/code_part1/OSTC_code_asm_part1/menu_reset.asm Tue Oct 11 21:17:05 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_reset.asm Thu Oct 13 08:20:58 2011 +0200 @@ -178,9 +178,9 @@ CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF53 Show Laeding Tissue in Divemode CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF54 Display shallowest stop first CF_DEFAULT CF_INT8, d'0', d'0', d'10' ; GF55 Gas switch additional delay - CF_DEFAULT CF_DECI, d'200', d'5', d'250' ; CF56 Bottom gas usage (l/min or bar/min) + CF_DEFAULT CF_INT8, d'20', d'5', d'50' ; CF56 Bottom gas usage (SAC l/min) - CF_DEFAULT CF_DECI, d'200', d'5', d'250' ; CF57 Ascent/deco gas usage (l/min or bar/min) + CF_DEFAULT CF_INT8, d'20', d'5', d'50' ; CF57 Ascent/deco gas usage (SAC l/min) CF_DEFAULT CF_INT8, d'0', d'0', d'10' ; CF58 TTS for extra time at current depth [min] CF_DEFAULT CF_INT15, d'0', d'0', d'7000' ; CF59 Cave conso warning [l] CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED diff -r 8f4882639326 -r a863fd56189c code_part1/OSTC_code_asm_part1/pled_outputs.asm --- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm Tue Oct 11 21:17:05 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm Thu Oct 13 08:20:58 2011 +0200 @@ -3370,29 +3370,19 @@ call PLED_standard_color lfsr FSR2,letter - ;---- Compute divetime in seconds - movff divemins+0,xA+0 - movff divemins+1,xA+1 - movlw d'60' - movwf xB+0 - clrf xB+1 - call mult16x16 ; xC:4=xA:2*xB:2 - movf divesecs,W - addwf xC+0,W - movwf xA+0 - movlw d'0' - addwfc xC+1,W - movwf xA+1 ; xA:2 holds total dive seconds + ;---- Retrieve divetime in seconds (since last reset) + movff average_divesecs+0,xA+0 + movff average_divesecs+1,xA+1 - ;---- Multiply by SAC, and divide by 600 (SAC in 0.1 liters per minutes) + ;---- Multiply by SAC, and divide by 60 (SAC inliters per minutes) GETCUSTOM8 d'56' ; Get bottom SAC movwf xB+0 clrf xB+1 call mult16x16 ; xC:4=xA:2*xB:2 - movlw LOW(.600) + movlw LOW(.60) movwf xB+0 - movlw HIGH(.600) + movlw HIGH(.60) movwf xB+1 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder @@ -3400,10 +3390,10 @@ movff xC+0,xA+0 ; Get result (in xC+0, noy xC+2 !) into xA movff xC+1,xA+1 - movf avr_rel_pressure_total+0,W ; Add surface pressure to get absolute pressure + movf avr_rel_pressure+0,W ; Add surface pressure to get absolute pressure addwf last_surfpressure_30min+0,W movwf xB+0 - movf avr_rel_pressure_total+1,W + movf avr_rel_pressure+1,W addwfc last_surfpressure_30min+1,W movwf xB+1 ; --> Into xB diff -r 8f4882639326 -r a863fd56189c code_part1/OSTC_code_c_part2/p2_deco.c --- a/code_part1/OSTC_code_c_part2/p2_deco.c Tue Oct 11 21:17:05 2011 +0200 +++ b/code_part1/OSTC_code_c_part2/p2_deco.c Thu Oct 13 08:20:58 2011 +0200 @@ -2508,14 +2508,14 @@ // char_I_first_gas is the bottom gas. // decoplan (char_O_deco_depth, char_O_deco_time). // CF#54 == TRUE if shallowest stop first. -// CF#56 == bottom deci-liters/minutes (0.5 .. 50.0) or bar/min. -// CF#57 == deco deci-liters/minutes (0.5 .. 50.0) or bar/min. +// CF#56 == bottom liters/minutes (5 .. 50) or bar/min. +// CF#57 == deco liters/minutes (5 .. 50) or bar/min. // Output: int_O_gas_volumes[0..4] in litters * 0.1 // void deco_gas_volumes(void) { overlay float volumes[NUM_GAS]; - overlay float bottom_usage, ascent_usage; + overlay float bottom_usage, deco_usage; overlay unsigned char i, deepest_first; overlay unsigned char gas; RESET_C_STACK @@ -2527,7 +2527,7 @@ assert(1 <= char_I_first_gas && char_I_first_gas <= NUM_GAS); gas = char_I_first_gas - 1; - bottom_usage = read_custom_function(56) * 0.1; + bottom_usage = (float) read_custom_function(56); if( bottom_usage > 0.0 ) volumes[gas] = (char_I_bottom_depth*0.1 + 1.0) // Use Psurface = 1.0 bar. @@ -2539,18 +2539,18 @@ //---- Ascent usage ------------------------------------------------------ deepest_first = read_custom_function(54) == 0; - ascent_usage = read_custom_function(57) * 0.1; // In liter/minutes. + deco_usage = (float) read_custom_function(57); // In liter/minutes. // Usage up to the first stop: // - computed at MAX depth (easier, safer), // - with an ascent speed of 10m/min. // - with ascent litter / minutes. // - still using bottom gas: - if( ascent_usage > 0.0 ) + if( deco_usage > 0.0 ) volumes[gas] += (char_I_bottom_depth*0.1 + 1.0) // Depth -> bar * (char_I_bottom_depth - char_O_first_deco_depth) * 0.1 // ascent time (min) - * ascent_usage; // Consumption ( xxx / min @ 1 bar) + * deco_usage; // Consumption ( xxx / min @ 1 bar) else volumes[gas] = 65535.0; @@ -2589,14 +2589,14 @@ // usage during stop: // Note: because first gas is not in there, increment gas+1 - if( ascent_usage > 0.0 ) + if( deco_usage > 0.0 ) volumes[gas] += (depth*0.1 + 1.0) // depth --> bar. * time // in minutes. - * ascent_usage // in xxx / min @ 1bar. + * deco_usage // in xxx / min @ 1bar. // Plus usage during ascent to the next stop, at 10m/min. + (depth*0.1 + 1.0) * ascent*0.1 // metre --> min - * ascent_usage; + * deco_usage; else volumes[gas] = 65535.0; } diff -r 8f4882639326 -r a863fd56189c code_part1/OSTC_code_c_part2/p2_deco.o Binary file code_part1/OSTC_code_c_part2/p2_deco.o has changed