changeset 150:fc699a7460e6

Fix desat graph: + clean right part, to allow decreasing animation. + In divemode, show every 10 seconds.
author JeanDo
date Mon, 10 Jan 2011 02:57:59 +0100
parents 55a763d514ed
children c3ac603ba248
files code_part1/OSTC_code_asm_part1/customview.asm code_part1/OSTC_code_asm_part1/definitions.asm code_part1/OSTC_code_asm_part1/oled_samsung.asm code_part1/OSTC_code_asm_part1/pled_outputs.asm
diffstat 4 files changed, 92 insertions(+), 71 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/customview.asm	Sun Jan 09 17:25:51 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/customview.asm	Mon Jan 10 02:57:59 2011 +0100
@@ -90,6 +90,14 @@
 	return
 
 customview_1sec_graphs:                 ; Do nothing extra
+    decfsz  apnoe_mins                  ; 10 sec passed ?
+    return                              ; No: skip.
+    movlw   .10                         ; Yes: reset counter.
+    movwf   apnoe_mins
+
+	call	deco_calc_desaturation_time	; calculate desaturation time
+	movlb	b'00000001'						; select ram bank 1
+	call	PLED_tissue_saturation_graph
 	return
 
 ;=============================================================================
@@ -120,15 +128,10 @@
 	call	PLED_show_leading_tissue_2  ; Update the leading tissue
 	return
 
-customview_minute_graphs:
-	call	deco_calc_desaturation_time	; calculate desaturation time
-	movlb	b'00000001'						; select ram bank 1
-	call	PLED_tissue_saturation_graph
-	return
-
 customview_minute_marker:               ; Do nothing extra
 customview_minute_stopwatch:            ; Do nothing extra
 customview_minute_average:				; Do nothing extra
+customview_minute_graphs:
 	return
 
 ;=============================================================================
@@ -181,13 +184,13 @@
 	decfsz		WREG,F					; WREG=1?	
 	bra			customview_toggle		; No, use next Customview
 
-    call    PLED_standard_color
-	DISPLAYTEXT		d'151'				; Set Marker?
-	bra		customview_toggle_exit	
+    call        PLED_standard_color
+	DISPLAYTEXT d'151'				    ; Set Marker?
+	bra		    customview_toggle_exit	
 
 customview_init_clock:					; Init Clock
-	call	PLED_diveclock
-	bra		customview_toggle_exit	
+	call	    PLED_diveclock
+	bra		    customview_toggle_exit	
 
 customview_init_lead_tissue:			; Show leading tissue
 	GETCUSTOM8	d'53'					; Show Lead Tissue? (=1 in WREG)
@@ -197,8 +200,8 @@
 	btfsc		no_deco_customviews		; no-deco-mode-flag = 1
 	bra			customview_toggle		; Yes, use next Customview!
 
-	call	PLED_show_leading_tissue
-	bra		customview_toggle_exit	
+	call	    PLED_show_leading_tissue
+	bra		    customview_toggle_exit	
 
 customview_init_graphs:					; Show tissue graph
  	GETCUSTOM8	d'52'					; Show Tissue Graph? (=1 in WREG)
@@ -208,10 +211,15 @@
 	btfsc		no_deco_customviews		; no-deco-mode-flag = 1
 	bra			customview_toggle		; Yes, use next Customview!
 
-	call	deco_calc_desaturation_time	; calculate desaturation time
-	movlb	b'00000001'						; select ram bank 1
-	call    PLED_tissue_saturation_graph
-	bra     customview_toggle_exit	
+    movlw       .1                      ; Draw next second.
+    movwf       apnoe_mins              ; 10sec counter.   
+
+	call	    deco_calc_desaturation_time	; calculate desaturation time
+	movlb	    b'00000001'             ; select ram bank 1
+	call	    PLED_tissue_saturation_graph
+
+	bra         customview_toggle_exit
+
 customview_toggle_exit:
 	bcf		toggle_customview			; Clear flag
 	ostc_debug	'Y'		                ; Sends debug-information to screen in debugmode
@@ -322,7 +330,9 @@
 	return
 
 surfcustomview_minute_graphs:
-	call	PLED_tissue_saturation_graph		; Draw/Update the graphs
+	call	deco_calc_desaturation_time         ; calculate desaturation time
+	movlb	b'00000001'                         ; select ram bank 1
+	call	PLED_tissue_saturation_graph        ; Draw/Update the graphs
 	return
 
 surfcustomview_minute_interval:
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Sun Jan 09 17:25:51 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Mon Jan 10 02:57:59 2011 +0100
@@ -101,6 +101,7 @@
 	win_width 					; box width (1..160)
 	win_font
 	win_invert
+	win_bargraph                ; PLED_box swicth to black after this position (0..159).
 	win_flags                   ; flip_screen flag, transparent fonts, etc...
 	ENDC
 
--- a/code_part1/OSTC_code_asm_part1/oled_samsung.asm	Sun Jan 09 17:25:51 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/oled_samsung.asm	Mon Jan 10 02:57:59 2011 +0100
@@ -357,43 +357,60 @@
 	movff	win_width,WREG
 	bcf     STATUS,C
 	rlcf    WREG
-	movwf   aa_width
+	movwf   aa_width+0
 	movlw   0
 	rlcf    WREG
 	movwf   aa_width+1
 	rcall   PLED_box_write
 
     ;---- Fill Window --------------------------------------------------------
-	movlw	0x22					        ; Start Writing Data to GRAM
+	movlw	0x22                        ; Start Writing Data to GRAM
 	rcall	PLED_CmdWrite
 
-	movff	win_width,PRODH
-	bsf		oled_rs					        ; Data!
+	clrf	PRODH                       ; Column counter.
+	bsf		oled_rs                     ; Data!
 
-PLED_box2:                                  ; Loop height times
+PLED_box2:                              ; Loop height times
 	movff	win_height,PRODL
-PLED_box3:                                  ; loop width times
+    
+PLED_box3:                              ; loop width times
 	movff	win_color1,PORTD
 	bcf		oled_rw
-	bsf		oled_rw					        ; Upper
+	bsf		oled_rw                     ; Upper
 	movff	win_color2,PORTD
 	bcf		oled_rw
-	bsf		oled_rw					        ; Lower
+	bsf		oled_rw                     ; Lower
 
 	movff	win_color1,PORTD
 	bcf		oled_rw
-	bsf		oled_rw					        ; Upper
+	bsf		oled_rw                     ; Upper
 	movff	win_color2,PORTD
 	bcf		oled_rw
-	bsf		oled_rw					        ; Lower
+	bsf		oled_rw                     ; Lower
+
+	decfsz	PRODL,F                     ; row loop finished ?
+	bra		PLED_box3                   ; No: continue.
+
+    incf    PRODH,F                     ; column count ++
+
+    movff   win_bargraph,WREG           ; current column == bargraph ?
+    cpfseq  PRODH
+    bra     PLED_box4                   ; No: just loop.
 
-	decfsz	PRODL,F
-	bra		PLED_box3
-	decfsz	PRODH,F
-	bra		PLED_box2
+    clrf    WREG                        ; Yes: switch to black
+    movff   WREG,win_color1
+    movff   WREG,win_color2
+PLED_box4:
+    movff   win_width,WREG
+    cpfseq  PRODH
+    bra     PLED_box2
 
-	movlw	0x00					        ; NOP, to stop Address Update Counter
-	bra     PLED_CmdWrite                   ; returns...
+	movlw	0x00                        ; NOP, to stop window mode
+	rcall   PLED_CmdWrite
+	
+	setf    WREG                        ; Reset bargraph mode...
+	movff   WREG,win_bargraph
+	return
 
 ;=============================================================================
 ; PLED_ClearScreen: An optimized version of PLEX_box, for full screen black.
@@ -427,11 +444,11 @@
 	rcall	PLED_CmdWrite
 	rcall	PLED_DataWrite_PROD
 
-	movlw	0x22					; Start Writing Data to GRAM
+	movlw	0x22                ; Start Writing Data to GRAM
 	rcall	PLED_CmdWrite
 
 	; See Page 101 of OLED Driver IC Datasheet how to handle rs/rw clocks
-	bsf		oled_rs					; Data!
+	bsf		oled_rs             ; Data!
 
 	movlw	.160
 	movwf	PRODH
@@ -440,21 +457,21 @@
 	movwf	PRODL
 PLED_ClearScreen3:
 
-	clrf	PORTD					; Need to generate trace here too.
+	clrf	PORTD               ; Need to generate trace here too.
 	bcf		oled_rw
-	bsf		oled_rw					; Upper
+	bsf		oled_rw             ; Upper
 
-    clrf	PORTD					; Need to generate trace here too.
+    clrf	PORTD               ; Need to generate trace here too.
 	bcf		oled_rw
-	bsf		oled_rw					; Lower
+	bsf		oled_rw             ; Lower
 
-	clrf	PORTD					; Need to generate trace here too.
+	clrf	PORTD               ; Need to generate trace here too.
 	bcf		oled_rw
-	bsf		oled_rw					; Upper
+	bsf		oled_rw             ; Upper
 
-    clrf	PORTD					; Need to generate trace here too.
+    clrf	PORTD               ; Need to generate trace here too.
 	bcf		oled_rw
-	bsf		oled_rw					; Lower
+	bsf		oled_rw             ; Lower
 
 	decfsz	PRODL,F
 	bra		PLED_ClearScreen3
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Sun Jan 09 17:25:51 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Mon Jan 10 02:57:59 2011 +0100
@@ -2228,29 +2228,17 @@
         movff   WREG,win_height
         movlw	.122
         movff	WREG,win_leftx2    		; column left (0-159)
-        
-        ; Draw used area (lo = minutes):
+        movlw	.16
+        movff	WREG,win_width    		; column max width.
+
+        ; Draw used area (hi = minutes):
         call    PLED_standard_color
         movlw	d'16'                   ; Limit length (16min)
         cpfslt	hi
         movwf	hi
-        movff	hi,win_width			; Bar width
-        tstfsz  hi                      ; Skip 0-size bar...
+        movff	hi,win_bargraph         ; Active width, the rest is cleared.
         call	PLED_box
 
-        ; Clear unused area:
-        movlw	.0
-        movff   WREG,win_color1
-        movff   WREG,win_color2
-        movlw   .122                    ; (width+left-1)+1
-        addwf   hi,W
-        movff   WREG,win_leftx2         ; --> left
-        movf    hi,W
-        sublw   .16                     ; 16-left --> width
-        movff   WREG,win_width
-        tstfsz  WREG                    ; Skip 0-size bar.
-        call    PLED_box
-        
         ; Restore win_top
         movff   win_top,WREG            ; decf win_top (BANK SAFE)
         decf    WREG
@@ -2263,7 +2251,7 @@
 PLED_decoplan_clear_bottom:
         movff   win_top,WREG            ; Get back from bank0
         btfsc   divemode                ; In dive mode ?
-        sublw   .170                    ; Yes: bottom row in divemode
+        sublw   .168                    ; Yes: bottom row in divemode
         btfss   divemode                ; In dive mode ?
         sublw   .240                    ; No: bottom row in planning
         movff   WREG,win_height
@@ -2662,15 +2650,20 @@
 	movwf	wait_temp                   ; 16 tissues
 	clrf	waitms_temp                 ; Row offset
 
-    call    PLED_standard_color
 	movlw	.1
 	movff	WREG,win_height             ; row bottom (0-239)
 	movlw	.82+.18                     ; surfmode
     btfsc   divemode
     movlw   .90+.18                     ; divemode
 	movff	WREG,win_leftx2             ; column left (0-159)
+    movlw	.57                         ; surfmode: max width 57pix
+    btfsc   divemode
+	movlw	.57-8                       ; divemode: 8pix less...
+	movff   WREG,win_width
 
 PLED_tissue_saturation_graph3:
+    call    PLED_standard_color         ; Reset color foreach iteration
+
 	movlw	.25+3                       ; surfmode: 3pix below top border
     btfsc   divemode
     movlw   .169+3                      ; divemode
@@ -2687,12 +2680,10 @@
 	rrcf	WREG
 	movwf   temp1
 
-	movlw	.57                         ; surfmode: max 57pix
-    btfsc   divemode
-	movlw	.57-8                       ; divemode: 8pix less...s
+	movff   win_width,WREG              ; Max width.
 	cpfslt	temp1                       ; skip if 57 (WREG) < win_width
 	movwf	temp1
-	movff   temp1,win_width
+	movff   temp1,win_bargraph
 
 	call	PLED_box	
 
@@ -2706,6 +2697,7 @@
 	clrf	waitms_temp                 ; Row offset
 
 PLED_tissue_saturation_graph2:
+    call    PLED_standard_color         ; Reset color foreach iteration
 
 	movlw	.120-.33                    ; surfmode : 33pix above bottom border
     btfsc   divemode
@@ -2722,12 +2714,11 @@
 	bcf		STATUS,C
 	rrcf	WREG
 	movwf   temp1
-	movlw	.57                         ; surfmode: max 57pix
-    btfsc   divemode
-	movlw	.57-8                       ; divemode: 8pix less...s
+
+	movff   win_width,WREG              ; Max width.
 	cpfslt	temp1                       ; skip if 57 (WREG) < win_width
 	movwf	temp1
-	movff   temp1,win_width
+	movff   temp1,win_bargraph
 
 	call	PLED_box	
 
@@ -2735,6 +2726,8 @@
 	bra		PLED_tissue_saturation_graph2
 
     ;---- Draw N2/He Text ----------------------------------------------------
+    call    PLED_standard_color         ; Reset color after last iterarion.
+
 	movlw	.82+2                       ; surfmode: 2pix right of left border
     btfsc   divemode
     movlw   .90+2                       ; divemode