# HG changeset patch # User heinrichsweikamp # Date 1323114010 -3600 # Node ID b498245da3f1a402eb8e75e63d8eb5bac60952af # Parent cc09222a204f9b6484bffa263c36c8c7387edf56 imperial units patch from Vlad diff -r cc09222a204f -r b498245da3f1 code_part1/OSTC_code_asm_part1/definitions.asm --- a/code_part1/OSTC_code_asm_part1/definitions.asm Mon Dec 05 14:31:31 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/definitions.asm Mon Dec 05 20:40:10 2011 +0100 @@ -357,6 +357,7 @@ gaslist_active res 1 ; Holds flags for active gases desaturation_time_buffer res 2 ; buffer for desat time total_divetime_seconds res 2 ; counts dive seconds regardless of CF01 (18h max.) +temp11 res 1 ; used for unit conversion ;============================================================================= ; C-code Routines @@ -528,7 +529,7 @@ #DEFINE display_set_active flag13,2 ;=1: De/Activate gases underwater menu is visible #DEFINE deco_mode_changed flag13,3 ;=1: The Decomode was changes, show decomode description! #DEFINE pled_velocity_display flag13,4 ;=1: Velocity is displayed -#DEFINE depth_greater_100m flag13,5 ;=1: Depth is greater then 100m +#DEFINE depth_greater_100 flag13,5 ;=1: Depth is greater then 100 units #DEFINE display_set_setpoint flag13,6 ;=1: SetPoint list active #DEFINE toggle_customview flag13,7 ;=1: Next customview @@ -547,7 +548,7 @@ #DEFINE blinking_better_gas flag15,3 ;=1: Gas is currently blinking #DEFINE menu3_active flag15,4 ;=1: menu entry three in divemode menu is active #DEFINE no_deco_customviews flag15,5 ;=1: Selected mode is Apnoe or Gauge -#DEFINE maxdepth_greater_100m flag15,6 ;=1: Max Depth greater>100m +#DEFINE maxdepth_greater_100 flag15,6 ;=1: Max Depth greater>100 units #DEFINE show_cns_in_logbook flag15,7 ;=1: Show CNS value in logbook (>= V1.84) diff -r cc09222a204f -r b498245da3f1 code_part1/OSTC_code_asm_part1/divemode.asm --- a/code_part1/OSTC_code_asm_part1/divemode.asm Mon Dec 05 14:31:31 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/divemode.asm Mon Dec 05 20:40:10 2011 +0100 @@ -1744,7 +1744,7 @@ clrf average_depth_hold_total+1 clrf average_depth_hold_total+2 clrf average_depth_hold_total+3 ; Clear Non-Resettable Average - bcf depth_greater_100m ; clear flag + bcf depth_greater_100 ; clear flag setf last_diluent ; to be displayed after first calculation (range: 0 to 100 [%]) bcf dekostop_active bcf is_bailout ;=1: CC mode, but bailout active! diff -r cc09222a204f -r b498245da3f1 code_part1/OSTC_code_asm_part1/divemode_menu.asm --- a/code_part1/OSTC_code_asm_part1/divemode_menu.asm Mon Dec 05 14:31:31 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/divemode_menu.asm Mon Dec 05 20:40:10 2011 +0100 @@ -351,6 +351,20 @@ divemode_menu_simulator2: dcfsnz menupos,F bra timeout_divemenu2 ; close underwater menu! + GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units + btfss WREG,0 ; Enabled ? + bra divemode_menu_simulator3 ; NO + dcfsnz menupos,F + bra divemode_menu_simulator_p1ft ; Adjust +1ft + dcfsnz menupos,F + bra divemode_menu_simulator_m1ft ; Adjust -1ft + dcfsnz menupos,F + bra divemode_menu_simulator_p10ft ; Adjust +10ft + dcfsnz menupos,F + bra divemode_menu_simulator_m10ft ; Adjust -10ft + bra divemode_menu_simulator4 + +divemode_menu_simulator3: dcfsnz menupos,F bra divemode_menu_simulator_p1 ; Adjust +1m dcfsnz menupos,F @@ -359,6 +373,8 @@ bra divemode_menu_simulator_p10 ; Adjust +10m dcfsnz menupos,F bra divemode_menu_simulator_m10 ; Adjust -10m + +divemode_menu_simulator4: dcfsnz menupos,F bra divemode_menu_simulator_quit; Adjust to zero m bra timeout_divemenu2 ; quit underwater menu! @@ -413,6 +429,25 @@ movwf menupos ; reset cursor bra divemode_menu_simulator_common +divemode_menu_simulator_m10ft: + movlw LOW d'305' + subwf sim_pressure+0,F + movlw HIGH d'305' + subwfb sim_pressure+1,F + movlw d'5' + movwf menupos ; reset cursor + bra divemode_menu_simulator_common + +divemode_menu_simulator_p10ft: + movlw LOW d'305' + addwf sim_pressure+0,F + movlw HIGH d'305' + addwfc sim_pressure+1,F + + movlw d'4' + movwf menupos ; reset cursor + bra divemode_menu_simulator_common + divemode_menu_simulator_quit: movlw LOW d'1000' movwf sim_pressure+0 @@ -438,6 +473,24 @@ movwf menupos ; reset cursor bra divemode_menu_simulator_common +divemode_menu_simulator_p1ft: + movlw d'30' + addwf sim_pressure+0,F + movlw d'0' + addwfc sim_pressure+1,F + movlw d'2' + movwf menupos ; reset cursor + bra divemode_menu_simulator_common + +divemode_menu_simulator_m1ft: + movlw d'30' + subwf sim_pressure+0,F + movlw d'0' + subwfb sim_pressure+1,F + movlw d'3' + movwf menupos ; reset cursor + bra divemode_menu_simulator_common + divemenu_see_decoplan: bsf display_see_deco ; set flag call PLED_clear_divemode_menu ; Clear Menu diff -r cc09222a204f -r b498245da3f1 code_part1/OSTC_code_asm_part1/english_text.asm --- a/code_part1/OSTC_code_asm_part1/english_text.asm Mon Dec 05 14:31:31 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/english_text.asm Mon Dec 05 20:40:10 2011 +0100 @@ -68,7 +68,10 @@ #DEFINE TXT_METER5 "m " ; "m " #DEFINE TXT_METER3 "m " ; "m " #DEFINE TXT_METER2 "m " ; "m " -#DEFINE TXT_METER1 "m" ; "m" +#DEFINE TXT_METER1 "m" ; "m" +#DEFINE TXT_FOOT_C 'f' ; 'f' +#DEFINE TXT_FOOT4 "ft " ; "ft " +#DEFINE TXT_FOOT2 "ft" ; "ft" #DEFINE TXT_MBAR7 " mbar " ; " mbar " #DEFINE TXT_MBAR5 "mbar " ; "mbar " #DEFINE TXT_BAR4 "bar " ; "bar " @@ -314,7 +317,7 @@ TCODE .40, .35, "Graph. Velocity" ;182 Graph. Velocity (Show a graphical representation of the ascend speed) TCODE .40, .35, "not used " ;183 not used TCODE .40, .35, "not used " ;184 not used - TCODE .40, .35, "not used " ;185 not used + TCODE .40, .35, "Imperial units " ;185 Show depth in feet and temperature in Fahrenheit ; End of function descriptor II ; TCODE .13, .2, "Custom Functions II" ;186 Custom Functions II @@ -470,4 +473,11 @@ ; OLED Brightness settings TCODE .103, .155, "Eco " ;312 Eco (Same length as #313!) TCODE .103, .155, "High" ;313 High (Same length as #312!) +; Simulator menu with imperial units + TCODE .100, .25, "+ 1ft" ;314 +1ft + TCODE .100, .50, "- 1ft" ;315 -1ft + TCODE .100, .75, "+ 10ft" ;316 +10ft + TCODE .100, .100, "- 10ft" ;317 -10ft + + TCODE .0, .0, "ft/min" ;318 ft/min ;============================================================================= diff -r cc09222a204f -r b498245da3f1 code_part1/OSTC_code_asm_part1/menu_reset.asm --- a/code_part1/OSTC_code_asm_part1/menu_reset.asm Mon Dec 05 14:31:31 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu_reset.asm Mon Dec 05 20:40:10 2011 +0100 @@ -187,7 +187,7 @@ CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED - CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED + CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF63 Imperial units (feet,fahrenheit) CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED cf_default_table2: diff -r cc09222a204f -r b498245da3f1 code_part1/OSTC_code_asm_part1/pled_outputs.asm --- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm Mon Dec 05 14:31:31 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm Mon Dec 05 20:40:10 2011 +0100 @@ -463,19 +463,43 @@ ostc_debug 'y' ; Sends debug-information to screen if debugmode active WIN_TOP .80 - WIN_LEFT .94 WIN_FONT FT_MEDIUM WIN_INVERT .0 ; Init new Wordprocessor PLED_color_code warn_ceiling ; Color-code Output lfsr FSR2,letter movff char_O_first_deco_depth,lo ; Ceiling in m + GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units + btfss WREG,0 ; Enabled ? + bra PLED_display_deko3 ; NO + WIN_LEFT .80 + clrf hi + call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63 + output_16_3 + call word_processor + + WIN_TOP .91 + WIN_LEFT .115 + WIN_FONT FT_SMALL + lfsr FSR2,letter + STRCPY_PRINT TXT_FOOT2 ; Print 'ft' in small font + + WIN_TOP .80 + WIN_LEFT .130 + WIN_FONT FT_MEDIUM + lfsr FSR2,letter + bra PLED_display_deko4 + +PLED_display_deko3: + WIN_LEFT .94 output_99 PUTC TXT_METER_C - movff char_O_first_deco_time,lo ; length of first stop in m + +PLED_display_deko4: + movff char_O_first_deco_time,lo ; length of first stop in min output_99 STRCAT_PRINT "'" WIN_FONT FT_SMALL - + ;PLED_display_deko1: ostc_debug 'x' ; Sends debug-information to screen if debugmode active @@ -561,6 +585,17 @@ movff sim_btm_depth,lo bsf leftbind + GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units + btfss WREG,0 ; Enabled ? + bra PLED_simulator_data_3 ; NO + clrf hi + call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63 + output_16_3 + STRCAT_PRINT TXT_FOOT4 + bcf leftbind + return + +PLED_simulator_data_3: output_8 STRCAT_PRINT TXT_METER3 @@ -699,9 +734,21 @@ movlw '+' movwf POSTINC2 movff divA+0,lo + GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units + btfss WREG,0 ; Enabled ? + bra PLED_display_velocity2 ; NO + clrf hi + call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63 + output_16_3 + OUTPUTTEXTH d'318' ; ft/min + bra PLED_display_velocity3 + +PLED_display_velocity2: output_99 OUTPUTTEXT d'83' ; m/min - call word_processor + +PLED_display_velocity3: + call word_processor call PLED_standard_color bsf pled_velocity_display return @@ -715,7 +762,7 @@ WIN_BOX_BLACK .20, .90, .65, .75 ; Clear graphic display PLED_display_velocity_clear1: - movlw d'8' + movlw d'10' movwf temp1 WIN_TOP .90 WIN_LEFT .0 @@ -834,6 +881,17 @@ GETCUSTOM8 d'29' movwf lo bsf leftbind + GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units + btfss WREG,0 ; Enabled ? + bra PLED_show_cf11_cf12_cf29_3 ; NO + clrf hi + call convert_meters_to_feet2 + output_16 + STRCAT_PRINT TXT_FOOT2 + bcf leftbind + return + +PLED_show_cf11_cf12_cf29_3: output_8 STRCAT_PRINT TXT_METER1 @@ -997,6 +1055,7 @@ WIN_TOP .177 STRCPY "temp:" SAFE_2BYTE_COPY temperature, lo + call convert_celsius_to_fahrenheit call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required output_16 call word_processor @@ -1108,12 +1167,19 @@ movff last_temperature+1,hi movff last_temperature+0,lo lfsr FSR2,letter + call convert_celsius_to_fahrenheit call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required movlw d'3' movwf ignore_digits bsf leftbind ; left orientated output output_16dp d'2' bcf leftbind + GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units + btfss WREG,0 ; Enabled ? + bra PLED_show_C ; NO + STRCAT_PRINT "°F " + return +PLED_show_C: STRCAT_PRINT "°C " return @@ -1133,6 +1199,7 @@ movff last_temperature+0,lo lfsr FSR2,letter + call convert_celsius_to_fahrenheit call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required movlw d'3' movwf ignore_digits @@ -1696,15 +1763,16 @@ PLED_depth: ostc_debug 'r' ; Sends debug-information to screen if debugmode active SAFE_2BYTE_COPY rel_pressure, lo - call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] + call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] + call convert_meters_to_feet ; converts meters to feet movlw .039 cpfslt hi - bra depth_greater_99_84mtr - - btfsc depth_greater_100m ; Was depth>100m during last call + bra pled_depth_full_units_only + + btfsc depth_greater_100 ; Was depth>100 during last call call PLED_clear_depth ; Yes, clear depth area - bcf depth_greater_100m ; Do this once only... + bcf depth_greater_100 ; Do this once only... lfsr FSR2,letter @@ -1718,8 +1786,8 @@ movlw d'0' addwfc sub_b+1,F ; Add 1mbar offset call sub16 ; sub_c = sub_a - sub_b - btfss neg_flag ; Depth lower then 10m? - rcall depth_less_10mtr ; Yes, add extra space + btfss neg_flag ; Depth lower then 10? + rcall depth_less_10 ; Yes, add extra space WIN_TOP .24 WIN_LEFT .0 @@ -1734,7 +1802,7 @@ movff hi,sub_b+1 movff lo,sub_b+0 call sub16 ; sub_c = sub_a - sub_b - btfss neg_flag ; Depth lower then 1m? + btfss neg_flag ; Depth lower then 1? bra pled_depth2 ; Yes, display manual Zero bsf leftbind @@ -1750,6 +1818,10 @@ call word_processor bcf ignore_digit4 + GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units + btfsc WREG,0 ; Enabled ? + bra pled_depth6 ; YES, don't print any fractions + WIN_FONT FT_MEDIUM WIN_TOP .50 WIN_LEFT .40 @@ -1782,14 +1854,16 @@ pled_depth5: call word_processor ; decimeters in medium font bcf ignore_digit5 + +pled_depth6: WIN_FONT FT_SMALL return -depth_greater_99_84mtr: ; Display only in full meters - btfss depth_greater_100m ; Is depth>100m already? +pled_depth_full_units_only: ; Display only in full meters or feet + btfss depth_greater_100 ; Is depth>100 already? call PLED_clear_depth ; No, clear depth area and set flag ; Depth is already in hi:lo - ; Show depth in Full meters + ; Show depth in Full units ; That means ignore figure 4 and 5 lfsr FSR2,letter WIN_TOP .24 @@ -1807,13 +1881,13 @@ WIN_FONT FT_SMALL return -depth_less_10mtr: +depth_less_10: PUTC ' ' return PLED_clear_depth ; No, clear depth area and set flag WIN_BOX_BLACK .24, .90, .0, .90 ;top, bottom, left, right - bsf depth_greater_100m ; Set Flag + bsf depth_greater_100 ; Set Flag return PLED_desaturation_time: @@ -2177,10 +2251,15 @@ movff max_pressure+0,lo movff max_pressure+1,hi call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] + call convert_meters_to_feet ; converts meters to feet + + GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units + btfsc WREG,0 ; Enabled ? + bra PLED_maxdepth_full_units_only ; YES, don't print any feet fractions movlw .039 cpfslt hi - bra maxdepth_greater_99_84mtr + bra PLED_maxdepth_full_units_only ; Display normal "xx.y" lfsr FSR2,letter @@ -2198,11 +2277,11 @@ WIN_FONT FT_SMALL return -maxdepth_greater_99_84mtr: ; Display only in full meters - btfss maxdepth_greater_100m ; Is max.depth>100m already? +PLED_maxdepth_full_units_only: ; Display only in full units (meters or feet) + btfss maxdepth_greater_100 ; Is max.depth>100 already? call PLED_clear_maxdepth ; No, clear maxdepth area and set flag ; max Depth is already in hi:lo - ; Show max depth in Full meters + ; Show max depth in Full units ; That means ignore figure 4 and 5 lfsr FSR2,letter call PLED_standard_color @@ -2222,7 +2301,7 @@ PLED_clear_maxdepth: WIN_BOX_BLACK .184, .215, .0, .41 ;top, bottom, left, right - bsf maxdepth_greater_100m ; Set Flag + bsf maxdepth_greater_100 ; Set Flag return PLED_divemins: @@ -2376,7 +2455,6 @@ ostc_debug 'U' ; Sends debug-information to screen if debugmode active WIN_TOP .216 - WIN_LEFT .110 WIN_FONT FT_SMALL call PLED_standard_color @@ -2384,6 +2462,20 @@ movff avr_rel_pressure+0,lo movff avr_rel_pressure+1,hi call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] + GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units + btfss WREG,0 ; Enabled ? + bra PLED_stopwatch_show3 ; NO + WIN_LEFT .124 + call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63 + bsf ignore_digit4 ; do not display feet fractions + output_16 + bcf ignore_digit4 + bcf leftbind + STRCAT_PRINT TXT_FOOT2 + return + +PLED_stopwatch_show3: + WIN_LEFT .110 bsf ignore_digit5 ; do not display 1cm depth output_16dp d'3' bcf leftbind @@ -2425,14 +2517,33 @@ call word_processor ostc_debug 'U' ; Sends debug-information to screen if debugmode active - WIN_TOP .136 - WIN_LEFT .90 + WIN_TOP .137 WIN_FONT FT_MEDIUM call PLED_standard_color lfsr FSR2,letter movff avr_rel_pressure+0,lo movff avr_rel_pressure+1,hi call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] + GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units + btfss WREG,0 ; Enabled ? + bra PLED_stopwatch_show_gauge2 ; NO + WIN_LEFT .110 + call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63 + bsf ignore_digit4 ; do not display feet fractions + output_16 + bcf ignore_digit4 + bcf leftbind + call word_processor + + WIN_TOP .149 + WIN_LEFT .145 + WIN_FONT FT_SMALL + lfsr FSR2,letter + STRCPY_PRINT TXT_FOOT2 + return + +PLED_stopwatch_show_gauge2: + WIN_LEFT .90 bsf ignore_digit5 ; do not display 1cm depth output_16dp d'3' bcf leftbind @@ -2447,8 +2558,7 @@ DISPLAYTEXTH d'281' ; Avr.Depth PLED_total_average_show2: - WIN_TOP .192 - WIN_LEFT .110 + WIN_TOP .193 WIN_FONT FT_SMALL call PLED_standard_color @@ -2456,6 +2566,20 @@ movff avr_rel_pressure_total+0,lo movff avr_rel_pressure_total+1,hi call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] + GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units + btfss WREG,0 ; Enabled ? + bra PLED_total_average_show3 ; NO + WIN_LEFT .124 + call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63 + bsf ignore_digit4 ; do not display feet fractions + bcf leftbind + output_16 + bcf ignore_digit4 + STRCAT_PRINT TXT_FOOT2 + return + +PLED_total_average_show3: + WIN_LEFT .110 bsf ignore_digit5 ; do not display 1cm depth bcf leftbind output_16dp d'3' @@ -2572,6 +2696,17 @@ PLED_divemode_simulator_mask: call PLED_standard_color DISPLAYTEXT .254 ; Close + GETCUSTOM8 d'63' ; Check CF#63 Conversion to imperial units + btfss WREG,0 ; Enabled ? + bra PLED_divemode_simulator_mask2 ; NO + DISPLAYTEXTH .314 ; + 1ft + DISPLAYTEXTH .315 ; - 1ft + DISPLAYTEXTH .316 ; + 10ft + DISPLAYTEXTH .317 ; - 10ft + DISPLAYTEXTH .306 ; Quit Sim + return + +PLED_divemode_simulator_mask2: DISPLAYTEXT .250 ; + 1m DISPLAYTEXT .251 ; - 1m DISPLAYTEXT .252 ; +10m @@ -2591,7 +2726,7 @@ PLED_decoplan_show_stop: ;---- Print depth ---------------------------------------------------- WIN_LEFT .100 - + btfss lo,7 ; Bit set ? bra PLED_decoplan_std_stop ; No : Just an usual stop. @@ -2606,9 +2741,22 @@ PLED_decoplan_nstd_stop: lfsr FSR2,letter bsf leftbind + GETCUSTOM8 d'63' ; Check CF#63 + btfss WREG,0 ; Enabled ? + bra PLED_decoplan_nstd_stop2 ; NO + movff hi,temp11 ; save hi + clrf hi ; + call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63 + output_16_3 + STRCAT_PRINT " " + movff temp11,hi ; restore hi + bra PLED_decoplan_nstd_stop3 + +PLED_decoplan_nstd_stop2: output_8 ; outputs into Postinc2! STRCAT_PRINT TXT_METER2 +PLED_decoplan_nstd_stop3: ;---- Print duration ------------------------------------------------- WIN_LEFT .140 lfsr FSR2,letter @@ -2950,7 +3098,7 @@ return ; no, return PLED_clear_divemode_menu: - WIN_BOX_BLACK .0, .168, .85, .160 ;top, bottom, left, right + WIN_BOX_BLACK .0, .168, .82, .160 ;top, bottom, left, right return PLED_divemenu_cursor: @@ -3337,6 +3485,27 @@ lfsr FSR2,letter movff char_O_EAD,lo bsf leftbind + GETCUSTOM8 d'63' ; Check CF#63 + btfss WREG,0 ; Enabled ? + bra PLED_show_end_ead_divemode2 ; NO: return + clrf hi ; clear hi + call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63 + output_16 ; Print EAD w/o leading space. + bcf leftbind + STRCAT_PRINT TXT_FOOT2 + + WIN_TOP .216 + lfsr FSR2,letter + movff char_O_END,lo + clrf hi ; clear hi + call convert_meters_to_feet2 ; converts meters to feet, don't check CF#63 + bsf leftbind + output_16 ; Print END w/o leading space. + bcf leftbind + STRCAT_PRINT TXT_FOOT2 + bra PLED_show_end_ead_divemode3 + +PLED_show_end_ead_divemode2: output_8 ; Print EAD w/o leading space. STRCAT_PRINT TXT_METER2 @@ -3347,6 +3516,7 @@ bcf leftbind STRCAT_PRINT TXT_METER2 +PLED_show_end_ead_divemode3: ; Show ppO2[Flush] iff in CCR mode & not in Bailout: btfsc is_bailout ; In bailout mode? return ; Yes: done. @@ -3859,4 +4029,71 @@ movff xC+0,lo movff xC+1,hi ; restore lo and hi with updated value - return \ No newline at end of file + return + + +convert_meters_to_feet: ; convert value in lo:hi from meters to feet + + GETCUSTOM8 d'63' ; Check CF#63 + btfss WREG,0 ; Enabled ? + return ; NO: return + +convert_meters_to_feet2: + movff lo,xA+0 + movff hi,xA+1 + + movlw LOW d'328' ; 328feet/100m + movwf xB+0 + movlw HIGH d'328' + movwf xB+1 + + call mult16x16 ; xA*xB=xC (lo:hi * 328) + + movlw d'50' ; round up + addwf xC+0,F + movlw 0 + addwfc xC+1,F + addwfc xC+2,F + addwfc xC+3,F + + movlw d'100' + movwf xB+0 + clrf xB+1 + + call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder + + movff xC+0,lo + movff xC+1,hi ; restore lo and hi with updated value + + return + +convert_celsius_to_fahrenheit: ; convert value in lo:hi from celsius to fahrenheit + + GETCUSTOM8 d'63' ; Check CF#63 + btfss WREG,0 ; Enabled ? + return ; NO: return + + movff lo,xA+0 + movff hi,xA+1 + + movlw d'18' ; 1C = 1.8F + movwf xB+0 + clrf xB+1 + + call mult16x16 ;xA*xB=xC (lo:hi * 18) + + movlw d'10' + movwf xB+0 + clrf xB+1 + + call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder + + movlw LOW d'320' ; 0C = 32F + addwf xC+0,F + movlw HIGH d'320' + addwfc xC+1,F + + movff xC+0,lo + movff xC+1,hi ; restore lo and hi with updated value + + return