changeset 789:380a07e4fc15

work on new battery information output
author heinrichsweikamp
date Thu, 28 Aug 2014 16:34:55 +0200
parents 9eba1eb8ca38
children 53425d598585
files code_part1/OSTC_code_asm_part1/changelog.txt code_part1/OSTC_code_asm_part1/definitions.asm code_part1/OSTC_code_asm_part1/isr.asm code_part1/OSTC_code_asm_part1/surfmode.asm
diffstat 4 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/changelog.txt	Mon Aug 11 12:18:48 2014 +0200
+++ b/code_part1/OSTC_code_asm_part1/changelog.txt	Thu Aug 28 16:34:55 2014 +0200
@@ -1,6 +1,7 @@
 New in 2.94:
 BETA Version
 BUGFIX: False bailout flag in logbook
+NEW: On-Time counter for better battery information
 
 New in 2.93:
 BETA Version
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Mon Aug 11 12:18:48 2014 +0200
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Thu Aug 28 16:34:55 2014 +0200
@@ -339,7 +339,7 @@
 active_gas              res 1   ; Holds number of active gas (1-5)
 active_diluent          res 1   ; Holds number of active diluent (1-5)
 
-debug_char              res 6    ; For debugmode
+debug_char              res 6   ; For debugmode
 
 apnoe_mins              res 1   ; single descent minutes for Apnoe mode
 apnoe_secs              res 1   ; single descent seconds for Apnoe mode
@@ -370,6 +370,7 @@
 sim_btm_depth           res 1   ; Simulated max depth
 sim_CNS                 res 1   ; Backup CNS value during decoplanning.
 
+on_time_seconds         res 3   ; Counts on-time seconds since last full charge
 
 
 ASSERT_BANK1    MACRO   tag
--- a/code_part1/OSTC_code_asm_part1/isr.asm	Mon Aug 11 12:18:48 2014 +0200
+++ b/code_part1/OSTC_code_asm_part1/isr.asm	Thu Aug 28 16:34:55 2014 +0200
@@ -334,6 +334,16 @@
 		clrf		timer1int_counter1		; counts to 16 (one second / 62.5ms)
 		bsf			onesecupdate			; we have a new second!
 
+        btfsc       sleepmode               ; are we in sleep mode?
+        bra         RTCisr0                 ; Yes
+
+        movlw       .1
+        addwf       on_time_seconds+0,F
+        movlw       .0
+        addwfc      on_time_seconds+1,F
+        addwfc      on_time_seconds+2,F     ; Increase counter
+
+RTCisr0:
 		bcf			STATUS,Z				; are we in dive mode?
 		btfss		divemode
 		bra			RTCisr2					; No, must be surface or sleepmode
--- a/code_part1/OSTC_code_asm_part1/surfmode.asm	Mon Aug 11 12:18:48 2014 +0200
+++ b/code_part1/OSTC_code_asm_part1/surfmode.asm	Thu Aug 28 16:34:55 2014 +0200
@@ -315,6 +315,11 @@
 	bra		test_charger2				; No, add incomplete cycle!
 	
 	; Yes, store all data for complete cycle
+
+    clrf    on_time_seconds+0
+    clrf    on_time_seconds+1
+    clrf    on_time_seconds+2           ; Clear on-time counter
+
 	bcf		charge_started				; Clear flag
 	bcf		charge_done					; Clear flag
 	; Store incomplete cycles