# HG changeset patch # User Janos Kovacs # Date 1433504233 -7200 # Node ID 7733eb0055a0c014250fde572a00f282474e564a # Parent 6d003c08bacd70c92e4737497c2a6ea9f7ae6eae# Parent 14719662fb957e748beeae0d3f5777c6e02ae011 VSI text v2 merged from new_screen_layout into default diff -r 6d003c08bacd -r 7733eb0055a0 src/comm.asm --- a/src/comm.asm Tue Jun 02 16:34:02 2015 +0200 +++ b/src/comm.asm Fri Jun 05 13:37:13 2015 +0200 @@ -956,7 +956,9 @@ dcfsnz WREG movff char_I_deco_usage, TXREG1 ; RCREG1=0x3D dcfsnz WREG - movff opt_depthblink, TXREG1 ; RCREG1=0x3E + movff opt_modwarning, TXREG1 ; RCREG1=0x3E + dcfsnz WREG + movff opt_vsitextv2, TXREG1 ; RCREG1=0x3F comm_read_abort: @@ -1239,7 +1241,9 @@ dcfsnz WREG movff RCREG1, char_I_deco_usage ; RCREG1=0x3D dcfsnz WREG - movff RCREG1, opt_depthblink ; RCREG1=0x3E + movff RCREG1, opt_modwarning ; RCREG1=0x3E + dcfsnz WREG + movff RCREG1, opt_vsitextv2 ; RCREG1=0x3F comm_write_abort: diff -r 6d003c08bacd -r 7733eb0055a0 src/divemode.asm --- a/src/divemode.asm Tue Jun 02 16:34:02 2015 +0200 +++ b/src/divemode.asm Fri Jun 05 13:37:13 2015 +0200 @@ -447,7 +447,7 @@ calc_velocity: ; called every two seconds btfss divemode - bra do_not_display_velocity ; display velocity only in divemode (Not at the surface after dive) + return ; display velocity only in divemode (Not at the surface after dive) calc_velocity2: SAFE_2BYTE_COPY amb_pressure, sub_a @@ -476,21 +476,9 @@ movwf divA+0 ; divA=99 calc_velocity3: - movlw velocity_warning_level_1 ; lowest threshold for display vertical velocity - subwf divA+0,W ; - btfss STATUS,C - bra do_not_display_velocity - - bsf display_velocity call TFT_display_velocity ; With divA+0 = m/min... return -do_not_display_velocity: - btfss display_velocity ; Velocity was not displayed, do not delete - return - bcf display_velocity ; Velocity was displayed, delete velocity now - call TFT_display_velocity_clear - return ;============================================================================= diff -r 6d003c08bacd -r 7733eb0055a0 src/hwos.inc --- a/src/hwos.inc Tue Jun 02 16:34:02 2015 +0200 +++ b/src/hwos.inc Fri Jun 05 13:37:13 2015 +0200 @@ -66,15 +66,14 @@ #DEFINE FT_MEDIUM .2 #DEFINE FT_LARGE .3 -#DEFINE warn_depth .1 -#DEFINE warn_cns .2 -#DEFINE warn_gf .3 -#DEFINE warn_ppo2 .4 -#DEFINE warn_velocity .5 -#DEFINE warn_ceiling .6 -#DEFINE warn_gas_in_gaslist .7 -#DEFINE warn_ppo2_hud .8 -#DEFINE warn_battery .9 +#DEFINE warn_depth .1 +#DEFINE warn_cns .2 +#DEFINE warn_gf .3 +#DEFINE warn_ppo2 .4 +#DEFINE warn_ceiling .5 +#DEFINE warn_gas_in_gaslist .6 +#DEFINE warn_ppo2_hud .7 +#DEFINE warn_battery .8 ; External O2 cell input parameters #DEFINE min_mv .80 ; = 8mV @@ -152,10 +151,11 @@ ; Color-code parameters for the divemode #DEFINE color_code_cns_high .100 ; [%] #DEFINE color_code_gf_warn_high .101 ; [%] -#DEFINE color_code_velocity_warn_high .10;[m/min] +#DEFINE color_code_velocity_warn_high .10 ;[m/min] ; Velocity threshold -#DEFINE velocity_warning_level_1 .7 ; [m/min] +#DEFINE velocity_display_threshold_1 .7 ; [m/min] +#DEFINE velocity_display_threshold_2 .5 ; [m/min] ; Battery thresholds #DEFINE lithium_36v_empty .2400 ; [mV] Saft 3,6V LS14500 AA - threshold for battery percent display @@ -569,7 +569,8 @@ opt_flip_screen res 1 ; =1: Flip the screen opt_cR_button_left res 1 ; Left button sensitivity (cR hardware) opt_cR_button_right res 1 ; Right button sensitivity (cR hardware) -opt_depthblink res 1 ; =1:do a red blinking warning, =0:default behaviour +opt_modwarning res 1 ; =1:do a red blinking warning, =0:default behaviour +opt_vsitextv2 res 1 ; =1:use the depth dependent ascend rate limits ;-----------------------------EEPROM DATA ------------------------------------ ; Automatic reset of all options when this is changed: @@ -685,6 +686,9 @@ #DEFINE blinking_depth_prev flag12,6 ; set by the TFT_depth. =1: prev display had warning color #DEFINE blinking_depth_toggle flag12,7 ; toggle to blink +flag13 res 1 +#DEFINE neg_flag_save flag13,0 ; neg_flag backup for velocity logic + ;============================================================================= ; C-code Routines ; PART 2 diff -r 6d003c08bacd -r 7733eb0055a0 src/menu_tree.asm --- a/src/menu_tree.asm Tue Jun 02 16:34:02 2015 +0200 +++ b/src/menu_tree.asm Fri Jun 05 13:37:13 2015 +0200 @@ -614,11 +614,12 @@ call menu_processor_pop do_dispsets_menu: - MENU_BEGIN tDispSets, .5 + MENU_BEGIN tDispSets, .6 MENU_OPTION tBright, oBrightness, 0 MENU_CALL tColorScheme, do_color_scheme MENU_OPTION tFlip, oFlipScreen, 0 - MENU_OPTION tMODwarning, oDepthBlink, 0 + MENU_OPTION tMODwarning, oMODwarning, 0 + MENU_OPTION tVSItextv2, oVSItextv2, 0 MENU_CALL tExit, do_return_settings MENU_END diff -r 6d003c08bacd -r 7733eb0055a0 src/option_table.asm --- a/src/option_table.asm Tue Jun 02 16:34:02 2015 +0200 +++ b/src/option_table.asm Fri Jun 05 13:37:13 2015 +0200 @@ -199,7 +199,8 @@ OPTION_UINT8p10 ocR_button_right,.20, .100, .40, tPercent, .153, opt_cR_button_right ; right button sensitivity OPTION_UINT8 obottom_usage, .5,.50, .20,tLitersMinute, .154, char_I_bottom_usage ; l/min OPTION_UINT8 odeco_usage, .5,.50, .20,tLitersMinute, .155, char_I_deco_usage ; l/min - OPTION_BOOL oDepthBlink, 0, .156, opt_depthblink ; =1: red depth blinking warning + OPTION_BOOL oMODwarning, 0, .156, opt_modwarning ; =1: red depth blinking warning + OPTION_BOOL oVSItextv2, 0, .157, opt_vsitextv2 ; =1: use the dynamic ascend rate limits ;============================================================================= ; Set Time/Set Date (RAM only) diff -r 6d003c08bacd -r 7733eb0055a0 src/text_english.inc --- a/src/text_english.inc Tue Jun 02 16:34:02 2015 +0200 +++ b/src/text_english.inc Fri Jun 05 13:37:13 2015 +0200 @@ -136,6 +136,7 @@ TCODE tDvSalinity,"Salinity:" ; Salinity TCODE tFlip, "Rotate Screen:" ; Rotate Screen TCODE tMODwarning,"MOD warning:" ; MOD warning + TCODE tVSItextv2, "Dyn asc rate lim:" ; Dyn asc rate lim ; Setup Menu TCODE tSystSets, "Settings" diff -r 6d003c08bacd -r 7733eb0055a0 src/text_french.inc --- a/src/text_french.inc Tue Jun 02 16:34:02 2015 +0200 +++ b/src/text_french.inc Fri Jun 05 13:37:13 2015 +0200 @@ -136,6 +136,7 @@ TCODE tDvSalinity,"Salinité:" ; Salinity TCODE tFlip, "Pivoter l'écran:" ; Rotate Screen TCODE tMODwarning,"MOD warning:" ; MOD warning + TCODE tVSItextv2, "Dyn asc rate lim:" ; Dyn asc rate lim ; Setup Menu TCODE tSystSets, "Réglages" diff -r 6d003c08bacd -r 7733eb0055a0 src/text_german.inc --- a/src/text_german.inc Tue Jun 02 16:34:02 2015 +0200 +++ b/src/text_german.inc Fri Jun 05 13:37:13 2015 +0200 @@ -136,6 +136,7 @@ TCODE tDvSalinity,"Salinität:" ; Salinity TCODE tFlip, "Anzeige drehen:" ; Rotate Screen TCODE tMODwarning,"MOD Warnung:" ; MOD warning + TCODE tVSItextv2, "Dyn asc rate lim:" ; Dyn asc rate lim ; Setup Menu TCODE tSystSets, "Konfiguration" diff -r 6d003c08bacd -r 7733eb0055a0 src/text_italian.inc --- a/src/text_italian.inc Tue Jun 02 16:34:02 2015 +0200 +++ b/src/text_italian.inc Fri Jun 05 13:37:13 2015 +0200 @@ -136,6 +136,7 @@ TCODE tDvSalinity,"Salinita':" ; Salinity TCODE tFlip, "Ruotare schermo:" ; Rotate Screen TCODE tMODwarning,"MOD warning:" ; MOD warning + TCODE tVSItextv2, "Dyn asc rate lim:" ; Dyn asc rate lim ; Setup Menu TCODE tSystSets, "Impostazioni" diff -r 6d003c08bacd -r 7733eb0055a0 src/tft_outputs.asm --- a/src/tft_outputs.asm Tue Jun 02 16:34:02 2015 +0200 +++ b/src/tft_outputs.asm Fri Jun 05 13:37:13 2015 +0200 @@ -156,8 +156,6 @@ dcfsnz WREG bra TFT_color_code_ppo2 ; Color-code the OC ppO2 results [cbar], opt_ppO2_max as threshold dcfsnz WREG - bra TFT_color_code_velocity ; color_code_velocity_warn_high [m/min] - dcfsnz WREG bra TFT_color_code_ceiling ; Show warning if current depth>shown ceiling dcfsnz WREG bra TFT_color_code_gaslist ; Color-code current row in Gaslist (%O2 in hi), opt_ppO2_max as threshold @@ -240,7 +238,7 @@ movff hi_temp,hi movff lo_temp,lo ; Restore hi, lo - TSTOSS opt_depthblink ; 0=standard, 1=blink + TSTOSS opt_modwarning ; 0=standard, 1=blink bra TFT_color_code_depth_std ;TFT_color_code_depth_blink: call subU16 ; sub_c = sub_a - sub_b @@ -360,18 +358,6 @@ call TFT_standard_color return -TFT_color_code_velocity: - btfss neg_flag ; Ignore for descent! - bra TFT_color_code_velocity1 ; Skip check! - movff divA+0,lo - movlw color_code_velocity_warn_high ; Velocity warn [m/min] - subwf lo,W - btfsc STATUS,C - bra TFT_warnings_color ; Set to warning color -TFT_color_code_velocity1: - call TFT_standard_color - return - TFT_color_code_ppo2_hud: ; With ppO2 [cbar] in lo movff opt_ppO2_max,WREG ; PPO2 Max for MOD calculation and color coding in divemode cpfsgt lo ; lo > opt_ppO2_max? @@ -558,11 +544,257 @@ WIN_BOX_BLACK dm_customview_row, dm_customview_bot, dm_customview_column, dm_customview_rgt ; top, bottom, left, right return +;========================================================================= + global TFT_display_velocity TFT_display_velocity: ; With divA+0 = m/min - TFT_color_code warn_velocity ; Color-code Output (With divA+0 = m/min) - WIN_SMALL dm_velocity_text_column, dm_velocity_text_row - + + TSTOSS opt_vsitextv2 ; 0=standard, 1=dynamic + bra TFT_dispay_velocity_std + + ; Input is: + ; neg_flag: ascend=1, descend=0 + ; divA+0: rate in m/min + + movlw velocity_display_threshold_2 ; lowest threshold for display vertical velocity + subwf divA+0,W + btfss STATUS,C + bra TFT_display_velocity_clear + bsf display_velocity + + ; use a depth-dependent ascent rate warning + ; depth(ft): <20 >20 >40 >60 >75 >88 >101 >115 >128 >144 >164 + ; speed(ft/min): 23 26 29 33 36 43 49 56 59 62 66 + ; depth(m): <=6 >6 >12 >18 >23 >27 >31 >35 >39 >44 >50 + ; speed(m/min): 7 8 9 10 11 13 15 17 18 19 20 (warning) + ; speed(m/min): 5 6 7 8 8 10 12 13 14 15 15 (attention) + + bcf neg_flag_save + btfsc neg_flag + bsf neg_flag_save + + ; no warning color if descending + call TFT_standard_color + btfss neg_flag ; Ignore for descent! + bra TFT_display_velocity_out + + SAFE_2BYTE_COPY rel_pressure, lo ; get the actual depth + call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] + call convert_mbar_to_feet ; get depth in feet + ; xA will be used to store the warning/attention limits passed to the verification + clrf xA+0 + clrf xA+1 + + ; store current depth (in feet) into sub_a + movff lo,sub_a+0 + movff hi,sub_a+1 + +;TFT_display_velocity_asc_164: + ; store segment limit into sub_b + clrf sub_b+1 + movlw LOW d'164' + movwf sub_b+0 + movlw .20 ; store the warn limit to xA+0 + movwf xA+0 + movlw .15 ; store the attn limit to xA+1 + movwf xA+1 + ; check if current depth > segment limit + call subU16 ; sub_c = sub_a - sub_b; depth - sLimit + btfss neg_flag ; depth lower than segment limit? sLimit>depth? + bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment + +;TFT_display_velocity_asc_144: + ; store segment limit into sub_b + clrf sub_b+1 + movlw LOW d'144' + movwf sub_b+0 + movlw .19 ; store the warn limit to xA+0 + movwf xA+0 + movlw .15 ; store the attn limit to xA+1 + movwf xA+1 + ; check if current depth > segment limit + call subU16 ; sub_c = sub_a - sub_b; depth - sLimit + btfss neg_flag ; depth lower than segment limit? sLimit>depth? + bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment + +;TFT_display_velocity_asc_128: + ; store segment limit into sub_b + clrf sub_b+1 + movlw LOW d'128' + movwf sub_b+0 + movlw .18 ; store the warn limit to xA+0 + movwf xA+0 + movlw .14 ; store the attn limit to xA+1 + movwf xA+1 + ; check if current depth > segment limit + call subU16 ; sub_c = sub_a - sub_b; depth - sLimit + btfss neg_flag ; depth lower than segment limit? sLimit>depth? + bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment + +;TFT_display_velocity_asc_115: + ; store segment limit into sub_b + clrf sub_b+1 + movlw LOW d'115' + movwf sub_b+0 + movlw .17 ; store the warn limit to xA+0 + movwf xA+0 + movlw .13 ; store the attn limit to xA+1 + movwf xA+1 + ; check if current depth > segment limit + call subU16 ; sub_c = sub_a - sub_b; depth - sLimit + btfss neg_flag ; depth lower than segment limit? sLimit>depth? + bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment + +;TFT_display_velocity_asc_101: + ; store segment limit into sub_b + clrf sub_b+1 + movlw LOW d'101' + movwf sub_b+0 + movlw .15 ; store the warn limit to xA+0 + movwf xA+0 + movlw .12 ; store the attn limit to xA+1 + movwf xA+1 + ; check if current depth > segment limit + call subU16 ; sub_c = sub_a - sub_b; depth - sLimit + btfss neg_flag ; depth lower than segment limit? sLimit>depth? + bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment + +;TFT_display_velocity_asc_88: + ; store segment limit into sub_b + clrf sub_b+1 + movlw LOW d'88' + movwf sub_b+0 + movlw .13 ; store the warn limit to xA+0 + movwf xA+0 + movlw .10 ; store the attn limit to xA+1 + movwf xA+1 + ; check if current depth > segment limit + call subU16 ; sub_c = sub_a - sub_b; depth - sLimit + btfss neg_flag ; depth lower than segment limit? sLimit>depth? + bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment + +;TFT_display_velocity_asc_75: + ; store segment limit into sub_b + clrf sub_b+1 + movlw LOW d'75' + movwf sub_b+0 + movlw .11 ; store the warn limit to xA+0 + movwf xA+0 + movlw .8 ; store the attn limit to xA+1 + movwf xA+1 + ; check if current depth > segment limit + call subU16 ; sub_c = sub_a - sub_b; depth - sLimit + btfss neg_flag ; depth lower than segment limit? sLimit>depth? + bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment + +;TFT_display_velocity_asc_60: + ; store segment limit into sub_b + clrf sub_b+1 + movlw LOW d'60' + movwf sub_b+0 + movlw .10 ; store the warn limit to xA+0 + movwf xA+0 + movlw .8 ; store the attn limit to xA+1 + movwf xA+1 + ; check if current depth > segment limit + call subU16 ; sub_c = sub_a - sub_b; depth - sLimit + btfss neg_flag ; depth lower than segment limit? sLimit>depth? + bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment + +;TFT_display_velocity_asc_40: + ; store segment limit into sub_b + clrf sub_b+1 + movlw LOW d'40' + movwf sub_b+0 + movlw .9 ; store the warn limit to xA+0 + movwf xA+0 + movlw .7 ; store the attn limit to xA+1 + movwf xA+1 + ; check if current depth > segment limit + call subU16 ; sub_c = sub_a - sub_b; depth - sLimit + btfss neg_flag ; depth lower than segment limit? sLimit>depth? + bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment + +;TFT_display_velocity_asc_20: + ; store segment limit into sub_b + clrf sub_b+1 + movlw LOW d'20' + movwf sub_b+0 + movlw .8 ; store the warn limit to xA+0 + movwf xA+0 + movlw .6 ; store the attn limit to xA+1 + movwf xA+1 + ; check if current depth > segment limit + call subU16 ; sub_c = sub_a - sub_b; depth - sLimit + btfss neg_flag ; depth lower than segment limit? sLimit>depth? + bra TFT_velocity_check ; no, depth>=sLimit, do the check for this segment + +;TFT_display_velocity_asc_n6: + ; no more steps, check the smallest rate + ; store the warn limit to xA : <20ft=23; <6m=7 + movlw .7 + movwf xA+0 + movlw .5 + movwf xA+1 + ;bra TFT_velocity_check ; depth < 20ft / 6m + +TFT_velocity_check: + ; move current ascent rate to lo + clrf hi + movff divA+0,lo + ; Velocity warn [m/min] - we receive it from xA+0 + movff xA+0,WREG + ; compare the values + subwf lo,W ; subtract W from lo, + btfsc STATUS,C ; Check if C (carry flag) is set. Cleared if the larger number is subtracted from smaller one + bra TFT_velocity_warn ; Skip if no carry flag otherwise set to warning color + ; not eq or gt warning trashold, lets check if it reach the attention level + ; Velocity attn [m/min] - we receive it from xA+1 + movff xA+1,WREG + ; compare the values + subwf lo,W ; subtract W from lo, + btfsc STATUS,C ; Check if C (carry flag) is set. Cleared if the larger number is subtracted from smaller one + bra TFT_velocity_attn ; Skip if no carry flag otherwise set to warning color + ;bra TFT_velocity_def + +TFT_velocity_def: + call TFT_standard_color + bra TFT_display_velocity_out + +TFT_velocity_warn: + call TFT_warnings_color ; Set to warning color + bsf win_invert + bra TFT_display_velocity_out + +TFT_velocity_attn: + call TFT_attention_color ; Set to attention color + ;bra TFT_display_velocity_out + +TFT_display_velocity_out: + ; retain neg_flag value - restore + bcf neg_flag + btfsc neg_flag_save + bsf neg_flag + bra TFT_dispay_velocity_disp + +TFT_dispay_velocity_std: + movlw velocity_display_threshold_1 ; lowest threshold for display vertical velocity + subwf divA+0,W + btfss STATUS,C + bra TFT_display_velocity_clear + bsf display_velocity + + call TFT_standard_color + btfss neg_flag ; Ignore for descent! + bra TFT_dispay_velocity_disp ; Skip check! + movff divA+0,lo + movlw color_code_velocity_warn_high ; Velocity warn [m/min] + subwf lo,W + btfsc STATUS,C + call TFT_warnings_color ; Set to warning color + +TFT_dispay_velocity_disp: + WIN_SMALL dm_velocity_text_column, dm_velocity_text_row TSTOSS opt_units ; 0=Meters, 1=Feets bra TFT_display_velocity_metric ;TFT_display_velocity_imperial: @@ -580,6 +812,7 @@ bcf leftbind STRCAT_TEXT_PRINT tVelImperial ; Unit switch call TFT_standard_color + bcf win_invert return TFT_display_velocity_metric: @@ -591,14 +824,20 @@ output_99 STRCAT_TEXT_PRINT tVelMetric ; Unit switch call TFT_standard_color + bcf win_invert return global TFT_display_velocity_clear TFT_display_velocity_clear: + btfss display_velocity ; Velocity was not displayed, do not delete + return + bcf display_velocity ; Velocity was displayed, delete velocity now ; Clear Text WIN_BOX_BLACK dm_velocity_text_row, dm_velocity_text_bot, dm_velocity_text_column, dm_velocity_text_rgt ; top, bottom, left, right return +;========================================================================= + global TFT_clear_decoarea TFT_clear_decoarea: WIN_BOX_BLACK dm_decostop_1st_stop_row, .239, dm_decostop_1st_stop_column, .159 ; top, bottom, left, right @@ -2039,7 +2278,7 @@ return TFT_depth_blink: - TSTOSS opt_depthblink ; 0=standard, 1=blink + TSTOSS opt_modwarning ; 0=standard, 1=blink return ; check if previous cycle had the blinking warning or not