Mercurial > public > mk2
changeset 826:2151c4135fad
CHANGE: Battery percent based on ON-Time instead of battery voltage
author | heinrichsweikamp |
---|---|
date | Wed, 30 Sep 2015 20:25:28 +0200 |
parents | 588867b0d5c2 |
children | 2ea0c01547e8 |
files | code_part1/OSTC_code_asm_part1/changelog.txt code_part1/OSTC_code_asm_part1/divemode.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/italian_text.asm code_part1/OSTC_code_asm_part1/outputs.asm code_part1/OSTC_code_asm_part1/russian_text.asm code_part1/OSTC_code_asm_part1/spanish_text.asm |
diffstat | 9 files changed, 82 insertions(+), 66 deletions(-) [+] |
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/changelog.txt Sun Aug 02 15:26:50 2015 +0200 +++ b/code_part1/OSTC_code_asm_part1/changelog.txt Wed Sep 30 20:25:28 2015 +0200 @@ -1,6 +1,7 @@ New in 3.05: Beta Release NEW: Quit Simulator automatically when starting a real dive +CHANGE: Battery percent based on ON-Time instead of battery voltage New in 3.04: Beta Release
--- a/code_part1/OSTC_code_asm_part1/divemode.asm Sun Aug 02 15:26:50 2015 +0200 +++ b/code_part1/OSTC_code_asm_part1/divemode.asm Wed Sep 30 20:25:28 2015 +0200 @@ -1915,9 +1915,10 @@ set_powersafe: btfsc low_battery_state ; battery warning alread active? bra set_powersafe2 ; Yes, but is it still required? - ; battery voltage in mV (value*256+Lowbyte=actual treshold) - movlw d'12' ; 3,328V - cpfsgt batt_voltage+1 + + call update_batt_get_percent_in_lo + movlw d'20' ; 20% + cpfsgt lo bra set_powersafe1 return
--- a/code_part1/OSTC_code_asm_part1/english_text.asm Sun Aug 02 15:26:50 2015 +0200 +++ b/code_part1/OSTC_code_asm_part1/english_text.asm Wed Sep 30 20:25:28 2015 +0200 @@ -118,6 +118,7 @@ #DEFINE TXT_DIL_C "D" ; "D" #DEFINE TXT_DIL5 "Dil.#" ; "Dil.#" #DEFINE TXT_aGF4 "aGF:" ; "aGF:" +#DEFINE TXT_BATT "B:" ; "B:" #ENDIF ;============================================================================= @@ -190,7 +191,7 @@ TCODE .40, .35, "Logbook offset " ;064 Logbook offset TCODE .40, .35, "Last Deco at[m]" ;065 Last Deco at[m] TCODE .40, .35, "End Apnoe [h]" ;066 End Apnoe [h] - TCODE .40, .35, "Show Batt.Volts" ;067 Show Batt.Volts + TCODE .40, .35, "Show Battery % " ;067 Show Battery % ; End of function descriptor I ; ;licence:
--- a/code_part1/OSTC_code_asm_part1/french_text.asm Sun Aug 02 15:26:50 2015 +0200 +++ b/code_part1/OSTC_code_asm_part1/french_text.asm Wed Sep 30 20:25:28 2015 +0200 @@ -120,6 +120,7 @@ #DEFINE TXT_DIL_C "D" ; "D" #DEFINE TXT_DIL5 "Dil.#" ; "Dil.#" #DEFINE TXT_aGF4 "aGF:" ; "aGF:" +#DEFINE TXT_BATT "B:" ; "B:" #ENDIF ;============================================================================= @@ -192,7 +193,7 @@ TCODE .40, .35, "Décalage Carnet" ;064 Logbook offset TCODE .40, .35, "Dern. Palier[m]" ;065 Last Deco at[m] TCODE .40, .35, "Fin Apnée [h]" ;066 End Apnoe [h] - TCODE .40, .35, "Aff.TensionBatt" ;067 Show Batt.Volts + TCODE .40, .35, "Aff. Batt. % " ;067 Show Battery % ; End of function descriptor I ; ;licence:
--- a/code_part1/OSTC_code_asm_part1/german_text.asm Sun Aug 02 15:26:50 2015 +0200 +++ b/code_part1/OSTC_code_asm_part1/german_text.asm Wed Sep 30 20:25:28 2015 +0200 @@ -118,6 +118,7 @@ #DEFINE TXT_DIL_C "D" ; "D" #DEFINE TXT_DIL5 "Dil.#" ; "Dil.#" #DEFINE TXT_aGF4 "aGF:" ; "aGF:" +#DEFINE TXT_BATT "B:" ; "B:" #ENDIF @@ -191,7 +192,7 @@ TCODE .40, .35, "Logbuch Versatz" ;064 Logbook offset TCODE .40, .35, "Letzte Deko [m]" ;065 Last Deco at[m] TCODE .40, .35, "Apnoe Ende [h]" ;066 End Apnoe [h] - TCODE .40, .35, "Zeige Batt.Volt" ;067 Show Batt.Volts + TCODE .40, .35, "Zeige Batterie%" ;067 Show Battery % ; End of function descriptor I ; ;licence:
--- a/code_part1/OSTC_code_asm_part1/italian_text.asm Sun Aug 02 15:26:50 2015 +0200 +++ b/code_part1/OSTC_code_asm_part1/italian_text.asm Wed Sep 30 20:25:28 2015 +0200 @@ -118,6 +118,7 @@ #DEFINE TXT_DIL_C "D" ; "D" #DEFINE TXT_DIL5 "Dil.#" ; "Dil.#" #DEFINE TXT_aGF4 "aGF:" ; "aGF:" +#DEFINE TXT_BATT "B:" ; "B:" #ENDIF ;============================================================================= @@ -190,7 +191,7 @@ TCODE .40, .35, "Logbook offset " ;064 Logbook offset TCODE .40, .35, "Ultima Deco [m]" ;065 Last Deco at[m] TCODE .40, .35, "Fine Apnea [h]" ;066 End Apnoe [h] - TCODE .40, .35, "Mostra VoltBatt" ;067 Show Batt.Volts + TCODE .40, .35, "Mostra Batt. % " ;067 Show Battery % ; End of function descriptor I ; ;licence:
--- a/code_part1/OSTC_code_asm_part1/outputs.asm Sun Aug 02 15:26:50 2015 +0200 +++ b/code_part1/OSTC_code_asm_part1/outputs.asm Wed Sep 30 20:25:28 2015 +0200 @@ -2252,7 +2252,44 @@ call sub16 ; sub_c = sub_a - sub_b btfss neg_flag bra update_batt_voltage0 ; Normal display - WIN_BOX_BLACK .174, .194, .1, .34 ;top, bottom, left, right + WIN_BOX_BLACK .174, .194, .1, .35 ;top, bottom, left, right + return + +update_batt_get_percent_in_lo: + ; percent = ontime [m] * 100 / CF74 + movff on_time_seconds+0,xC+0 + movff on_time_seconds+1,xC+1 + movff on_time_seconds+2,xC+2 + clrf xC+4 + movlw .60 + movwf xB+0 + clrf xB+1 + call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder + movff xC+0,xA+0 + movff xC+1,xA+1 ; On-Time in full minutes + movlw .100 + movwf xB+0 + clrf xB+1 + call mult16x16 ;xA*xB=xC + GETCUSTOM15 d'74' + movff lo,xB+0 + movff hi,xB+1 + call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder + movff xC+0,lo ; Copy result + + ; Limit to 100 + movlw .100 + cpfslt lo + movwf lo + ; lo will be between 0 (Full) and 100 (empty) + movf lo,W + sublw .100 + movwf lo + + movlw .100 + cpfslt lo + movwf lo + ; lo will be between 100 (Full) and 0 (empty) return update_batt_voltage: @@ -2272,64 +2309,35 @@ WIN_FONT FT_SMALL WIN_INVERT .0 ; Init new Wordprocessor call DISP_standard_color - + call update_batt_get_percent_in_lo ; 100 - 0 lfsr FSR2,letter - movff batt_voltage+0,lo - movff batt_voltage+1,hi - movlw d'1' - movwf ignore_digits - bsf ignore_digit5 ; do not display mV + STRCPY TXT_BATT ; Batt: bsf leftbind - output_16dp d'2' ; e.g. 3.45V + output_8 bcf leftbind - STRCAT_PRINT TXT_VOLT2 + STRCAT_PRINT "%" return - + update_batt_voltage2: - WIN_FRAME_STD .174, .194, .1, .32 - -; 4100-Vbatt - movlw LOW d'4100' - movwf sub_a+0 - movlw HIGH d'4100' - movwf sub_a+1 - movff batt_voltage+0,sub_b+0 - movff batt_voltage+1,sub_b+1 - call sub16 ; sub_c = sub_a - sub_b -; Battery full (>4100mV? - btfsc neg_flag - bra update_batt_voltage2_full - -; Vbatt-3500 - movlw LOW d'3500' - movwf sub_b+0 - movlw HIGH d'3500' - movwf sub_b+1 - movff batt_voltage+0,sub_a+0 - movff batt_voltage+1,sub_a+1 - call sub16 ; sub_c = sub_a - sub_b -; Battery lower then 3500mV? - btfsc neg_flag - bra update_batt_voltage2_empty - -; Battery is between 3500 and 4100mV -; sub_c:2 is between 0 and 600 - movff sub_c+0,xA+0 - movff sub_c+1,xA+1 - movlw d'20' - movwf xB+0 - clrf xB+1 - call div16x16 ;xA/xB=xC with xA as remainder -; xC is between 0 and 30 - movff xC+0,wait_temp ;save value - incf wait_temp,F ; +1 + WIN_FRAME_STD .174, .194, .1, .33 + + call update_batt_get_percent_in_lo ; 100 - 0 + movf lo,W + mullw .10 ; PRODH:PRODL = 1000 - 0 + movff PRODH,divA+1 + movff PRODL,divA+0 + movlw .5 + movwf divB + call div16 ; divA=divA/2^divB (divB: 8Bit only!) +; xC is between 0 and 32 + movff divA+0,wait_temp ;save value movlw d'3' cpfsgt wait_temp movwf wait_temp ; Minimum = 3 update_batt_voltage2a: - WIN_BOX_STD .181, .187, .32, .34 ; Battery nose + WIN_BOX_STD .181, .187, .33, .35 ; Battery nose update_batt_voltage3: GETCUSTOM8 d'34' ; Color battery @@ -2351,15 +2359,15 @@ call DISP_standard_color return -update_batt_voltage2_empty: - movlw d'1' - movwf wait_temp - bra update_batt_voltage2a - -update_batt_voltage2_full: - movlw d'30' - movwf wait_temp - bra update_batt_voltage2a +;update_batt_voltage2_empty: +; movlw d'1' +; movwf wait_temp +; bra update_batt_voltage2a +; +;update_batt_voltage2_full: +; movlw d'30' +; movwf wait_temp +; bra update_batt_voltage2a DISP_convert_signed_temperature: btfss hi,7 ; Negative temperature ?
--- a/code_part1/OSTC_code_asm_part1/russian_text.asm Sun Aug 02 15:26:50 2015 +0200 +++ b/code_part1/OSTC_code_asm_part1/russian_text.asm Wed Sep 30 20:25:28 2015 +0200 @@ -121,6 +121,7 @@ #DEFINE TXT_DIL_C "D" ; "D" #DEFINE TXT_DIL5 "Äèë.#" ; "Dil.#" #DEFINE TXT_aGF4 "äÃÔ:" ; "aGF:" +#DEFINE TXT_BATT "B:" ; "B:" #ENDIF ;============================================================================= @@ -193,7 +194,7 @@ TCODE .40, .35, "Íîìåð â æóðíàëå" ;064 Logbook offset TCODE .40, .35, "Êðàéíÿÿ äåêî[ì]" ;065 Last Deco at[m] TCODE .40, .35, "Êîíåö Àïíîý [÷]" ;066 End Apnoe [h] - TCODE .40, .35, "Ïîêàç íàïð.áàò." ;067 Show Batt.Volts + TCODE .40, .35, "Ïîêàç íàïð.áàò." ;067 Show Battery % ; End of function descriptor I ; ;licence:
--- a/code_part1/OSTC_code_asm_part1/spanish_text.asm Sun Aug 02 15:26:50 2015 +0200 +++ b/code_part1/OSTC_code_asm_part1/spanish_text.asm Wed Sep 30 20:25:28 2015 +0200 @@ -117,6 +117,7 @@ #DEFINE TXT_DIL_C "D" ; "D" #DEFINE TXT_DIL5 "Dil.#" ; "Dil.#" #DEFINE TXT_aGF4 "aGF:" ; "aGF:" +#DEFINE TXT_BATT "B:" ; "B:" #ENDIF ;============================================================================= @@ -189,7 +190,7 @@ TCODE .40, .35, "Despl. diario " ;064 Logbook offset TCODE .40, .35, "Ult. Deco a [m]" ;065 Last Deco at[m] TCODE .40, .35, "Fin Apnea [h]" ;066 End Apnoe [h] - TCODE .40, .35, "Mues. volt. Bat" ;067 Show Batt.Volts + TCODE .40, .35, "Mues. Batt. % " ;067 Show Battery % ; End of function descriptor I ; ;licence: