changeset 335:d36fe3651d56 ScreenDump

Updated to 1.91beta Added screen dumps in cf menu, and in GasList (second page). --> Need a centralized subroutine when waitting switches...
author JeanDo
date Fri, 13 May 2011 02:09:06 +0200
parents 1828234369fc (diff) 4ccdc72ec0e5 (current diff)
children 9ee86a19f1fa
files code_part1/OSTC_code_asm_part1/definitions.asm code_part1/OSTC_code_asm_part1/divemode.asm code_part1/OSTC_code_asm_part1/divemode_menu.asm code_part1/OSTC_code_asm_part1/menu_custom.asm code_part1/OSTC_code_asm_part1/menu_gassetup.asm code_part1/OSTC_code_asm_part1/simulator.asm
diffstat 11 files changed, 227 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/MAIN.ASM	Thu May 12 13:59:13 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/MAIN.ASM	Fri May 13 02:09:06 2011 +0200
@@ -88,6 +88,7 @@
 #include	oled_samsung.asm	; Attached in 80-System 8-Bit Mode
 #include	aa_wordprocessor.asm ; New antialiased word processor and fonts
 #include    color_processor.asm ; Color image drawing.
+#include    dump_screen.asm     ; Copy screen contains to serial interface
 #include	valconv.asm			; outputs to POSTINC2
 #include	eeprom_rs232.asm	; Internal EEPROM and RS232 Interface
 #include	menu_custom.asm		; Menu "Custom FunctionsI" and "Custom FunctionsII"
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Thu May 12 13:59:13 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Fri May 13 02:09:06 2011 +0200
@@ -387,8 +387,8 @@
 #DEFINE win_flip_screen     win_flags,0 ; 180° rotation of the OLED screen.
 
 ; Flags
-#DEFINE	tts_extra_time		flag1,0	; unused
-#DEFINE	FLAG_2      		flag1,1	; unused
+#DEFINE	tts_extra_time		flag1,0	; Showing "Future TTS" customview
+#DEFINE	uart_dump_screen    flag1,1	; Screen copy to USB.
 #DEFINE	pre_zero_flag		flag1,2	; leading zeros
 #DEFINE neg_flag			flag1,3	; e.g. Sub_16 (sub_c = sub_a - sub_b)
 #DEFINE	FLAG_3      		flag1,4	; unused
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Thu May 12 13:59:13 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Fri May 13 02:09:06 2011 +0200
@@ -157,15 +157,21 @@
 	btfsc	toggle_customview				; Next view?
 	call	customview_toggle				; Yes, show next customview (and delete this flag)
 
-	btfsc	menubit							; Sleep only with inactive menu...
-	bra		diveloop_loop4
+	btfsc	simulatormode_active			; Is Simualtor mode active ?
+	bra		diveloop_loop4                  ; YES: don't sleep
 
-	btfsc	simulatormode_active			; Do not sleep in Simualtor mode
-	bra		diveloop_loop4
+	btfsc	menubit							; Sleep only with inactive menu...
+	bra		diveloop_loop5
 
 	sleep
 	nop
-diveloop_loop4:
+	bra		diveloop_loop					; Loop the divemode
+
+diveloop_loop4:                             ; And test screen dumps too!
+	btfsc	uart_dump_screen                ; Asked to dump screen contains ?
+	call	dump_screen     			    ; Yes!
+
+diveloop_loop5:
 	bra		diveloop_loop					; Loop the divemode
 
 timeout_premenu_divemode:
--- a/code_part1/OSTC_code_asm_part1/divemode_menu.asm	Thu May 12 13:59:13 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/divemode_menu.asm	Fri May 13 02:09:06 2011 +0200
@@ -108,6 +108,9 @@
 	btfss	switch_right
 	return
 
+	btfsc	uart_dump_screen                ; Asked to dump screen contains ?
+	call	dump_screen     			    ; Yes!
+
 	btfsc 	display_see_deco			; Is the Decoplan displayed?
 	bra		divemenu_see_decoplan2		; Yes, exit menu on left button press
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/code_part1/OSTC_code_asm_part1/dump_screen.asm	Fri May 13 02:09:06 2011 +0200
@@ -0,0 +1,174 @@
+;=============================================================================
+;
+;    File dump_screen.asm
+;
+;    Dump screen contains to the serial interface.
+;
+;    This program is free software: you can redistribute it and/or modify
+;    it under the terms of the GNU General Public License as published by
+;    the Free Software Foundation, either version 3 of the License, or
+;    (at your option) any later version.
+;
+;    This program is distributed in the hope that it will be useful,
+;    but WITHOUT ANY WARRANTY; without even the implied warranty of
+;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;    GNU General Public License for more details.
+;
+;    You should have received a copy of the GNU General Public License
+;    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+;
+;    Copyright (c) 2011, JD Gascuel.
+;=============================================================================
+; HISTORY
+;  2011-05-08 : [jDG] Creation.
+;
+; BUGS :
+;  * ...
+;=============================================================================
+    CBLOCK 0x000                        
+        	ds_line                 ; Current line (0..239).
+        	ds_column               ; Current columnx2 (0..159)
+        	ds_pixel:2              ; Current pixel color.
+        	ds_count                ; Repetition count.
+    ENDC
+;=============================================================================
+
+; Manage interface to the OSTC platform:
+dump_screen:
+	bcf		    uart_dump_screen        ; clear flag!
+
+	movlw	    'l'
+	movwf	    TXREG                   ; Send command echo.
+	bsf		    no_sensor_int           ; No Sensor Interrupt
+	bcf		    PIE1,RCIE               ; no interrupt for UART
+	bcf		    PIR1,RCIF               ; clear flag
+	bsf		    LED_blue                ; LEDusb ON
+	call		rs232_wait_tx           ; wait for UART
+
+    call        dump_screen_0
+
+	bcf		    no_sensor_int           ; Restore Sensor Interrupt
+	bcf			LED_blue                ; Clear led
+	bcf			LED_red                 ; Clear led
+	bsf			PIE1,RCIE               ; Interrupt for RS232
+	return
+
+;=============================================================================
+; Dump screen contains to the UART
+
+dump_screen_0:
+
+    ;---- Send OLED box command for the full screen window -------------------
+    mullw       0                       ; PRODH:L <- 0
+
+    AA_CMD_WRITE    0x35                ; VerticalStartAddress HIGH:LOW
+    AA_DATA_WRITE_PROD                  ; 00:00
+
+    AA_CMD_WRITE    0x36                ; VerticalEndAddress HIGH:LOW
+    AA_DATA_WRITE   0x01
+    AA_DATA_WRITE   0x3F
+
+    AA_CMD_WRITE    0x37                ; HorizontalAddress START:END
+    AA_DATA_WRITE   0x00
+    AA_DATA_WRITE   0xEF
+
+    AA_CMD_WRITE    0x20                ; Start Address Horizontal (.0 - .239)
+    AA_DATA_WRITE_PROD                  ; 00:00
+
+    AA_CMD_WRITE    0x21                ; Start Address Vertical (.0 - .319)
+    AA_DATA_WRITE_PROD                  ; 00:00
+
+    AA_CMD_WRITE    0x22                ; Start reading.
+    rcall       PLED_DataRead           ; Dummy pixel to skip.
+    rcall       PLED_DataRead           ; Dummy pixel to skip.
+
+   	movlw	    .160                    ; 160x2 columns
+	movwf	    ds_column
+    rcall       dump_screen_pixel_reset
+
+dump_screen_1:
+    btg         LED_red                 ; LEDactivity toggle
+
+    AA_CMD_WRITE    0x22                ; Re-sync data.
+
+    setf        TRISD                   ; PortD as input.
+
+    ; Dump even column
+	movlw	    .240                    ; 240 lines, once.
+	movwf	    ds_line
+dump_screen_2:
+    rcall       PLED_DataRead           ; read pixel-high byte
+    movwf       PRODH
+    rcall       PLED_DataRead           ; read pixel-low byte
+    movwf       PRODL
+    rcall       dump_screen_pixel
+
+    decfsz	    ds_line,F
+    bra		    dump_screen_2
+    rcall       dump_screen_pixel_flush
+
+    ; Dump odd column
+	movlw	    .240                    ; 240 lines, twice.
+	movwf	    ds_line
+dump_screen_3:
+    rcall       PLED_DataRead           ; read pixel-high byte
+    movwf       PRODH
+    rcall       PLED_DataRead           ; read pixel-low byte
+    movwf       PRODL
+    rcall       dump_screen_pixel
+
+    decfsz	    ds_line,F
+    bra		    dump_screen_3
+    rcall       dump_screen_pixel_flush
+
+    clrf        TRISD                   ; Back to normal (PortD as output)
+
+    decfsz	    ds_column,F
+    bra		    dump_screen_1
+
+    AA_CMD_WRITE    0x00        ; NOP, to stop Address Update Counter
+    return
+
+;=============================================================================
+; Pixel compression
+;
+; Input: PRODH:L = pixel.
+; Output: Compressed stream on output.
+;
+dump_screen_pixel:
+    movf        PRODH,W                 ; Compare pixel-high
+    xorwf       ds_pixel+1,W
+    bnz         dump_screen_pixel_1     ; Different -> dump.
+
+    movf        PRODL,W                 ; Compare pixel-low
+    xorwf       ds_pixel+0,W
+    bnz         dump_screen_pixel_1     ; Different -> dump.
+
+    incf        ds_count,F              ; Same color: just increment.
+    return
+
+dump_screen_pixel_1:                    ; Send (pixel,count) tuple
+    movf        ds_count,W              ; Is count zero ?
+    bz          dump_screen_pixel_2     ; Yes: skip sending.
+
+    movff       ds_pixel+1,TXREG
+	call		rs232_wait_tx           ; wait for UART
+    movff       ds_pixel+0,TXREG
+	call		rs232_wait_tx           ; wait for UART
+    movff       ds_count,TXREG
+	call		rs232_wait_tx           ; wait for UART
+
+dump_screen_pixel_2:
+    movff       PRODH,ds_pixel+1        ; Save new pixel color
+    movff       PRODL,ds_pixel+0
+    movlw       1
+    movwf       ds_count                ; And set count=1.
+    return
+
+dump_screen_pixel_flush:
+    clrf        PRODH
+    clrf        PRODL
+    rcall       dump_screen_pixel_1     ; Send it
+dump_screen_pixel_reset:
+    clrf        ds_count                ; But clear count.
+    return
\ No newline at end of file
--- a/code_part1/OSTC_code_asm_part1/isr.asm	Thu May 12 13:59:13 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/isr.asm	Fri May 13 02:09:06 2011 +0200
@@ -56,6 +56,8 @@
 		bsf		uart_send_int_eeprom2		; set flag
 		dcfsnz	uart1_temp,F				; "k"
 		bsf		uart_store_tissue_data		; set flag
+		dcfsnz	uart1_temp,F				; "l"
+		bsf		uart_dump_screen            ; set flag
 	
 		movlw	0xC1
 		cpfseq	RCREG						; 115200Baud Bootloader request?
--- a/code_part1/OSTC_code_asm_part1/menu_custom.asm	Thu May 12 13:59:13 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_custom.asm	Fri May 13 02:09:06 2011 +0200
@@ -299,6 +299,9 @@
 
 	bcf		onesecupdate			; end of 1sek. tasks
 
+	btfsc	uart_dump_screen            ; Dumps screen contains ?
+	call	dump_screen     			; Yes!
+
 	btfsc	sleepmode
 	bra	exit_customfunctions
 
--- a/code_part1/OSTC_code_asm_part1/menu_gassetup.asm	Thu May 12 13:59:13 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_gassetup.asm	Fri May 13 02:09:06 2011 +0200
@@ -780,6 +780,9 @@
 
 	bcf		onesecupdate	; 1 sec. functions done
 
+	btfsc	uart_dump_screen            ; Dumps screen contains ?
+	call	dump_screen     			; Yes!
+
 	btfsc	sleepmode
 	bra		exit_gassetup
 
--- a/code_part1/OSTC_code_asm_part1/oled_samsung.asm	Thu May 12 13:59:13 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/oled_samsung.asm	Fri May 13 02:09:06 2011 +0200
@@ -184,6 +184,15 @@
 ;		bsf		oled_rw
 		endm
 ;
+; Input	 : data as macro parameter.
+; Output : NONE
+; Trash  : WREG
+;
+AA_DATA_WRITE macro data
+        movlw   data
+        rcall   PLED_DataWrite
+        endm
+;
 ; Input	 : PRODH:L as 16bits data.
 ; Output : NONE
 ; Trash  : NONE
@@ -517,6 +526,18 @@
 	return
 
 ; -----------------------------
+; PLED Read data into WREG
+; -----------------------------
+; NOTE: you should "setf TRISD" before calling this function,
+;       to make PortD an input port...
+PLED_DataRead:
+	bsf		oled_rs					; Data register.
+	bcf		oled_e_nwr              ; Read enable.
+	movf	PORTD,W				    ; Read byte.
+	bsf		oled_e_nwr              ; release bus.
+	return
+
+; -----------------------------
 ; PLED boot
 ; -----------------------------
 PLED_boot:
--- a/code_part1/OSTC_code_asm_part1/simulator.asm	Thu May 12 13:59:13 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/simulator.asm	Fri May 13 02:09:06 2011 +0200
@@ -412,18 +412,18 @@
 	WAITMS	d'250'
 	WAITMS	d'250'                      ; Wait for Pressure Sensor to get real pressure again...
 
-	movlw	d'5'                            ; Pre-Set Cursor to "Show Decoplan"
+	movlw	d'5'                        ; Pre-Set Cursor to "Show Decoplan"
 	movwf	menupos
 	movff	char_I_bottom_time,logbook_temp1    ; Restore bottom time,
 	movff   char_I_bottom_depth,logbook_temp2   ; and depth.
 	bra     menu_simulator1                 ; Done.
 
 simulator_save_tissue_data:
-	bsf		restore_deco_data		; Set restore flag
-	ostc_debug	'S'							; Sends debug-information to screen if debugmode active
+	bsf		restore_deco_data           ; Set restore flag
+	ostc_debug	'S'                     ; Sends debug-information to screen if debugmode active
 	call	deco_push_tissues_to_vault
-	movlb	0x01							; Back to RAM Bank1
-	ostc_debug	'T'							; Sends debug-information to screen if debugmode active
+	movlb	0x01                        ; Back to RAM Bank1
+	ostc_debug	'T'                     ; Sends debug-information to screen if debugmode active
 	return
 
 simulator_restore_tissue_data:
--- a/code_part1/OSTC_code_asm_part1/surfmode.asm	Thu May 12 13:59:13 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/surfmode.asm	Fri May 13 02:09:06 2011 +0200
@@ -199,6 +199,8 @@
 	goto	uart_115k_bootloader		; Yes!
 	btfsc	uart_reset_battery_stats	; Reset Battery stats?
 	goto	reset_battery_stats			; Yes!
+	btfsc	uart_dump_screen            ; Dumps screen contains ?
+	call	dump_screen     			; Yes!
 
 	bra		surfloop_loop				; loop surfacemode