changeset 369:93c0cb14b0d2

Dive interval function * Adding interval menu
author JeanDo
date Fri, 10 Jun 2011 01:14:38 +0200
parents de3b267e1fd9
children 61742b3ef842 0e0cf4701c17
files code_part1/OSTC_code_asm_part1/definitions.asm code_part1/OSTC_code_asm_part1/english_text.asm code_part1/OSTC_code_asm_part1/french_text.asm code_part1/OSTC_code_asm_part1/german_text.asm code_part1/OSTC_code_asm_part1/pled_outputs.asm code_part1/OSTC_code_asm_part1/simulator.asm code_part1/OSTC_code_asm_part1/spanish_text.asm
diffstat 7 files changed, 136 insertions(+), 75 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Thu Jun 09 23:06:25 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Fri Jun 10 01:14:38 2011 +0200
@@ -344,6 +344,7 @@
     extern deco_calc_tissue
     extern deco_calc_percentage
     extern deco_calc_wo_deco_step_1_min
+    extern deco_calc_dive_interval
     extern deco_clear_CNS_fraction
     extern deco_clear_tissue
     extern deco_hash    
--- a/code_part1/OSTC_code_asm_part1/english_text.asm	Thu Jun 09 23:06:25 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/english_text.asm	Fri Jun 10 01:14:38 2011 +0200
@@ -323,7 +323,7 @@
     TCODE    .50,   .145,    "LowBatt!"                  ;246 LowBatt!
     TCODE    .20,   .125,    "Simulator"                 ;247 Simulator
     TCODE    .30,   .2,      "OSTC Simulator"            ;248 OSTC Simulator
-    TCODE    .20,   .35,     "Start Dive"                ;249 Start Dive
+    TCODE    .20,   .65,     "Start Dive"                ;249 Start Dive
     TCODE    .100,  .25,     "+ 1m"                      ;250 + 1m
     TCODE    .100,  .50,     "- 1m"                      ;251 - 1m
     TCODE    .100,  .75,     "+10m"                      ;252 +10m
@@ -356,10 +356,10 @@
     TCODE    .0,    .125,    "for Details!"              ;275 for Details!
     TCODE    .20,   .95,     "Salinity: "                ;276 Salinity:
 ;
-    TCODE    .20,   .65,     "Bottom Time:"              ;277 Bottom Time:
-    TCODE    .20,   .95,     "Max. Depth:"               ;278 Max. Depth:
-    TCODE    .20,   .125,    "Calculate Deco"            ;279 Calculate Deco
-    TCODE    .20,   .155,    "Show Decoplan"             ;280 Show Decoplan
+    TCODE    .20,   .95,     "Bottom Time:"              ;277 Bottom Time:
+    TCODE    .20,   .125,    "Max. Depth:"               ;278 Max. Depth:
+    TCODE    .20,   .155,    "Calculate Deco"            ;279 Calculate Deco
+    TCODE    .0,    .0,      ""                          ;280 UNUSED
 ;
     TCODE    .93,   .170,    "Avr.Depth"                 ;281 Avr.Depth
     TCODE    .90,   .170,    "Lead Tiss."                ;282 Lead Tiss.
@@ -383,7 +383,7 @@
     TCODE    .0,    .0,      "MOD:"                      ;297 MOD:                  (max operating depth of a gas).
     TCODE    .0,    .0,      "END:"                      ;298 END:                  (equivalent nitrogen depth of a gas).
     TCODE    .0,    .0,      "EAD:"                      ;299 EAD:                  (equivalent air depth of a gas).
-	TCODE	 .100,	.125,	 "Active?"					 ;300 Active?               (Enable/Disable Gas underwater)
+	TCODE    .100,  .125,	 "Active?"					 ;300 Active?               (Enable/Disable Gas underwater)
 	TCODE    .0,    .2,      "OCR Gas Usage:"            ;301 OCR Gas Usage:        (Planned gas consumtion by tank).
 ; 115k Bootloader support:
 	TCODE	 .45,	.100,	 "Bootloader"				 ;302 Bootloader
@@ -391,4 +391,7 @@
 	TCODE	 .50,	.130,	 "Aborted!"					 ;304 Aborted
 ;@5 variant
     TCODE    .0,    .0,      "Future TTS"                ;305 Future TTS            (=10 chars. Title for @5 customview).
+;Dive interval
+    TCODE    .20,   .35,     "Interval:"                 ;306 Interval:
+    TCODE    .0,    .0,      "Now"                       ;307 Now
 ;=============================================================================
--- a/code_part1/OSTC_code_asm_part1/french_text.asm	Thu Jun 09 23:06:25 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/french_text.asm	Fri Jun 10 01:14:38 2011 +0200
@@ -324,7 +324,7 @@
     TCODE    .50,   .145,    "BattFaible!"               ;246 LowBatt!
     TCODE    .20,   .125,    "Simulateur"                ;247 Simulator
     TCODE    .27,   .2,      "Simulateur OSTC"           ;248 OSTC Simulator
-    TCODE    .20,   .35,     "Mode Simulation..."        ;249 Start Dive
+    TCODE    .20,   .65,     "Début Simulation..."       ;249 Start Dive
     TCODE    .100,  .25,     "+ 1m"                      ;250 + 1m
     TCODE    .100,  .50,     "- 1m"                      ;251 - 1m
     TCODE    .100,  .75,     "+10m"                      ;252 +10m
@@ -357,10 +357,10 @@
     TCODE    .0,    .125,    "pour plus de détails!"     ;275 for Details!
     TCODE    .20,   .95,     "Salinité: "                ;276 Salinity:
 ;
-    TCODE    .20,   .65,     "Temps fond:"               ;277 Bottom Time:
-    TCODE    .20,   .95,     "Prof. Max.:"               ;278 Max. Depth:
-    TCODE    .20,   .125,    "Calculer la Déco"          ;279 Calculate Deco
-    TCODE    .20,   .155,    "Voir Plan de Déco"         ;280 Show Decoplan
+    TCODE    .20,   .95,     "Temps fond:"               ;277 Bottom Time:
+    TCODE    .20,   .125,    "Prof. Max.:"               ;278 Max. Depth:
+    TCODE    .20,   .155,    "Calculer la Déco"          ;279 Calculate Deco
+    TCODE    .0,    .0,      ""                          ;280 UNUSED
 ;
     TCODE    .97,   .170,    "Prof.Moyn"                 ;281 Avr.Depth
     TCODE    .90,   .170,    "TissuDirec"                ;282 Lead Tiss.
@@ -392,4 +392,7 @@
 	TCODE	 .50,	.130,	 "Aborted!"					 ;304 Aborted
 ;@5 variant
     TCODE    .0,    .0,      "DTR Réchap"                ;305 Future TTS            (=10 chars. Title for @5 customview).
+;Dive interval
+    TCODE    .20,   .35,     "Intervalle: "               ;306 Interval:
+    TCODE    .0,    .0,      "Maintenant"                 ;307 Dive now
 ;=============================================================================
--- a/code_part1/OSTC_code_asm_part1/german_text.asm	Thu Jun 09 23:06:25 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/german_text.asm	Fri Jun 10 01:14:38 2011 +0200
@@ -324,7 +324,7 @@
     TCODE    .50,   .145,    "Battery schwach!"          ;246 LowBatt!
     TCODE    .20,   .125,    "Simulator"                 ;247 Simulator
     TCODE    .30,   .2,      "OSTC Simulator"            ;248 OSTC Simulator
-    TCODE    .20,   .35,     "TG beginnen"               ;249 Start Dive
+    TCODE    .20,   .65,     "TG beginnen"               ;249 Start Dive
     TCODE    .100,  .25,     "+ 1m"                      ;250 + 1m
     TCODE    .100,  .50,     "- 1m"                      ;251 - 1m
     TCODE    .100,  .75,     "+10m"                      ;252 +10m
@@ -357,10 +357,10 @@
     TCODE    .0,    .125,    "Menü für Details!"         ;275 for Details!
     TCODE    .20,   .95,     "Salzgeh.: "                ;276 Salinity:
 ;
-    TCODE    .20,   .65,     "Grundzeit:"                ;277 Bottom Time:
-    TCODE    .20,   .95,     "Max. Tiefe:"               ;278 Max. Depth:
-    TCODE    .20,   .125,    "Dekoplan berechn."         ;279 Calculate Deco
-    TCODE    .20,   .155,    "Dekoplan anzeigen."        ;280 Show Decoplan
+    TCODE    .20,   .95,     "Grundzeit:"                ;277 Bottom Time:
+    TCODE    .20,   .125,    "Max. Tiefe:"               ;278 Max. Depth:
+    TCODE    .20,   .155,    "Dekoplan berechn."         ;279 Calculate Deco
+    TCODE    .0,    .0,      ""                          ;280 UNUSED
 ;
     TCODE    .107,   .170,   "D-Tiefe"                   ;281 Avr.Depth
     TCODE    .90,   .170,    "Leitgewebe"                ;282 Lead Tiss.
@@ -384,7 +384,7 @@
     TCODE    .0,    .0,      "MOD:"                      ;297 MOD:                  (max operating depth of a gas).
     TCODE    .0,    .0,      "END:"                      ;298 END:                  (equivalent nitrogen depth of a gas).
     TCODE    .0,    .0,      "EAD:"                      ;299 EAD:                  (equivalent air depth of a gas).
-    TCODE  .100,  .125,	     "Aktiv?"			 		 ;300 Active?               (Enable/Disable Gas underwater)
+    TCODE    .100,  .125,	 "Aktiv?"			 		 ;300 Active?               (Enable/Disable Gas underwater)
     TCODE    .0,    .2,      "OCR Gasverbrauch:"         ;301 OCR Gas Usage:        (Planned gas consumtion by tank).
 ; 115k Bootloader support:
 	TCODE	 .45,	.100,	 "Bootloader"				 ;302 Bootloader
@@ -392,4 +392,7 @@
 	TCODE	 .40,	.130,	 "Abgebrochen!"				 ;304 Aborted
 ;@5 variant
     TCODE    .0,    .0,      "TTS @+Min."                ;305 Future TTS            (=10 chars. Title for @5 customview).
+;Dive interval
+    TCODE    .20,   .35,     "Interval:"                 ;306 Interval:
+    TCODE    .0,    .0,      "Now"                       ;307 Now
 ;=============================================================================
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Thu Jun 09 23:06:25 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Fri Jun 10 01:14:38 2011 +0200
@@ -515,28 +515,50 @@
 ;       that part of the mask to be sure the numbers fit in the right places.
 PLED_simulator_data:
 	WIN_LEFT	.20
-	WIN_TOP		.65
 	WIN_FONT 	FT_SMALL
 	call	PLED_standard_color
-	lfsr	FSR2,letter
-	OUTPUTTEXTH .277                    ; Bottom Time:
-	
-	movff	logbook_temp1,lo            
+
+    ;---- Updates interval line ----------------------------------------------
+	WIN_TOP    .35
+	lfsr	    FSR2,letter
+	OUTPUTTEXTH .306                    ; Interval:
+
+	movff	    char_I_dive_interval,lo
+    movf        lo,W
+    bnz         PLED_simulator_data_1
+    OUTPUTTEXTH .307                    ; Now
+    clrf        POSTINC2                ; End buffer.
+    bra         PLED_simulator_data_2
+
+PLED_simulator_data_1:
 	bsf		leftbind
 	output_8
-	bcf		leftbind
+	STRCAT      "0min"
+
+PLED_simulator_data_2:
+    call        word_processor
+
+    ;---- Updates bottom time line -------------------------------------------
+	WIN_TOP		.95
+	lfsr        FSR2,letter
+	OUTPUTTEXTH .277                    ; Bottom Time:
+
+	movff	logbook_temp1,lo
+	bsf		leftbind
+	output_8
 	STRCAT_PRINT  "min "
 
-	WIN_LEFT	.20
-	WIN_TOP		.95
+    ;---- Updates depth line -------------------------------------------------
+	WIN_TOP		.125
 	lfsr	FSR2,letter
 	OUTPUTTEXTH .278                    ; Max. Depth:
 
 	movff	logbook_temp2,lo
 	bsf		leftbind
 	output_8
+	STRCAT_PRINT  "m "
+
 	bcf		leftbind
-	STRCAT_PRINT  "m "
 	return
 
 ;=============================================================================
@@ -932,13 +954,13 @@
 	call	PLED_topline_box
 	WIN_INVERT	.1	; Init new Wordprocessor	
 	DISPLAYTEXT	.248		; OSTC Simulator
-	WIN_INVERT	.0	; Init new Wordprocessor	
-	DISPLAYTEXT	.249		; Start Dive
-	DISPLAYTEXTH	.277	; Bottom Time:
-	DISPLAYTEXTH	.278	; Max. Depth:
-	DISPLAYTEXTH	.279	; Calculate Deco
-	DISPLAYTEXTH	.280	; Show Decoplan
-	DISPLAYTEXT .11			; Exit
+	WIN_INVERT	.0	; Init new Wordprocessor
+    DISPLAYTEXTH    .306                ; Interval:
+	DISPLAYTEXT	    .249                ; Start Dive
+	DISPLAYTEXTH	.277                ; Bottom Time:
+	DISPLAYTEXTH	.278                ; Max. Depth:
+	DISPLAYTEXTH	.279                ; Calculate Deco
+	DISPLAYTEXT     .11                 ; Exit
 	return
 	
 PLED_temp_surfmode:
--- a/code_part1/OSTC_code_asm_part1/simulator.asm	Thu Jun 09 23:06:25 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/simulator.asm	Fri Jun 10 01:14:38 2011 +0200
@@ -25,11 +25,13 @@
 
 menu_simulator:
 	movlw	d'1'
-	movwf	logbook_temp1		; Bottom time
+	movwf	logbook_temp1               ; Bottom time
 	movlw	d'15'
-	movwf	logbook_temp2		; Max. Depth
+	movwf	logbook_temp2               ; Max. Depth
 	movlw	d'1'
 	movwf	menupos
+    clrf    WREG                        ; Interval
+    movff   WREG,char_I_dive_interval
 
 menu_simulator1:
 	clrf	timeout_counter2
@@ -77,6 +79,8 @@
 
 menu_simulator_do:						; calls submenu
 	dcfsnz	menupos,F
+	bra		simulator_inc_interval
+	dcfsnz	menupos,F
 	bra		simulator_startdive
 	dcfsnz	menupos,F
 	bra		simulator_inc_bottomtime
@@ -84,20 +88,31 @@
 	bra		simulator_inc_maxdepth
 	dcfsnz	menupos,F
 	bra		simulator_calc_deco
-	dcfsnz	menupos,F
-	bra		simulator_show_decoplan
+
 menu_simulator_exit:
 	movlw	d'4'
 	movwf	menupos
-	goto	more_menu2						; exit...
+	goto	more_menu2                  ; exit...
 
+simulator_inc_interval:
+    movff   char_I_dive_interval,PRODL
+    incf    PRODL,F
+    movlw   .24*6                       ; Max 24h delay.
+    cpfslt  PRODL
+    clrf    PRODL
+    movff   PRODL,char_I_dive_interval
+
+	movlw	d'1'
+	movwf	menupos
+	bra		menu_simulator2
+    
 simulator_inc_bottomtime:
 	movlw	d'2'
 	addwf	logbook_temp1,F				; Here: Bottomtime in m
 	movlw	d'199'
 	cpfslt	logbook_temp1
 	movwf	logbook_temp1
-	movlw	d'2'
+	movlw	d'3'
 	movwf	menupos
 	bra		menu_simulator2
 
@@ -107,17 +122,19 @@
 	movlw	d'99'
 	cpfslt	logbook_temp2
 	movwf	logbook_temp2
-	movlw	d'3'
+	movlw	d'4'
 	movwf	menupos
 	bra		menu_simulator2
 
+;=============================================================================
+
 simulator_startdive:
 	; Descent to -15m depth
 	; Set standalone_simulator flag (Displays Simulator menu during simulation by pressing ENTER button)
 	; Clear standalone_simulator after (any) dive
 	bsf		simulatormode_active			; normal simulator mode
 	bsf		standalone_simulator			; Standalone Simulator active
-	
+
 	movff	logbook_temp2,xA+0
 	clrf	xA+1
 	movlw	d'100'
@@ -143,14 +160,20 @@
 	bcf		switch_left
 	bcf		switch_right
 
-	call	simulator_save_tissue_data		; Stores 32 floats "pre_tissue" into bank3
+	call	simulator_save_tissue_data  ; Stores 32 floats "pre_tissue" into bank3
 
-	movlw	d'3'                            ; Begin of deco cycle (reset table).
-	movff	WREG,char_O_deco_status         ; Reset Deco module.
+    movff   char_I_dive_interval,WREG   ; Any interval ?
+    iorlw   0                           ; Test for null
+    btfss   STATUS,Z
+    call    deco_calc_dive_interval     ; NZ: call interval subroutine.
+    movlb   1
+    
+	movlw	d'3'                        ; Begin of deco cycle (reset table).
+	movff	WREG,char_O_deco_status     ; Reset Deco module.
 
-	bsf		divemode						; Set divemode flag
-	ostc_debug	'P'							; Sends debug-information to screen if debugmode active
-	goto	diveloop						; Start Divemode
+	bsf		divemode                    ; Set divemode flag
+	ostc_debug	'P'                     ; Sends debug-information to screen if debugmode active
+	goto	diveloop                    ; Start Divemode
 
 ;=============================================================================
 ; Show decoplanning result.
@@ -194,25 +217,25 @@
         WIN_INVERT	.0                  ; Init new Wordprocessor	
 	
 simulator_show_decoplan1:
-	bcf		switch_left
-	bcf		switch_right
+        bcf		switch_left
+        bcf		switch_right
 simulator_show_decoplan2:
-	btfsc	uart_dump_screen            ; Asked to dump screen contains ?
-	call	dump_screen     		    ; Yes!
-
-	btfss	onesecupdate
-	bra		simulator_show_decoplan3
-
-	call	timeout_surfmode
-	call	set_dive_modes
-	call	test_charger				; check if charger IC is active
-	call	get_battery_voltage			; get battery voltage
-	
-	bcf		onesecupdate				; End of one second tasks
+        btfsc	uart_dump_screen        ; Asked to dump screen contains ?
+        call	dump_screen             ; Yes!
+        
+        btfss	onesecupdate
+        bra		simulator_show_decoplan3
+        
+        call	timeout_surfmode
+        call	set_dive_modes
+        call	test_charger            ; check if charger IC is active
+        call	get_battery_voltage     ; get battery voltage
+        
+        bcf		onesecupdate            ; End of one second tasks
 
 simulator_show_decoplan3:
 	btfsc	switch_right
-	bra		simulator_show_decoplan4	; Quit display
+	bra		menu_simulator1             ; Quit display
 
 	btfsc	switch_left
 	bra		simulator_show_decoplan5	; Next decoplan-page.
@@ -236,12 +259,12 @@
 ;---- In OCR mode, show the gas Usage special page ---------------------------
 simulator_show_decoplan5_0:    
     btfss   display_see_deco            ; Already displayed ?
-    bra     simulator_show_decoplan4    ; Exit to menu.
+    bra     menu_simulator1             ; Exit to menu.
 
 	bcf		display_see_deco			; clear flag
    
     btfsc   FLAG_const_ppO2_mode        ; In CCR mode ?
-    bra     simulator_show_decoplan4    ; YES: finished.
+    bra     menu_simulator1             ; YES: finished.
 
     ; Make sure to pass first gas
     clrf    EEADRH
@@ -308,14 +331,15 @@
 ;=============================================================================
 ; OSTC Simulator: compute a new runtime
 ;
-simulator_show_decoplan4:
-	movlw	d'5'
-	movwf	menupos
-	bra		menu_simulator1
-
 simulator_calc_deco:
 	call	simulator_save_tissue_data  ; Stores 32 floats "pre_tissue" into bank3
 
+    movff   char_I_dive_interval,WREG   ; Any interval ?
+    iorlw   0                           ; Test for null
+    btfss   STATUS,Z
+    call    deco_calc_dive_interval     ; NZ: call interval subroutine.
+    movlb   1
+
 	bsf		simulatormode_active        ; normal simulator mode
 	bsf		standalone_simulator        ; Standalone Simulator active
 	bsf		no_sensor_int               ; Disable sensor interrupt
@@ -421,7 +445,9 @@
 	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.
+
+	clrf	timeout_counter2            ; Restart menu timeout.
+    bra     simulator_show_decoplan     ; Done.
 
 simulator_save_tissue_data:
 	bsf		restore_deco_data           ; Set restore flag
--- a/code_part1/OSTC_code_asm_part1/spanish_text.asm	Thu Jun 09 23:06:25 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/spanish_text.asm	Fri Jun 10 01:14:38 2011 +0200
@@ -323,7 +323,7 @@
     TCODE    .50,   .145,    "BatBaja!"                  ;246 LowBatt!
     TCODE    .20,   .125,    "Simulador"                 ;247 Simulator
     TCODE    .30,   .2,      "Simulador OSTC"            ;248 OSTC Simulator
-    TCODE    .20,   .35,     "Inicio Buc."               ;249 Start Dive
+    TCODE    .20,   .65,     "Inicio Buc."               ;249 Start Dive
     TCODE    .100,  .25,     "+ 1m"                      ;250 + 1m
     TCODE    .100,  .50,     "- 1m"                      ;251 - 1m
     TCODE    .100,  .75,     "+10m"                      ;252 +10m
@@ -356,10 +356,10 @@
     TCODE    .0,    .125,    "más Detalles!"             ;275 for Details!
     TCODE    .20,   .95,     "Salinidad:"                ;276 Salinity:
 ;
-    TCODE    .20,   .65,     "Tiempo Fondo:"             ;277 Bottom Time:
-    TCODE    .20,   .95,     "Prof. Max.:"               ;278 Max. Depth:
-    TCODE    .20,   .125,    "Calcular Deco"             ;279 Calculate Deco
-    TCODE    .20,   .155,    "Mostr. Plan Deco"          ;280 Show Decoplan
+    TCODE    .20,   .95,     "Tiempo Fondo:"             ;277 Bottom Time:
+    TCODE    .20,   .125,    "Prof. Max.:"               ;278 Max. Depth:
+    TCODE    .20,   .155,    "Calcular Deco"             ;279 Calculate Deco
+    TCODE    .0,    .0,      ""                          ;280 UNUSED
 ;
     TCODE    .93,   .170,    "ProfMedia"                 ;281 Avr.Depth
     TCODE    .90,   .170,    "TejControl"                ;282 Lead Tiss.
@@ -391,4 +391,7 @@
 	TCODE	 .50,	.130,	 "ˇAborta!"					 ;304 Aborted
 ;@5 variant
     TCODE    .0,    .0,      "Futuro TTS"                ;305 Future TTS            (=10 chars. Title for @5 customview).
+;Dive interval
+    TCODE    .20,   .35,     "Interval:"                 ;306 Interval:
+    TCODE    .0,    .0,      "Now"                       ;307 Now
 ;=============================================================================