changeset 630:6526a5b058b7

Fill char_O_deco_time_for_log array with stop times
author heinrichsweikamp
date Fri, 07 Sep 2012 14:48:31 +0200
parents e755ed869a3b
children 19c2773a1657
files code_part1/OSTC_code_asm_part1/divemode.asm code_part1/OSTC_code_asm_part1/shared_definitions.h code_part1/OSTC_code_c_part2/p2_deco.c
diffstat 3 files changed, 57 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Tue Aug 28 19:01:41 2012 +0200
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Fri Sep 07 14:48:31 2012 +0200
@@ -715,7 +715,7 @@
 check_extended4:
 	decfsz	divisor_deco_debug,W; Check divisor
 	bra		check_extended5		
-	movlw	d'9'				; Information length	
+	movlw	d'15'				; Information length
 	addwf	ProfileFlagByte,F	; add to ProfileFlagByte
 check_extended5:
 	decfsz	divisor_cns,W		; Check divisor
@@ -849,7 +849,36 @@
 	return
 
 store_dive_decodebug:
-	; do something here
+    movff   char_O_deco_time_for_log+.0,WREG     ; 3m
+    call	write_external_eeprom
+    movff   char_O_deco_time_for_log+.1,WREG
+    call	write_external_eeprom
+    movff   char_O_deco_time_for_log+.2,WREG
+    call	write_external_eeprom
+    movff   char_O_deco_time_for_log+.3,WREG
+    call	write_external_eeprom
+    movff   char_O_deco_time_for_log+.4,WREG
+    call	write_external_eeprom
+    movff   char_O_deco_time_for_log+.5,WREG
+    call	write_external_eeprom
+    movff   char_O_deco_time_for_log+.6,WREG
+    call	write_external_eeprom
+    movff   char_O_deco_time_for_log+.7,WREG
+    call	write_external_eeprom
+    movff   char_O_deco_time_for_log+.8,WREG
+    call	write_external_eeprom
+    movff   char_O_deco_time_for_log+.9,WREG
+    call	write_external_eeprom
+    movff   char_O_deco_time_for_log+.10,WREG
+    call	write_external_eeprom
+    movff   char_O_deco_time_for_log+.11,WREG
+    call	write_external_eeprom
+    movff   char_O_deco_time_for_log+.12,WREG
+    call	write_external_eeprom
+    movff   char_O_deco_time_for_log+.13,WREG
+    call	write_external_eeprom
+    movff   char_O_deco_time_for_log+.14,WREG   ; 45m
+    call	write_external_eeprom
 	GETCUSTOM8	d'25'
 	movwf	divisor_deco_debug			; Reload divisor from CF
 	return
@@ -1441,7 +1470,7 @@
 	addwf	temp1,W		; copy to bits 0-3, result in WREG
 	call	write_external_eeprom
 
-	movlw	d'0'		; information size Decodebug
+	movlw	d'15'		; information size Decodebug
 	movwf	temp1		; copy to bits 0-3
 	swapf	temp1,F		; swap nibbels 0-3 with 4-7
 	GETCUSTOM8	d'25'	; Divisor Decodebug
--- a/code_part1/OSTC_code_asm_part1/shared_definitions.h	Tue Aug 28 19:01:41 2012 +0200
+++ b/code_part1/OSTC_code_asm_part1/shared_definitions.h	Fri Sep 07 14:48:31 2012 +0200
@@ -113,6 +113,7 @@
 VAR_UCHAR (char_O_first_deco_time) ;        // Duration of first stop.
 TAB_UCHAR (char_O_deco_depth, NUM_STOPS);   // Fusionned decompression table:
 TAB_UCHAR (char_O_deco_time,  NUM_STOPS);   // Both ZH-L16 and L16-GF models.
+TAB_UCHAR (char_O_deco_time_for_log, NUM_STOPS); // For logging the full decoplan
 
 TAB_UCHAR (char_O_tissue_N2_saturation, NUM_COMP); // Nitrogen compartiment desaturation time, in min.
 TAB_UCHAR (char_O_tissue_He_saturation, NUM_COMP); // Helium compartiment desaturation time, in min.
--- a/code_part1/OSTC_code_c_part2/p2_deco.c	Tue Aug 28 19:01:41 2012 +0200
+++ b/code_part1/OSTC_code_c_part2/p2_deco.c	Fri Sep 07 14:48:31 2012 +0200
@@ -680,6 +680,7 @@
         for(y=0; y<NUM_STOPS; y++, --x)
         {
             char_O_deco_depth[y] = internal_deco_depth[x];
+            char_O_deco_time_for_log[y] = internal_deco_depth[x];
             char_O_deco_time [y] = internal_deco_time [x];
 
             // Stop only once the last transfer is done.
@@ -691,17 +692,39 @@
         {
             char_O_deco_time [y] = 0;
             char_O_deco_depth[y] = 0;
+            char_O_deco_time_for_log[y] = 0;
         }
     }
     else //---- Straight copy ------------------------------------------------
     {
-        overlay unsigned char x;
+        overlay unsigned char x, y;
 
         for(x=0; x<NUM_STOPS; x++)
         {
             char_O_deco_depth[x] = internal_deco_depth[x];
             char_O_deco_time [x] = internal_deco_time [x];
         }
+
+        //Now fill the char_O_deco_time_for_log array
+        //---- First: search the first non-null depth
+        for(x=(NUM_STOPS-1); x != 0; --x)
+            if( internal_deco_depth[x] != 0 ) break;
+
+        //---- Second: copy to output table (in reverse order)
+        for(y=0; y<NUM_STOPS; y++, --x)
+        {
+            char_O_deco_time_for_log[y] = internal_deco_depth[x];
+
+            // Stop only once the last transfer is done.
+            if( x == 0 ) break;
+        }
+
+        //---- Third: fill table end with null
+        for(y++; y<NUM_STOPS; y++)
+        {
+            char_O_deco_time_for_log [y] = 0;
+        }
+
     }
 }