changeset 310:453a3d13570f new_screen_layout

VSIbar #2: ascend bar + max-depth title alignment. Debug: bar-frame, zero-line, sim+- 0.1m
author janos_kovacs <kovjanos@gmail.com>
date Mon, 08 Jun 2015 01:36:05 +0200
parents efb53af0d62a
children 226e1405b86c
files src/divemode.asm src/divemode.inc src/hwos.inc src/text_english.inc src/text_french.inc src/text_german.inc src/text_italian.inc src/tft_outputs.asm
diffstat 8 files changed, 263 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/divemode.asm	Sun Jun 07 22:07:55 2015 +0200
+++ b/src/divemode.asm	Mon Jun 08 01:36:05 2015 +0200
@@ -995,7 +995,7 @@
 
 divemode_option3:			; minus 1m
 	banksel	isr_backup
-	movlw	d'100'
+	movlw	d'10'
 	subwf	sim_pressure+0
 	movlw	.0
 	subwfb	sim_pressure+1
@@ -1005,7 +1005,7 @@
 
 divemode_option2:			; plus 1m
 	banksel	isr_backup
-	movlw	d'100'
+	movlw	d'10'
 	addwf	sim_pressure+0
 	movlw	.0
 	addwfc	sim_pressure+1
--- a/src/divemode.inc	Sun Jun 07 22:07:55 2015 +0200
+++ b/src/divemode.inc	Mon Jun 08 01:36:05 2015 +0200
@@ -29,7 +29,7 @@
 #DEFINE    dm_mask_depth_row         .0
 #DEFINE    dm_mask_depth_column      .12
 #DEFINE    dm_mask_maxdepth_row      .0
-#DEFINE    dm_mask_maxdepth_column   .62
+#DEFINE    dm_mask_maxdepth_column   .73
 #DEFINE    dm_mask_divetime_row      .0
 #DEFINE    dm_mask_divetime_column   .122
 
@@ -54,10 +54,11 @@
 #DEFINE    dm_velocity_text_bot        dm_velocity_text_row+.23     ; 99
 #DEFINE    dm_velocity_text_rgt        dm_depth_rgt                 ; 61
 ; Ascend/Descend bar
-#DEFINE    dm_velobar_top          dm_offset           ; 14
+#DEFINE    dm_velobar_top          dm_offset           ; 14  !! _top+60 must fit into sub_a+0 !!
 #DEFINE    dm_velobar_lft          dm_depth_rgt+.1     ; 62
 #DEFINE    dm_velobar_bot          dm_offset+.85       ; 99
 #DEFINE    dm_velobar_rgt          .73                 ; 73
+#DEFINE    dm_velobar_width        .12
 
 ;******* Upper content / content row / 2nd col *******
 #DEFINE    dm_upcnt_2ndcol            .74                       ; 74
--- a/src/hwos.inc	Sun Jun 07 22:07:55 2015 +0200
+++ b/src/hwos.inc	Mon Jun 08 01:36:05 2015 +0200
@@ -688,6 +688,8 @@
 
 flag13                  res 1
 #DEFINE neg_flag_save           flag13,0    ; neg_flag backup for velocity logic
+#DEFINE velocity_warn           flag13,1    ; flag set when ascend is in warning rate
+#DEFINE velocity_attn           flag13,2    ; flag set when ascend is in attention rate
 
 ;=============================================================================
 ; C-code Routines
--- a/src/text_english.inc	Sun Jun 07 22:07:55 2015 +0200
+++ b/src/text_english.inc	Mon Jun 08 01:36:05 2015 +0200
@@ -208,7 +208,7 @@
     TCODE   tSelectNx,   "Nx"               ; Nx
     TCODE   tSelectTx,   "Tx"               ; Tx
     TCODE   tDepth,      "Depth"            ; Depth
-    TCODE   tMaxDepth,   "Max. Depth"       ; Max. Depth
+    TCODE   tMaxDepth,   "Max. Depth"       ; Max. Depth - max 10chars!
     TCODE   tDivetime,   "Divetime"         ; Divetime
     TCODE   tDiveHudMask1,  "Sensor 1"
     TCODE   tDiveHudMask2,  "Sensor 2"
--- a/src/text_french.inc	Sun Jun 07 22:07:55 2015 +0200
+++ b/src/text_french.inc	Mon Jun 08 01:36:05 2015 +0200
@@ -208,7 +208,7 @@
     TCODE   tSelectNx,   "Nx"               ; Nx
     TCODE   tSelectTx,   "Tx"               ; Tx
     TCODE   tDepth,      "Prof."            ; Depth
-    TCODE   tMaxDepth,   "Prof. Max."       ; Max. Depth
+    TCODE   tMaxDepth,   "Prof. Max."       ; Max. Depth - max 10chars!
     TCODE   tDivetime,   "Durée T."         ; Divetime
     TCODE   tDiveHudMask1,   "cell. 1"
     TCODE   tDiveHudMask2,   "cell. 2"
--- a/src/text_german.inc	Sun Jun 07 22:07:55 2015 +0200
+++ b/src/text_german.inc	Mon Jun 08 01:36:05 2015 +0200
@@ -207,7 +207,7 @@
     TCODE   tSelectNx,   "Nx"               ; Nx
     TCODE   tSelectTx,   "Tx"               ; Tx
     TCODE   tDepth,      "Tiefe"            ; Depth
-    TCODE   tMaxDepth,   "Max. Tiefe"       ; Max. Depth
+    TCODE   tMaxDepth,   "Max. Tiefe"       ; Max. Depth - max 10chars!
     TCODE   tDivetime,   "    Zeit"         ; Divetime
     TCODE   tDiveHudMask1,  "Sensor 1"
     TCODE   tDiveHudMask2,  "Sensor 2"
--- a/src/text_italian.inc	Sun Jun 07 22:07:55 2015 +0200
+++ b/src/text_italian.inc	Mon Jun 08 01:36:05 2015 +0200
@@ -208,7 +208,7 @@
     TCODE   tSelectNx,   "Nx"               ; Nx
     TCODE   tSelectTx,   "Tx"               ; Tx
     TCODE   tDepth,      "Prof."            ; Depth
-    TCODE   tMaxDepth,   "Prof. Max"        ; Max. Depth
+    TCODE   tMaxDepth,   "Prof. Max"        ; Max. Depth - max 10chars!
     TCODE   tDivetime,   "Divetime"         ; Divetime
     TCODE   tDiveHudMask1,  "Sensor 1"
     TCODE   tDiveHudMask2,  "Sensor 2"
--- a/src/tft_outputs.asm	Sun Jun 07 22:07:55 2015 +0200
+++ b/src/tft_outputs.asm	Mon Jun 08 01:36:05 2015 +0200
@@ -538,6 +538,10 @@
     endif
 
     ; DEBUG !!!
+    movlw       color_dark_red
+    call        TFT_set_color
+    WIN_FRAME_COLOR16 dm_velobar_top, dm_velobar_bot, dm_velobar_lft, dm_velobar_rgt ;top, bottom, left, right
+
     movlw       color_blue
     WIN_BOX_COLOR dm_velobar_top+.60, dm_velobar_top+.63, dm_velobar_lft+.1, dm_velobar_rgt-.1 ;top, bottom, left, right
 
@@ -553,7 +557,11 @@
 
 	global	TFT_display_velocity
 TFT_display_velocity:						; With divA+0 = m/min
-
+    ; init flags used to store warning/attention
+    bcf     velocity_warn
+    bcf     velocity_attn
+
+    ; check if old/new ascend logic is used
     TSTOSS  opt_vsitextv2       			; 0=standard, 1=dynamic
     bra     TFT_dispay_velocity_std
 
@@ -561,10 +569,11 @@
     ;   neg_flag: ascend=1, descend=0
     ;   divA+0:   rate in m/min
 
-	movlw	velocity_display_threshold_2	; lowest threshold for display vertical velocity
+    ; check if velocity is below the treshold level
+	movlw	velocity_display_threshold_2
 	subwf	divA+0,W
 	btfss	STATUS,C
-	bra		TFT_display_velocity_clear
+	bra		TFT_display_velocity_ntr
 	bsf		display_velocity
 
     ; use a depth-dependent ascent rate warning
@@ -579,11 +588,12 @@
     ; w-offset         1   2   5   0   6  11    5   16   14   12   10
     ; a-offset         0   0   2   6   6   0    6    4    2    0    0
 
+    ; retain the neg_flag (descending information)
     bcf     neg_flag_save
     btfsc   neg_flag
     bsf     neg_flag_save
 
-    ; no warning color if descending
+    ; check if descending: no warning color if descending
     call	TFT_standard_color
 	btfss	neg_flag                            ; Ignore for descent!
 	bra		TFT_display_velocity_out
@@ -608,6 +618,15 @@
 	movwf	xA+0
     movlw   .15                     ; store the attn limit to xA+1
     movwf   xA+1
+    ; graphical position helpers
+    movlw   .2
+    movwf   xC+0
+    movlw   .2
+    movwf   xC+1
+    movlw   .10
+    movwf   xC+2
+    movlw   .0
+    movwf   xC+3
 	; 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?
@@ -622,6 +641,15 @@
 	movwf	xA+0
     movlw   .15                     ; store the attn limit to xA+1
     movwf   xA+1
+    ; graphical position helpers
+    movlw   .2
+    movwf   xC+0
+    movlw   .2
+    movwf   xC+1
+    movlw   .12
+    movwf   xC+2
+    movlw   .0
+    movwf   xC+3
 	; 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?
@@ -636,6 +664,15 @@
 	movwf	xA+0
     movlw   .14                     ; store the attn limit to xA+1
     movwf   xA+1
+    ; graphical position helpers
+    movlw   .2
+    movwf   xC+0
+    movlw   .2
+    movwf   xC+1
+    movlw   .14
+    movwf   xC+2
+    movlw   .2
+    movwf   xC+3
 	; 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?
@@ -650,6 +687,15 @@
 	movwf	xA+0
     movlw   .13                     ; store the attn limit to xA+1
     movwf   xA+1
+    ; graphical position helpers
+    movlw   .2
+    movwf   xC+0
+    movlw   .2
+    movwf   xC+1
+    movlw   .16
+    movwf   xC+2
+    movlw   .4
+    movwf   xC+3
 	; 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?
@@ -664,6 +710,15 @@
 	movwf	xA+0
     movlw   .12                     ; store the attn limit to xA+1
     movwf   xA+1
+    ; graphical position helpers
+    movlw   .3
+    movwf   xC+0
+    movlw   .2
+    movwf   xC+1
+    movlw   .5
+    movwf   xC+2
+    movlw   .6
+    movwf   xC+3
 	; 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?
@@ -678,6 +733,15 @@
 	movwf	xA+0
     movlw   .10                     ; store the attn limit to xA+1
     movwf   xA+1
+    ; graphical position helpers
+    movlw   .3
+    movwf   xC+0
+    movlw   .3
+    movwf   xC+1
+    movlw   .11
+    movwf   xC+2
+    movlw   .0
+    movwf   xC+3
 	; 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?
@@ -692,6 +756,15 @@
 	movwf	xA+0
     movlw   .8                     ; store the attn limit to xA+1
     movwf   xA+1
+    ; graphical position helpers
+    movlw   .4
+    movwf   xC+0
+    movlw   .3
+    movwf   xC+1
+    movlw   .6
+    movwf   xC+2
+    movlw   .6
+    movwf   xC+3
 	; 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?
@@ -706,6 +779,15 @@
 	movwf	xA+0
     movlw   .8                     ; store the attn limit to xA+1
     movwf   xA+1
+    ; graphical position helpers
+    movlw   .5
+    movwf   xC+0
+    movlw   .3
+    movwf   xC+1
+    movlw   .0
+    movwf   xC+2
+    movlw   .6
+    movwf   xC+3
 	; 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?
@@ -720,6 +802,15 @@
 	movwf	xA+0
     movlw   .7                     ; store the attn limit to xA+1
     movwf   xA+1
+    ; graphical position helpers
+    movlw   .5
+    movwf   xC+0
+    movlw   .4
+    movwf   xC+1
+    movlw   .5
+    movwf   xC+2
+    movlw   .2
+    movwf   xC+3
 	; 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?
@@ -734,6 +825,15 @@
 	movwf	xA+0
     movlw   .6                     ; store the attn limit to xA+1
     movwf   xA+1
+    ; graphical position helpers
+    movlw   .6
+    movwf   xC+0
+    movlw   .5
+    movwf   xC+1
+    movlw   .2
+    movwf   xC+2
+    movlw   .0
+    movwf   xC+3
 	; 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?
@@ -746,6 +846,15 @@
 	movwf	xA+0
     movlw   .5
     movwf   xA+1
+    ; graphical position helpers
+    movlw   .7
+    movwf   xC+0
+    movlw   .6
+    movwf   xC+1
+    movlw   .1
+    movwf   xC+2
+    movlw   .0
+    movwf   xC+3
     ;bra     TFT_velocity_check                  ;  depth < 20ft / 6m
 
 TFT_velocity_check:
@@ -774,10 +883,12 @@
 TFT_velocity_warn:
 	call	TFT_warnings_color             ; Set to warning color
     bsf     win_invert
+    bsf     velocity_warn
     bra     TFT_display_velocity_out
 
 TFT_velocity_attn:
 	call	TFT_attention_color            ; Set to attention color
+    bsf     velocity_attn
     ;bra     TFT_display_velocity_out
 
 TFT_display_velocity_out:
@@ -823,6 +934,7 @@
 	STRCAT_TEXT_PRINT  tVelImperial			; Unit switch
 	call	TFT_standard_color
     bcf     win_invert
+    call    TFT_display_VSIbar
     return
 
 TFT_display_velocity_metric:
@@ -835,6 +947,142 @@
 	STRCAT_TEXT_PRINT  tVelMetric			; Unit switch
 	call	TFT_standard_color
     bcf     win_invert
+    call    TFT_display_VSIbar
+    return
+
+TFT_display_VSIbar:
+    ; use another logic when descending
+    btfss   neg_flag
+    bra     TFT_dispay_VSIbar_desc
+    btfsc   velocity_warn
+    bra     TFT_display_VSIbar_warn
+    btfsc   velocity_attn
+    bra     TFT_display_VSIbar_attn
+    ; all ok, use attn's values
+    movff   xC+1,sub_b+0    ; multiplier
+    movff   xC+3,sub_b+1    ; offset
+    bra     TFT_display_VSIbar_com
+
+TFT_display_VSIbar_warn:
+    ; save multiplier and offset out from the xC
+    movff   xC+0,sub_b+0    ; multiplier
+    movff   xC+2,sub_b+1    ; offset
+    bra     TFT_display_VSIbar_com
+
+TFT_display_VSIbar_attn:
+    ; save multiplier and offset out from the xC
+    movff   xC+1,sub_b+0    ; multiplier
+    movff   xC+3,sub_b+1    ; offset
+    ;bra     TFT_display_VSIbar_com
+
+TFT_display_VSIbar_com:
+    ; multiply
+    movff   divA+0,xA+0
+    clrf    xA+1
+    movff   sub_b+0,xB+0
+    clrf    xB+1
+    call    mult16x16               ; xA*xB=xC
+    movlw   .1
+    cpfslt  xC+3
+    bra     TFT_display_VSIbar_max
+    cpfslt  xC+2
+    bra     TFT_display_VSIbar_max
+    cpfslt  xC+1
+    bra     TFT_display_VSIbar_max
+    ; add offset
+    movff   sub_b+1,WREG
+    addwf   xC+0,1
+    btfsc   STATUS,C
+    bra     TFT_display_VSIbar_max
+    ; check if out-of-range
+    movff   xC+0,divB
+    movlw   .60
+    cpfsgt  divB
+    bra     TFT_display_VSIbar_draw
+
+TFT_display_VSIbar_max:
+    movlw   .60
+    movff   WREG,divB
+
+TFT_display_VSIbar_draw:
+    ; calculate top&height for the bar and mask
+    ; 1. Bar:  top=(bar_top+60-divB); height=divB
+    movlw   dm_velobar_top+.1
+    movff   WREG,sub_a+0                        ; !!!!!!  bar position must fit into lo !!
+    movlw   .60
+    addwf   sub_a+0,1
+    clrf    sub_a+1
+    movff   divB,sub_b+0
+    clrf    sub_b+1
+    call    subU16
+   
+    movff   sub_c+0,win_top
+    movff   divB,win_height
+    movlw   dm_velobar_width
+    movff   WREG,win_width
+    movff   WREG,win_bargraph
+    movlw   dm_velobar_lft+.1
+    movff   WREG,win_leftx2
+    movlw   color_green
+    call    TFT_set_color
+    btfsc   velocity_attn
+    call    TFT_attention_color
+    btfsc   velocity_warn
+    call    TFT_warnings_color
+    call    TFT_box
+
+    ;clear the rest
+    movlw   .60
+    cpfslt  divB
+    return  ; divB !< 60 - the graph uses the full bar, no need to clear
+
+    ; 2. Mask: top=bar_top; height=60-divB
+    movlw   .60
+    movff   WREG,sub_a+0
+    clrf    sub_a+1
+    movff   divB,sub_b+0
+    clrf    sub_b+1
+    call    subU16              ; sub_c = sub_a - sub_b
+
+    movlw   dm_velobar_top+.1
+    movff   WREG,win_top
+    movff   sub_c+0,win_height
+    movlw   dm_velobar_width
+    movff   WREG,win_width
+    movff   WREG,win_bargraph
+    movlw   dm_velobar_lft+.1
+    movff   WREG,win_leftx2
+    movlw   color_black
+    call    TFT_set_color
+    call    TFT_box
+    return
+
+TFT_dispay_VSIbar_desc:
+    ; clear the ascend part of the bar
+    call    TFT_display_VSIbar_clr
+    ; TODO
+    return
+
+TFT_display_VSIbar_clr: ; clears the ascend part of hte bar
+    WIN_BOX_BLACK   dm_velobar_top+.1,dm_velobar_top+.59,dm_velobar_lft+.1,dm_velobar_rgt-.1
+    movlw       color_blue
+    WIN_BOX_COLOR dm_velobar_top+.60, dm_velobar_top+.63, dm_velobar_lft+.1, dm_velobar_rgt-.1 ;top, bottom, left, right
+    return
+
+TFT_display_velocity_ntr:   ; velocity under treshold
+    call    TFT_display_velocity_clear
+    ; use another logic when descending
+    btfss   neg_flag
+    bra     TFT_dispay_VSIbar_desc
+    movlw   .7
+    movwf   xC+0
+    movlw   .6
+    movwf   xC+1
+    movlw   .1
+    movwf   xC+2
+    movlw   .0
+    movwf   xC+3
+    call    TFT_display_VSIbar
     return
 
 	global	TFT_display_velocity_clear