Mercurial > public > mk2
changeset 395:0e0cf4701c17
Merge with 64kByte Logbook
author | JeanDo |
---|---|
date | Thu, 23 Jun 2011 01:37:59 +0200 |
parents | 93c0cb14b0d2 (current diff) 01ca15caa593 (diff) |
children | 0386c7e1374a |
files | |
diffstat | 23 files changed, 758 insertions(+), 299 deletions(-) [+] |
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/altimeter.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/altimeter.asm Thu Jun 23 01:37:59 2011 +0200 @@ -364,6 +364,7 @@ movlw 4*(.49-.32) + 0x82 ; CF#49 low byte address in EEPROM movwf EEADR call write_eeprom + clrf EEADRH ; Reset EEADRH for compatibility bra altimeter_menu_2 ;---- Reset sea level pressure to reference ----------------------------------
--- a/code_part1/OSTC_code_asm_part1/changelog.txt Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/changelog.txt Thu Jun 23 01:37:59 2011 +0200 @@ -1,9 +1,28 @@ +New in 1.92 beta: +BETA Version - Do NOT use for diving! + + New in 1.91 beta: BETA Version - Do NOT use for diving! BUGFIX: Ignore depths>130m in PC simulation BUGFIX: Avoid spurious CF55 stops with 3 gas or more +BUGFIX: Average depth in Logbook (For dives made with >=1.91) +BUGFIX: Logbook time scale (squares are 10min * 10m) +BUGFIX: Bühlmann half-times rounded to the minute +BUGFIX: Protect again rare race contition on pressure/temperature +BUGFIX: Time is now accurate +CHANGE: CF02 now allows delay of more then 240seconds +CHANGE: First gas do not reset change depth +CHANGE: Logbook format 21: store & shows dive model (sat/desat or GF_low/high factors), + CNS profile, GF profile. + WARNING: the upgrade is not reversible without loosing all your profiles. +NEW: "Quit Sim" in divemode simulator menu for exiting the simulation NEW: Allow -2:00 to +2:00 adjustement per day (CF48). NEW: 1/10/100 steps in CF menu +NEW: 64kByte Logbook (Doubled capacity compared to 1.90) +NEW: Additional dive interval for simulator and decoplaning +NEW: Negative temperatures in logbook and battery information menu +NEW: Screen dump support New in 1.90 Stable: Stable release
--- a/code_part1/OSTC_code_asm_part1/customview.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/customview.asm Thu Jun 23 01:37:59 2011 +0200 @@ -85,9 +85,16 @@ goto PLED_total_average_show2 ; Update the figures only customview_1sec_stopwatch: + btfsc gauge_mode ; In Gauge mode? + bra customview_1sec_stopwatch_gauge; Yes + bsf menu3_active ; Set Flag goto PLED_stopwatch_show2 ; Update figures only +customview_1sec_stopwatch_gauge: + bsf menu3_active ; Set Flag + goto PLED_stopwatch_show_gauge ; Update figures + Description + customview_1sec_marker: ; Do nothing extra bsf menu3_active ; Set Flag customview_1sec_clock: ; Do nothing extra @@ -198,11 +205,22 @@ decfsz WREG,F ; WREG=1? bra customview_toggle ; No, use next Customview + btfsc gauge_mode ; In Gauge mode? + bra customview_init_stopwatch_gauge ; Yes + call PLED_stopwatch_show ; Init Stopwatch display bsf menu3_active ; Set Flag bra customview_toggle_exit +customview_init_stopwatch_gauge: + call PLED_stopwatch_show_gauge ; Init Stopwatch display + bsf menu3_active ; Set Flag + bra customview_toggle_exit + customview_init_marker: ; Init Marker + btfsc gauge_mode ; In Gauge mode? + call PLED_clear_divemode_menu; Yes, clear BIG stopwatch + GETCUSTOM8 d'50' ; Show Marker? (=1 in WREG) decfsz WREG,F ; WREG=1? bra customview_toggle ; No, use next Customview
--- a/code_part1/OSTC_code_asm_part1/definitions.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/definitions.asm Thu Jun 23 01:37:59 2011 +0200 @@ -22,7 +22,7 @@ ; ToDo: #DEFINE softwareversion_x d'1' ; Software version XX.YY -#DEFINE softwareversion_y d'91' ; Software version XX.YY +#DEFINE softwareversion_y d'92' ; Software version XX.YY #DEFINE softwareversion_beta 1 ; (and 0 for release) @@ -36,7 +36,7 @@ ;#DEFINE __DEBUG ; -#DEFINE logbook_profile_version 0x20 ; Do not touch! +#DEFINE logbook_profile_version 0x21 ; Do not touch! #DEFINE T0CON_debounce b'00000000' ; Timer0 Switch Debounce #DEFINE FT_SMALL .0 @@ -242,8 +242,8 @@ avr_rel_pressure_total res 2 ; Average rel. pressure (Average depth) for the dive [mBar], Non-Resettable last_pressure res 2 temperature_avg res 2 ; Temperature summing buffer. -temperature res 2 -last_temperature res 2 +temperature res 2 ; Final temperature. SIGNED. +last_temperature res 2 ; Last displayed temperature (used to detect changes). Dx res 2 last_surfpressure res 2 ; Divemode @@ -267,10 +267,10 @@ divisor_temperature res 1 ; divisors for profile storage divisor_deco res 1 -divisor_tank res 1 +divisor_gf res 1 divisor_ppo2 res 1 divisor_deco_debug res 1 -divisor_nuy2 res 1 +divisor_cns res 1 timeout_counter res 1 ; Timeout counter variables timeout_counter2 res 1 @@ -333,6 +333,7 @@ time_correction_value res 1 ; Adds to Seconds on midnight gaslist_active res 1 ; Holds flags for active gases desaturation_time_buffer res 2 ; buffer for desat time +total_divetime_seconds res 2 ; counts dive seconds regardless of CF01 (18h max.) ;============================================================================= ; C-code Routines @@ -426,7 +427,7 @@ #DEFINE second_FD flag4,7 ; 2nd 0xFD in EEPROM found #DEFINE second_FA flag4,7 ; 2nd 0xFA in EEPROM found -#DEfINE eeprom_overflow flag5,0 ; EEPROM overflowed (>32KB) +;#DEfINE unused flag5,0 ; unused #DEFINE eeprom_blockwrite flag5,1 ; EEPROM blockwrite active #DEFINE Flag_4 flag5,2 ; unused #DEFINE low_battery_state flag5,3 ;=1 if battery low
--- a/code_part1/OSTC_code_asm_part1/divemode.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/divemode.asm Thu Jun 23 01:37:59 2011 +0200 @@ -75,6 +75,7 @@ bsf twosecupdate ; Routines used in the "other second" call calc_average_depth ; calculate average depth + call calc_velocity ; calculate vertical velocity and display if > threshold (every two seconds) bra diveloop_loop1x ; Common Tasks @@ -589,7 +590,7 @@ ; shift address for header ; the header will be stored after the dive - incf_eeprom_address d'47' ; Macro, that adds 8Bit to eeprom_address:2 with banking at 0x8000 + incf_eeprom_address d'57' ; Macro, that adds 8Bit to eeprom_address:2 with banking at 0x8000 store_dive_data2: SAFE_2BYTE_COPY rel_pressure, lo @@ -612,9 +613,9 @@ movlw d'2' ; Information length addwf ProfileFlagByte,F ; add to ProfileFlagByte check_extended2: - decfsz divisor_tank,W ; Check divisor + decfsz divisor_gf,W ; Check divisor bra check_extended3 - movlw d'2' ; Information length + movlw d'1' ; Information length addwf ProfileFlagByte,F ; add to ProfileFlagByte check_extended3: decfsz divisor_ppo2,W ; Check divisor @@ -627,9 +628,9 @@ movlw d'9' ; Information length addwf ProfileFlagByte,F ; add to ProfileFlagByte check_extended5: - decfsz divisor_nuy2,W ; Check divisor + decfsz divisor_cns,W ; Check divisor bra check_extended6 - movlw d'0' ; Information length + movlw d'1' ; Information length addwf ProfileFlagByte,F ; add to ProfileFlagByte check_extended6: @@ -706,9 +707,9 @@ bra store_extended2 rcall store_dive_decodata store_extended2: - decfsz divisor_tank,F ; Check divisor + decfsz divisor_gf,F ; Check divisor bra store_extended3 - rcall store_dive_tankdata + rcall store_dive_gf store_extended3: decfsz divisor_ppo2,F ; Check divisor bra store_extended4 @@ -718,9 +719,9 @@ bra store_extended5 rcall store_dive_decodebug store_extended5: - decfsz divisor_nuy2,F ; Check divisor + decfsz divisor_cns,F ; Check divisor bra store_extended6 - rcall store_dive_nuy2 + rcall store_dive_cns store_extended6: ; The next block is required to take care of "store never" @@ -728,14 +729,14 @@ clrf divisor_temperature ; And clear register again, so it will never reach zero... btfsc divisor_deco,7 ; Test highest Bit (Register must have been zero before the "decfsz" command!) clrf divisor_deco ; And clear register again, so it will never reach zero... - btfsc divisor_tank,7 ; Test highest Bit (Register must have been zero before the "decfsz" command!) - clrf divisor_tank ; And clear register again, so it will never reach zero... + btfsc divisor_gf,7 ; Test highest Bit (Register must have been zero before the "decfsz" command!) + clrf divisor_gf ; And clear register again, so it will never reach zero... btfsc divisor_ppo2,7 ; Test highest Bit (Register must have been zero before the "decfsz" command!) clrf divisor_ppo2 ; And clear register again, so it will never reach zero... btfsc divisor_deco_debug,7 ; Test highest Bit (Register must have been zero before the "decfsz" command!) clrf divisor_deco_debug ; And clear register again, so it will never reach zero... - btfsc divisor_nuy2,7 ; Test highest Bit (Register must have been zero before the "decfsz" command!) - clrf divisor_nuy2 ; And clear register again, so it will never reach zero... + btfsc divisor_cns,7 ; Test highest Bit (Register must have been zero before the "decfsz" command!) + clrf divisor_cns ; And clear register again, so it will never reach zero... ostc_debug 'D' ; Sends debug-information to screen if debugmode active @@ -750,9 +751,11 @@ bcf event_occured ; Clear the global event flag return ; Done. (Sample with all informations written to EEPROM) -store_dive_nuy2: +store_dive_cns: + movff char_O_CNS_fraction,WREG + call write_external_eeprom ; Store in EEPROM GETCUSTOM8 d'26' - movwf divisor_nuy2 ; Reload divisor from CF + movwf divisor_cns ; Reload divisor from CF return store_dive_decodebug: @@ -791,13 +794,11 @@ movwf divisor_ppo2 ; Reload divisor from CF return -store_dive_tankdata: - movlw d'0' ; Dummy Tank1 - call write_external_eeprom - movlw d'0' ; Dummy Tank2 +store_dive_gf: + movff char_O_gradient_factor,WREG ; gradient factor absolute call write_external_eeprom GETCUSTOM8 d'23' - movwf divisor_tank ; Reload divisor from CF + movwf divisor_gf ; Reload divisor from CF return store_dive_decodata: @@ -1298,10 +1299,10 @@ addwf temp1,W ; copy to bits 0-3, result in WREG call write_external_eeprom - movlw d'2' ; information size tank + movlw d'1' ; information size GF movwf temp1 ; copy to bits 0-3 swapf temp1,F ; swap nibbels 0-3 with 4-7 - GETCUSTOM8 d'23' ; Divisor Tank + GETCUSTOM8 d'23' ; Divisor GF addwf temp1,W ; copy to bits 0-3, result in WREG call write_external_eeprom @@ -1319,10 +1320,10 @@ addwf temp1,W ; copy to bits 0-3, result in WREG call write_external_eeprom - movlw d'0' ; information size nuy2 + movlw d'1' ; information size cns movwf temp1 ; copy to bits 0-3 swapf temp1,F ; swap nibbels 0-3 with 4-7 - GETCUSTOM8 d'26' ; Divisor nuy2 + GETCUSTOM8 d'26' ; Divisor cns addwf temp1,W ; copy to bits 0-3, result in WREG call write_external_eeprom @@ -1333,7 +1334,40 @@ movff char_O_CNS_fraction,WREG ; copy into bank1 call write_external_eeprom ; Stores CNS% -; Add additional 10bytes here.... mH + movff avr_rel_pressure_total+0,WREG ; Average Depth + call write_external_eeprom + movff avr_rel_pressure_total+1,WREG ; Average Depth + call write_external_eeprom + + movff total_divetime_seconds+0,WREG ; Total dive time (Regardless of CF01) + call write_external_eeprom + movff total_divetime_seconds+1,WREG ; Total dive time (Regardless of CF01) + call write_external_eeprom + + movlw d'32' ; GF_lo + movff char_I_deco_model,lo + decfsz lo,F ; jump over next line if char_I_deco_model == 1 + movlw d'11' ; Saturation Multiplier + call getcustom8_1 ; Get Custom function #WREG + call write_external_eeprom ; write WREG into external memory + + movlw d'33' ; GF_hi + movff char_I_deco_model,lo + decfsz lo,F ; jump over next line if char_I_deco_model == 1 + movlw d'12' ; Desaturation Multiplier + call getcustom8_1 ; Get Custom function #WREG + call write_external_eeprom ; write WREG into external memory + + read_int_eeprom d'34' ; Read deco modell + movf EEDATA,W + call write_external_eeprom ; write WREG into external memory + + clrf WREG + call write_external_eeprom ; Spare3 + clrf WREG + call write_external_eeprom ; Spare2 + clrf WREG + call write_external_eeprom ; Spare1 movlw 0xFB ; Header stop call write_external_eeprom @@ -1404,13 +1438,16 @@ bcf divemode incf timeout_counter,F - GETCUSTOM8 d'2' ; diveloop_timeout - addlw d'2' ; adds two seconds in case timout=zero! - btfsc STATUS,C ; > 255? - movlw d'255' ; Set to 255... - decf WREG,F ; Limit to 254 - cpfsgt timeout_counter - bsf divemode + movlw d'0' + addwfc timeout_counter2,F ; timeout is 15bits + GETCUSTOM15 d'2' ; diveloop_timeout + movff lo,sub_a+0 + movff hi,sub_a+1 + movff timeout_counter, sub_b+0 + movff timeout_counter2, sub_b+1 + call sub16 ; sub_c = sub_a - sub_b + btfss neg_flag ; Result negative? + bsf divemode ; No, set flag return timeout_divemode2: @@ -1695,13 +1732,15 @@ clrf apnoe_secs clrf divemins+0 clrf divemins+1 + clrf total_divetime_seconds+0 + clrf total_divetime_seconds+1 clrf menupos3 bcf menu3_active clrf divesecs clrf samplesecs clrf apnoe_timeout_counter ; timeout in minutes - clrf timeout_counter ; takes care of the timeout - clrf timeout_counter2 ; Here: counts to six, then store deco data and temperature + clrf timeout_counter ; takes care of the timeout (Low byte) + clrf timeout_counter2 ; takes care of the timeout (High byte) clrf AlarmType ; Clear all alarms bcf event_occured ; clear flag bcf setpoint_changed ; clear flag @@ -1744,13 +1783,13 @@ GETCUSTOM8 d'22' movwf divisor_deco GETCUSTOM8 d'23' - movwf divisor_tank + movwf divisor_gf GETCUSTOM8 d'24' movwf divisor_ppo2 GETCUSTOM8 d'25' movwf divisor_deco_debug GETCUSTOM8 d'26' - movwf divisor_nuy2 + movwf divisor_cns btfss FLAG_apnoe_mode ; In Apnoe mode? bra divemode1
--- a/code_part1/OSTC_code_asm_part1/divemode_menu.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/divemode_menu.asm Thu Jun 23 01:37:59 2011 +0200 @@ -131,6 +131,8 @@ movlw d'7' ; Number of entries for this menu+1 = 7 btfsc display_set_xgas ; Are we in the Gas6 menu? movlw d'7' ; Number of entries for this menu+1 = 7 + btfsc display_set_simulator ; Are we in the simulator menu? + movlw d'7' ; Number of entries for this menu+1 = 7 cpfseq menupos ; =limit? bra test_switches_divemode_menu1; No! movlw d'1' ; Yes, reset to position 1! @@ -348,6 +350,8 @@ bra divemode_menu_simulator_p10 ; Adjust +10m dcfsnz menupos,F bra divemode_menu_simulator_m10 ; Adjust -10m + dcfsnz menupos,F + bra divemode_menu_simulator_quit; Adjust to zero m bra timeout_divemenu2 ; quit underwater menu! divemode_menu_simulator_common: @@ -366,7 +370,6 @@ movlw HIGH d'14000' movwf sim_pressure+1 return - divemode_menu_simulator_common2: movlw LOW d'1000' ; Compare to 1bar == 0m == 1000 mbar. subwf sim_pressure+0,W @@ -401,6 +404,13 @@ movwf menupos ; reset cursor bra divemode_menu_simulator_common +divemode_menu_simulator_quit: + movlw LOW d'1000' + movwf sim_pressure+0 + movlw HIGH d'1000' + movwf sim_pressure+1 + bra timeout_divemenu2 ; quit menu + divemode_menu_simulator_p1: movlw d'100' addwf sim_pressure+0,F
--- a/code_part1/OSTC_code_asm_part1/english_text.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/english_text.asm Thu Jun 23 01:37:59 2011 +0200 @@ -96,7 +96,7 @@ ; 32 custom function descriptors I (FIXED LENGTH = 15 chars). TCODE .40, .35, "Start Dive [m]" ;036 Start Dive [m] (depth to switch to dive mode) TCODE .40, .35, "End Dive [m]" ;037 End Dive [m] (depth to switch back to surface mode) - TCODE .40, .35, "End Delay [min]" ;038 End Delay [min] (duration dive screen stays after end of dive) + TCODE .40, .35, "End Delay [sec]" ;038 End Delay [sec] (duration dive screen stays after end of dive) TCODE .40, .35, "Power Off [min]" ;039 Power Off [min] TCODE .40, .35, "Pre-menu [min]" ;040 Pre-menu [min] (Delais to keep surface-mode menus displayed) TCODE .40, .35, "velocity[m/min]" ;041 velocity[m/min] @@ -117,10 +117,10 @@ TCODE .40, .35, "sampling rate " ;056 sampling rate TCODE .40, .35, "Divisor Temp " ;057 Divisor Temp TCODE .40, .35, "Divisor Decodat" ;058 Divisor Decodat - TCODE .40, .35, "Divisor NotUse1" ;059 Divisor NotUse1 + TCODE .40, .35, "Divisor GF " ;059 Divisor GF TCODE .40, .35, "Divisor ppO2 " ;060 Divisor ppO2 TCODE .40, .35, "Divisor Debug " ;061 Divisor Debug - TCODE .40, .35, "Divisor NotUse2" ;062 Divisor NotUse2 + TCODE .40, .35, "Divisor CNS " ;062 Divisor CNS TCODE .40, .35, "CNSshow dive[%]" ;063 CNSshow dive[%] TCODE .40, .35, "Logbook offset " ;064 Logbook offset TCODE .40, .35, "Last Deco at[m]" ;065 Last Deco at[m] @@ -391,7 +391,11 @@ TCODE .50, .130, "Aborted!" ;304 Aborted ;@5 variant TCODE .0, .0, "Future TTS" ;305 Future TTS (=10 chars. Title for @5 customview). +; + TCODE .100, .125, "Quit Sim" ;306 Quit Sim (=8char max. Quit Simulator mode) ;Dive interval - TCODE .20, .35, "Interval:" ;306 Interval: - TCODE .0, .0, "Now" ;307 Now + TCODE .20, .35, "Interval:" ;307 Interval: + TCODE .0, .0, "Now " ;308 Now (7 chars min) + TCODE .108, .112, "Average" ;309 Average + TCODE .94, .54, "Stopwatch" ;310 Stopwatch (BIG Stopwatch in Gauge mode) ;=============================================================================
--- a/code_part1/OSTC_code_asm_part1/french_text.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/french_text.asm Thu Jun 23 01:37:59 2011 +0200 @@ -97,7 +97,7 @@ ; 32 custom function descriptors I (FIXED LENGTH = 15 chars). TCODE .40, .35, "Début Plong.[m]" ;036 Start Dive [m] (depth to switch to dive mode) TCODE .40, .35, "Fin Plongée [m]" ;037 End Dive [m] (depth to switch back to surface mode) - TCODE .40, .35, "Délai Fin [min]" ;038 End Delay [min] (duration dive screen stays after end of dive) + TCODE .40, .35, "Délai Fin [sec]" ;038 End Delay [sec] (duration dive screen stays after end of dive) TCODE .40, .35, "Eteindre [min]" ;039 Power Off [min] TCODE .40, .35, "Pré-menu [min]" ;040 Pre-menu [min] (Delais to keep surface-mode menus displayed) TCODE .40, .35, "Vitesse [m/min]" ;041 velocity[m/min] @@ -118,10 +118,10 @@ TCODE .40, .35, "Freq. Mesures " ;056 sampling rate TCODE .40, .35, "Diviseur Temp. " ;057 Divisor Temp TCODE .40, .35, "Divis.Donn.Déco" ;058 Divisor Decodat - TCODE .40, .35, "Diviseur NotUse" ;059 Divisor NotUse1 + TCODE .40, .35, "Diviseur GF " ;059 Divisor GF TCODE .40, .35, "Diviseur ppO2 " ;060 Divisor ppO2 TCODE .40, .35, "Diviseur Debug " ;061 Divisor Debug - TCODE .40, .35, "Diviseur NotUse" ;062 Divisor NotUse2 + TCODE .40, .35, "Diviseur CNS " ;062 Divisor CNS TCODE .40, .35, "Aff.CNSPlong[%]" ;063 CNSshow dive[%] TCODE .40, .35, "Décalage Carnet" ;064 Logbook offset TCODE .40, .35, "Dern. Palier[m]" ;065 Last Deco at[m] @@ -392,7 +392,11 @@ TCODE .50, .130, "Aborted!" ;304 Aborted ;@5 variant TCODE .0, .0, "DTR Réchap" ;305 Future TTS (=10 chars. Title for @5 customview). +; + TCODE .100, .125, "Quit Sim" ;306 Quit Sim (=8char max. Quit Simulator mode) ;Dive interval - TCODE .20, .35, "Intervalle: " ;306 Interval: - TCODE .0, .0, "Maintenant" ;307 Dive now + TCODE .20, .35, "Intervalle: " ;307 Interval: + TCODE .0, .0, "Maintenant" ;308 Now (7 chars min) + TCODE .108, .112, "Moyenne" ;309 Average + TCODE .116, .54, "Chrono" ;310 Stopwatch (BIG Stopwatch in Gauge mode) ;=============================================================================
--- a/code_part1/OSTC_code_asm_part1/german_text.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/german_text.asm Thu Jun 23 01:37:59 2011 +0200 @@ -97,7 +97,7 @@ ; 32 custom function descriptors I (FIXED LENGTH = 15 chars). TCODE .40, .35, "TG Start [m]" ;036 Start Dive [m] (depth to switch to dive mode) TCODE .40, .35, "TG Ende [m]" ;037 End Dive [m] (depth to switch back to surface mode) - TCODE .40, .35, "TGNachlauf[min]" ;038 End Delay [min] (duration dive screen stays after end of dive) + TCODE .40, .35, "TGNachlauf[sek]" ;038 End Delay [sec] (duration dive screen stays after end of dive) TCODE .40, .35, "Standby [min]" ;039 Power Off [min] TCODE .40, .35, "Pre-Menü [min]" ;040 Pre-menu [min] (Delais to keep surface-mode menus displayed) TCODE .40, .35, "Geschw. [m/min]" ;041 velocity[m/min] @@ -118,10 +118,10 @@ TCODE .40, .35, "Abtastrate " ;056 sampling rate TCODE .40, .35, "Divisor Temp " ;057 Divisor Temp TCODE .40, .35, "Divisor Dekodat" ;058 Divisor Decodat - TCODE .40, .35, "Divisor frei1 " ;059 Divisor NotUse1 + TCODE .40, .35, "Divisor GF " ;059 Divisor GF TCODE .40, .35, "Divisor ppO2 " ;060 Divisor ppO2 TCODE .40, .35, "Divisor Debug " ;061 Divisor Debug - TCODE .40, .35, "Divisor frei2 " ;062 Divisor NotUse2 + TCODE .40, .35, "Divisor CNS " ;062 Divisor CNS TCODE .40, .35, "CNS-Anz. TG [%]" ;063 CNSshow dive[%] TCODE .40, .35, "Logbuch Versatz" ;064 Logbook offset TCODE .40, .35, "Letzte Deko [m]" ;065 Last Deco at[m] @@ -392,7 +392,11 @@ TCODE .40, .130, "Abgebrochen!" ;304 Aborted ;@5 variant TCODE .0, .0, "TTS @+Min." ;305 Future TTS (=10 chars. Title for @5 customview). +; + TCODE .100, .125, "Ende Sim" ;306 Quit Sim (=8char max. Quit Simulator mode) ;Dive interval - TCODE .20, .35, "Interval:" ;306 Interval: - TCODE .0, .0, "Now" ;307 Now + TCODE .20, .35, "Interval:" ;307 Interval: + TCODE .0, .0, "Jetzt " ;308 Now (7 chars min) + TCODE .109, .113, "D-Tiefe" ;309 Average + TCODE .109, .54, "Stopuhr" ;310 Stopwatch (BIG Stopwatch in Gauge mode) ;=============================================================================
--- a/code_part1/OSTC_code_asm_part1/i2c_eeprom.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/i2c_eeprom.asm Thu Jun 23 01:37:59 2011 +0200 @@ -18,8 +18,8 @@ ; known bugs: ; ToDo: use 2nd 32KB from external EEPROM for something -incf_eeprom_address macro ext_ee_temp1 ; Will increase eeprom_address:2 with the 8Bit value "ext_ee_temp1" and takes - movlw ext_ee_temp1 ; care of bank switching at 0x8000 +incf_eeprom_address macro ext_ee_temp1 ; Will increase eeprom_address:2 with the 8Bit value "ext_ee_temp1" + movlw ext_ee_temp1 call incf_eeprom_address0 endm @@ -27,18 +27,18 @@ addwf eeprom_address+0,F ; increase address movlw d'0' addwfc eeprom_address+1,F + return +; btfss eeprom_address+1,7 ; at address 8000? +; return ; No, continue +; +; ; Yes, clear eeprom_address:2 +; clrf eeprom_address+0 ; Clear eeprom address +; clrf eeprom_address+1 +; return ; Done. +; +;============================================================================= +; Will decrease eeprom_address:2 with the 8Bit value "ext_ee_temp1" - btfss eeprom_address+1,7 ; at address 8000? - return ; No, continue - - ; Yes, clear eeprom_address:2 - clrf eeprom_address+0 ; Clear eeprom address - clrf eeprom_address+1 - return ; Done. - -;============================================================================= -; Will decrease eeprom_address:2 with the 8Bit value "ext_ee_temp1" and takes -; care of bank switching at 0x8000 decf_eeprom_address macro ext_ee_temp1 movlw ext_ee_temp1 @@ -49,13 +49,14 @@ subwf eeprom_address+0,F ; decrease address: do a 16-8bits substract. movlw d'0' subwfb eeprom_address+1,F - - btfss eeprom_address+1,7 ; at address 8000? - return ; No, done. - - movlw b'01111111' ; yes, reset highbyte - movwf eeprom_address+1 - return ; Done. + return +; +; btfss eeprom_address+1,7 ; at address 8000? +; return ; No, done. +; +; movlw b'01111111' ; yes, reset highbyte +; movwf eeprom_address+1 +; return ; Done. ;============================================================================= @@ -72,15 +73,14 @@ addwf eeprom_address+0,F movlw d'0' addwfc eeprom_address+1,F - bcf eeprom_overflow - btfss eeprom_address+1,7 ; at address 8000? - return ; no, return - - clrf eeprom_address+0 ; Clear eeprom address - clrf eeprom_address+1 - bsf eeprom_overflow ; and set overflow bit return - +; btfss eeprom_address+1,7 ; at address 8000? +; return ; no, return +; +; clrf eeprom_address+0 ; Clear eeprom address +; clrf eeprom_address+1 +; return +; write_external_eeprom_block: ; Writes a block of 64Byte (one page in external EEPROM without stop condition #ifdef TESTING ; When Simulating with MPLabSIM, there is no way to emulate external EEPROM... @@ -96,20 +96,21 @@ movlw d'0' ; increase address incf eeprom_address+0,F addwfc eeprom_address+1,F - bcf eeprom_overflow - - btfss eeprom_address+1,7 ; at address 8000 - return ; no, return - - clrf eeprom_address+0 ; Clear eeprom address - clrf eeprom_address+1 - bsf eeprom_overflow ; and set overflow bit return + +; btfss eeprom_address+1,7 ; at address 8000 +; return ; no, return +; +; clrf eeprom_address+0 ; Clear eeprom address +; clrf eeprom_address+1 +; return I2CWRITE_BLOCK: movwf ext_ee_temp1 ; Data byte in WREG bsf SSPCON2,SEN ; Start condition rcall WaitMSSP - movlw b'10100110' ; Bit0=0: WRITE, Bit0=1: READ + movlw b'10101110' ; Bit0=0: WRITE, Bit0=1: READ, BLOCK2 + btfss eeprom_address+1,7 ; Access Block2? + movlw b'10100110' ; No, -> Bit0=0: WRITE, Bit0=1: READ, BLOCK1 movwf SSPBUF ; control byte rcall WaitMSSP rcall I2C_WaitforACK @@ -145,7 +146,9 @@ rcall WaitMSSP bsf SSPCON2,SEN ; Start condition rcall WaitMSSP - movlw b'10100110' ; Bit0=0: WRITE, Bit0=1: READ + movlw b'10101110' ; Bit0=0: WRITE, Bit0=1: READ, BLOCK2 + btfss ext_ee_temp2,7 ; Access Block2? + movlw b'10100110' ; No, -> Bit0=0: WRITE, Bit0=1: READ, BLOCK1 movwf SSPBUF ; control byte rcall WaitMSSP btfsc SSPCON2,ACKSTAT @@ -160,8 +163,10 @@ bsf SSPCON2,RSEN ; Start condition rcall WaitMSSP - movlw b'10100111' ; Bit0=0: WRITE, Bit0=1: READ - movwf SSPBUF ; control byte + movlw b'10101111' ; Bit0=0: WRITE, Bit0=1: READ, BLOCK2 + btfss ext_ee_temp2,7 ; Access Block2? + movlw b'10100111' ; No, -> Bit0=0: WRITE, Bit0=1: READ, BLOCK1 + movwf SSPBUF ; control byte rcall WaitMSSP rcall I2C_WaitforACK @@ -200,10 +205,16 @@ addwf ext_ee_temp1,F movlw d'0' addwfc ext_ee_temp2,F - - btfsc ext_ee_temp2,7 ; 0x8000 reached? + + movlw 0xFF + cpfseq ext_ee_temp2 ; =0xFFFF + bra get_free_EEPROM_location2d ; No + cpfseq ext_ee_temp1 ; =0xFFFF + bra get_free_EEPROM_location2d ; No + bra get_free_EEPROM_location3b ; yes - + +get_free_EEPROM_location2d: bsf SSPCON2, ACKEN ; no, send Ack rcall WaitMSSP bra get_free_EEPROM_location2 ; and continue search @@ -232,15 +243,14 @@ addwf eeprom_address+0,F movlw d'0' addwfc eeprom_address+1,F - bcf eeprom_overflow - btfss eeprom_address+1,7 ; at 0x8000? - return ; no, return - - clrf eeprom_address+0 ; Yes, clear address - clrf eeprom_address+1 - bsf eeprom_overflow ; and set overflow bit return - +; btfss eeprom_address+1,7 ; at 0x8000? +; return ; no, return +; +; clrf eeprom_address+0 ; Yes, clear address +; clrf eeprom_address+1 +; return +; I2CREAD3: ; block read start with automatic address increase rcall I2CREAD_COMMON ; no Stop condition here @@ -261,8 +271,11 @@ rcall WaitMSSP bsf SSPCON2,SEN ; Start condition rcall WaitMSSP - movlw b'10100110' ; Bit0=0: WRITE, Bit0=1: READ - movwf SSPBUF ; control byte + + movlw b'10101110' ; Bit0=0: WRITE, Bit0=1: READ, BLOCK2 + btfss eeprom_address+1,7 ; Access Block2? + movlw b'10100110' ; No, -> Bit0=0: WRITE, Bit0=1: READ, BLOCK1 + movwf SSPBUF ; control byte rcall WaitMSSP btfsc SSPCON2,ACKSTAT bra I2CREAD ; EEPROM NOT acknowledged, retry! @@ -275,8 +288,11 @@ bsf SSPCON2,RSEN ; Start condition rcall WaitMSSP - movlw b'10100111' ; Bit0=0: WRITE, Bit0=1: READ - movwf SSPBUF ; control byte + + movlw b'10101111' ; Bit0=0: WRITE, Bit0=1: READ, BLOCK2 + btfss eeprom_address+1,7 ; Access Block2? + movlw b'10100111' ; No, -> Bit0=0: WRITE, Bit0=1: READ, BLOCK1 + movwf SSPBUF ; control byte rcall WaitMSSP rcall I2C_WaitforACK @@ -290,8 +306,10 @@ movwf ext_ee_temp1 ; Data byte bsf SSPCON2,SEN ; Start condition rcall WaitMSSP - movlw b'10100110' ; Bit0=0: WRITE, Bit0=1: READ - movwf SSPBUF ; control byte + movlw b'10101110' ; Bit0=0: WRITE, Bit0=1: READ, BLOCK2 + btfss eeprom_address+1,7 ; Access Block2? + movlw b'10100110' ; No, -> Bit0=0: WRITE, Bit0=1: READ, BLOCK1 + movwf SSPBUF ; control byte rcall WaitMSSP rcall I2C_WaitforACK movff eeprom_address+1,SSPBUF ; High Address byte
--- a/code_part1/OSTC_code_asm_part1/interface.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/interface.asm Thu Jun 23 01:37:59 2011 +0200 @@ -142,11 +142,16 @@ DISPLAYTEXT .16 ; "Start" call get_free_EEPROM_location ; + movlw d'1' ; increase addwf eeprom_address+0,F movlw d'0' addwfc eeprom_address+1,F +;For debug only +;clrf eeprom_address+0,F +;clrf eeprom_address+1,F + DISPLAYTEXT .17 ; "Data" rcall send_internal_eeprom1 ; sends complete 1st. page of internal EEPROM @@ -167,14 +172,16 @@ DISPLAYTEXT .18 ; "Header" - clrf uart1_temp ; low address counter - clrf uart2_temp ; high address counter + setf uart1_temp ; low address counter + setf uart2_temp ; high address counter menu_interface3: bsf SSPCON2,SEN ; Start condition call WaitMSSP - movlw b'10100110' ; Bit0=0: WRITE, Bit0=1: READ + movlw b'10101110' ; Bit0=0: WRITE, Bit0=1: READ, BLOCK2 + btfss eeprom_address+1,7 ; Access Block2? + movlw b'10100110' ; No, -> Bit0=0: WRITE, Bit0=1: READ, BLOCK1 movwf SSPBUF ; control byte call WaitMSSP btfsc SSPCON2,ACKSTAT @@ -189,7 +196,10 @@ bsf SSPCON2,RSEN ; Start condition call WaitMSSP - movlw b'10100111' ; Bit0=0: WRITE, Bit0=1: READ + movlw b'10101111' ; Bit0=0: WRITE, Bit0=1: READ, BLOCK2 + btfss eeprom_address+1,7 ; Access Block2? + movlw b'10100111' ; No, -> Bit0=0: WRITE, Bit0=1: READ, BLOCK1 + movwf SSPBUF ; control byte call WaitMSSP call I2C_WaitforACK @@ -199,27 +209,21 @@ menu_interface2: call rs232_wait_tx ; wait for UART - bsf SSPCON2, RCEN ; Enable recieve mode - call WaitMSSP - - movff SSPBUF, TXREG - movlw d'1' addwf uart1_temp,F movlw d'0' addwfc uart2_temp,F - btfsc uart2_temp,7 ; 32KB done? - bra menu_interface4 ; Yes - - bsf SSPCON2, ACKEN ; Ack - call WaitMSSP - bra menu_interface2 ; go on +; Slow but safe... + call I2CREAD2 ; same as I2CREAD but with automatic address increase + movff SSPBUF, TXREG -menu_interface4: - bsf SSPCON2, PEN ; Stop - call WaitMSSP - + movlw 0xFF + cpfseq uart2_temp ;=0xFFFF? + bra menu_interface2 ; No, continue + cpfseq uart1_temp ;=0xFFFF? + bra menu_interface2 ; No, continue + DISPLAYTEXT .20 ; Done. WAITMS d'250'
--- a/code_part1/OSTC_code_asm_part1/isr.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/isr.asm Thu Jun 23 01:37:59 2011 +0200 @@ -176,17 +176,21 @@ ; timer1int: - bcf PIR1,TMR1IF ; Clear flag - timer1int_debug: bcf LED_red ; LEDr off (For charge indicator) + btfsc TMR1L,0 ; Wait for low clock cycle + bra $-2 + btfss TMR1L,0 ; Still high? + bra $-2 ; max. loop time: 61µs + movlw 0x08 ; Timer1 int after 62.5ms (=16/second) cpfslt TMR1H ; Did we miss a 1/16 second? incf timer1int_counter1,F ; Yes, add extra 1/16 second movlw 0x08 ; Timer1 int after 62.5ms (=16/second) subwf TMR1H,F + bcf PIR1,TMR1IF ; Clear flag incf timer1int_counter1,F ; Increase timer1 counter @@ -343,12 +347,17 @@ ; Increase re-setable average depth divetime counter incf average_divesecs+0,F ; increase stopwatch registers btfsc STATUS,Z - incf average_divesecs+1,F ; increase stopwatch registers - + incf average_divesecs+1,F ; increase stopwatch registers +; Increase total divetime (Regardless of CF01) + incf total_divetime_seconds+0,F ; increase stopwatch registers + btfsc STATUS,Z + incf total_divetime_seconds+1,F ; increase stopwatch registers + btfss divemode2 ; displayed divetime is running? bra RTCisr2 ; No (e.g. too shallow) - incf divesecs,F ; increase divetime registers +; increase divetime registers (Displayed dive time) + incf divesecs,F movlw d'59' cpfsgt divesecs bra RTCisr1a
--- a/code_part1/OSTC_code_asm_part1/menu_battery.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_battery.asm Thu Jun 23 01:37:59 2011 +0200 @@ -96,6 +96,7 @@ movff EEDATA,lo read_int_eeprom d'55' ; TEMP_min HIGH movff EEDATA,hi + call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required movlw d'3' movwf ignore_digits bsf leftbind ; left orientated output @@ -118,6 +119,7 @@ movff EEDATA,lo read_int_eeprom d'60' ; TEMP_max HIGH movff EEDATA,hi + call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required movlw d'3' movwf ignore_digits bsf leftbind ; left orientated output
--- a/code_part1/OSTC_code_asm_part1/menu_gassetup.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_gassetup.asm Thu Jun 23 01:37:59 2011 +0200 @@ -653,13 +653,14 @@ OUTPUTTEXT .96 ; Yes bsf second_FA ; Is first gas - movf decodata+0,W ; read current value - addlw d'28' ; offset in memory - movwf EEADR - call read_eeprom ; Low-value - clrf EEDATA ; Set change depth to zero - call write_eeprom ; save result in EEPROM - +; Do not reset change depth (Kind request from Pascal)! +; movf decodata+0,W ; read current value +; addlw d'28' ; offset in memory +; movwf EEADR +; call read_eeprom ; Low-value +; clrf EEDATA ; Set change depth to zero +; call write_eeprom ; save result in EEPROM +; bra menu_firstgas1 menu_firstgas0: @@ -902,10 +903,13 @@ cpfslt lo movwf lo ; limit to 99m + btfsc second_FA ; Is first gas? + clrf lo ; Yes, set to 0m + movf decodata+0,W ; read current value addlw d'28' ; offset in memory movwf EEADR - call read_eeprom ; Low-value +; call read_eeprom ; Low-value movff lo,EEDATA ; write result call write_eeprom ; save result in EEPROM
--- a/code_part1/OSTC_code_asm_part1/menu_logbook.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_logbook.asm Thu Jun 23 01:37:59 2011 +0200 @@ -71,14 +71,27 @@ ;---- fast loop: check every other byte ---------------------------------- menu_logbook2: - infsnz divemins+0,F ; increase 16Bit value - incf divemins+1,F - infsnz divemins+0,F ; increase 16Bit value, twice - incf divemins+1,F + movlw d'2' + addwf divemins+0,F + movlw d'0' + addwfc divemins+1,F ; increase 16Bit value, twice - btfsc divemins+1,7 ; At 0x8000? + movlw 0xFF + cpfseq divemins+1 ; =0xFFFF ? + bra menu_logbook2a ; No + cpfseq divemins+0 ; =0xFFFF ? + bra menu_logbook2a ; No bra menu_logbook_reset ; yes, restart (if not empty) +menu_logbook2a: + movlw 0x00 + cpfseq divemins+1 ; =0x0000 ? + bra menu_logbook2b ; No + cpfseq divemins+0 ; =0x0000 ? + bra menu_logbook2b ; No + bra menu_logbook_reset ; yes, restart (if not empty) + +menu_logbook2b: decf_eeprom_address d'2' ; -2 to eeprom address. call I2CREAD ; reads one byte (Slow! Better use Blockread!) @@ -124,6 +137,7 @@ bra menu_logbook3b ; No, Nothing to do bsf all_dives_shown ; Yes + bsf logbook_page_not_empty bra menu_logbook_display_loop2 ; rcall of get_free_eeprom_location not required here (faster) @@ -253,6 +267,9 @@ display_profile2: bcf logbook_profile_view ; clear flag for search routine + clrf average_divesecs+0 + clrf average_divesecs+1 ; holds amount of read samples + call PLED_display_wait_clear call PLED_standard_color WIN_TOP .0 @@ -313,6 +330,7 @@ call PLED_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 PUTC ' ' + PUTC 0x94 ; "End of dive" icon call I2CREAD2 ; hour movff SSPBUF,lo output_99x @@ -371,43 +389,51 @@ call mult16x16 ; result is in xC:2 ! bsf leftbind + PUTC 0x95 ; "duration o dive" icon output_16 ; divetime minutes -; Compute spacing between 10min lines - movff lo,xA+0 - movff hi,xA+1 ; divetime in minutes - movlw d'10' - movwf xB+0 - clrf xB+1 ; A vertical line every 10 minutes - call div16x16 ;xA/xB=xC with xA as remainder - ; xC now holds number of lines - movlw d'1' - addwf xC+0 ; Add one line... - movff xC+0,xB+0 - clrf xB+1 ; No more then 255 lines... - movlw d'159' ; Available width + movlw LOW d'600' movwf xA+0 - clrf xA+1 - call div16x16 ;xA/xB=xC with xA as remainder - ; xC now holds spacing between vertical 10min lines - movff xC+0,avr_rel_pressure+0 - movff xC+1,avr_rel_pressure+1 ; spacing between 10min lines (1-159) + movlw HIGH d'600' + movwf xA+1 ; A vertical line every 600 seconds + movff samplesecs_value,xB+0 ; Copy sampling rate + clrf xB+1 + call div16x16 ; xA/xB=xC with xA as remainder + movff xC+0,average_depth_hold_total+0 + movff xC+1,average_depth_hold_total+1 + ;average_depth_hold_total:2 holds interval of samples for vertical 10min line ; Restore divetime in minutes: + btfss logbook_format_0x21 ; Dive made with new 0x21 format? + bra display_profile_old_xscale ; No +; Yes, get real sample time + incf_eeprom_address d'35' ; Skip Bytes in EEPROM + call I2CREAD2 ; Total sample time in seconds + movff SSPBUF,xC+0 + call I2CREAD2 ; Total sample time in seconds + movff SSPBUF,xC+1 + decf_eeprom_address d'37' ; Macro, that subtracts 8Bit from eeprom_address:2 + PUTC ':' + call I2CREAD2 ; read divetime seconds + movff SSPBUF,lo + bra display_profile_xscale ; continue below + +display_profile_old_xscale: movff lo,xA+0 ; calculate x-scale for profile display movff hi,xA+1 ; calculate total diveseconds first movlw d'60' ; 60seconds are one minute... movwf xB+0 clrf xB+1 call mult16x16 ; result is in xC:2 ! - - PUTC d'39' ;"'" + PUTC ':' call I2CREAD2 ; read divetime seconds movff SSPBUF,lo movf lo,W ; add seconds to total seconds addwf xC+0 movlw d'0' addwfc xC+1 ; xC:2 now holds total dive seconds! + +display_profile_xscale: movff xC+0,xA+0 ; now calculate x-scale value movff xC+1,xA+1 movlw d'154' ; 154pix width available @@ -429,15 +455,16 @@ bsf leftbind output_99x ; divetime seconds - STRCAT "\" " + PUTC ' ' call I2CREAD2 movff SSPBUF,lo call I2CREAD2 - movff SSPBUF,hi + movff SSPBUF,hi ; Read min. Temperature + call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required movlw d'3' movwf ignore_digits bsf leftbind - output_16dp d'2' ; temperature + output_16dp d'2' ; temperature STRCAT_PRINT "°C" ; Display 2nd row of details WIN_TOP .50 @@ -449,9 +476,6 @@ call I2CREAD2 ; read Air pressure movff SSPBUF,hi -; movff lo,average_depth_hold+2 -; movff hi,average_depth_hold+3 ; Store here for correct average - bsf leftbind output_16 ; Air pressure before dive STRCAT "mbar " @@ -480,6 +504,7 @@ incf_eeprom_address d'12' ; Skip 12 Bytes in EEPROM (faster) (Gaslist) call I2CREAD2 ; Read start gas (1-5) movff SSPBUF,active_gas ; Store + movff active_gas,average_depth_hold_total+3 ; keep copy to restore color incf_eeprom_address d'5' ; Skip 5 Bytes in EEPROM (faster) (Battery, firmware) call I2CREAD2 ; Read divisor @@ -498,26 +523,22 @@ bcf divisor_deco,7 movff divisor_deco,logbook_temp2 ; Store as temp, too call I2CREAD2 ; Read divisor - movff SSPBUF,divisor_tank ; Store divisor + movff SSPBUF,divisor_gf ; Store divisor call I2CREAD2 ; Read divisor movff SSPBUF,divisor_ppo2 ; Store divisor call I2CREAD2 ; Read divisor movff SSPBUF,divisor_deco_debug ; Store divisor call I2CREAD2 ; Read divisor - movff SSPBUF,divisor_nuy2 ; Store divisor + movff SSPBUF,divisor_cns ; Store divisor incf_eeprom_address d'2' ; Skip 2Bytes in EEPROM (faster) ; 2 bytes salinity, GF + btfss logbook_format_0x21 ; 10byte extra? + bra display_profile2d ; No + incf_eeprom_address d'10' ; Skip another 10 byte from the header for 0x21 format + ; Average Depth, spare bytes display_profile2d: ; Start Profile display - -; clrf average_divesecs+0 -; clrf average_divesecs+1 ; Counts x-pixels for average -; clrf average_depth_hold_total+0 -; clrf average_depth_hold_total+1 -; clrf average_depth_hold_total+2 -; clrf average_depth_hold_total+3 ; Track average depth here... -; ; Write 0m X-Line.. movlw color_grey call PLED_set_color ; Make this configurable? @@ -556,20 +577,9 @@ movff WREG,win_height movlw d'1' movff WREG,win_width ; "Window" Width -display_profile2f: call PLED_box ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 - movff win_leftx2,WREG ; Get column - addwf avr_rel_pressure+0,W ; Add column interval distance to win_leftx2 - tstfsz avr_rel_pressure+1 ; >255? - movlw d'255' ; Yes, make win_leftx2>159 -> Abort here - btfsc STATUS,C ; A Cary from the addwf above? - movlw d'255' ; Yes, make win_leftx2>159 -> Abort here - movff WREG,win_leftx2 ; Result in win_leftx2 again - movff win_leftx2,lo ; Get win_leftx2 in Bank1... - movlw d'159' ; Limit - cpfsgt lo ; >159? - bra display_profile2f ; No, draw another line +; Draw frame around profile movlw color_blue WIN_FRAME_COLOR .75, .239, .4, .159 ;top, bottom, left, right with color in WREG @@ -866,6 +876,8 @@ btfss logbook_format_0x21 bra skip_new_format_0x21_info ; Do not show remaining info from dive +; Show all new 0x21 data +; Show average depth WIN_TOP .50 call I2CREAD2 ; Read average depth movff SSPBUF,lo @@ -875,8 +887,64 @@ output_16dp d'3' ; Average depth STRCAT_PRINT "m" -; WIN_TOP .0 -; WIN_LEFT .75 + incf_eeprom_address d'4' ; Skip total dive time and GF factors + call I2CREAD ; Read deco modell + decf_eeprom_address d'2' ; back to GF factos + + WIN_TOP .0 + WIN_LEFT .75 + + movff SSPBUF,lo + movlw d'3' + cpfsgt lo + bra logbook_show_sat + +; Show GF settings + call I2CREAD2 ; Read GF_lo + movff SSPBUF,hi + call I2CREAD2 ; Read GF_hi + movff SSPBUF,lo + STRCPY "GF:" + output_8 ; GF_hi + PUTC '/' + movff hi,lo ; copy GF_lo + output_8 ; GF_lo + call word_processor + bra logbook_deco_model ; Skip Sat + +logbook_show_sat: + call I2CREAD2 ; Read Saturation x + movff SSPBUF,hi + call I2CREAD2 ; Read Desaturation x + movff SSPBUF,lo + STRCPY "Sat:" + output_8 ; Sat x + STRCAT "%/" + movff hi,lo ; copy Desat x + output_8 ; Desat x + STRCAT_PRINT "%" + +logbook_deco_model: +; Show deco model + WIN_TOP .25 + call I2CREAD2 ; Read deco modell + movff SSPBUF,lo + lfsr FSR2,letter + incf lo,F ; +1 + dcfsnz lo,F ; ZH-L16 OC? + movlw d'101' ; Textnumber + dcfsnz lo,F ; Gauge? + movlw d'102' ; Textnumber + dcfsnz lo,F ; ZH-L16 CC? + movlw d'104' ; Textnumber + dcfsnz lo,F ; Apnoe? + movlw d'138' ; Textnumber + dcfsnz lo,F ; L16-GF OC? + movlw d'152' ; Textnumber + dcfsnz lo,F ; L16-GF CC? + movlw d'236' ; Textnumber + call displaytext0_low ; Outputs to POSTINC2 + call word_processor skip_new_format_0x21_info: bcf menubit2 @@ -939,7 +1007,48 @@ bra profile_display_fill_up2 return ; apnoe_mins and xC+0 are untouched -profile_view_get_depth: +profile_view_get_depth: + incf average_divesecs+0,F + movlw d'0' + addwfc average_divesecs+1,F ; Count read pixels + + movf average_divesecs+0,W + cpfseq average_depth_hold_total+0 + bra profile_view_get_depth_no_line ; no need to draw a 10min line, continue + movf average_divesecs+1,W + cpfseq average_depth_hold_total+1 + bra profile_view_get_depth_no_line ; no need to draw a 10min line, continue +; draw a new 10min line here... + clrf average_divesecs+0 + clrf average_divesecs+1 ; clear counting registers for next line + + movlw color_grey + call PLED_set_color ; Make this configurable? + movlw d'76' + movff WREG,win_top + incf timeout_counter3,W ; draw one line to right to make sure it's the background of the profile + movff WREG,win_leftx2 ; Left border (0-159) + movlw d'163' + movff WREG,win_height + movlw d'1' + movff WREG,win_width ; "Window" Width + call PLED_box ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 + +; Now restore current profile color + movff average_depth_hold_total+3,active_gas ; restore color + dcfsnz active_gas,F + movlw color_white ; Color for Gas 1 + dcfsnz active_gas,F + movlw color_green ; Color for Gas 2 + dcfsnz active_gas,F + movlw color_red ; Color for Gas 3 + dcfsnz active_gas,F + movlw color_yellow ; Color for Gas 4 + dcfsnz active_gas,F + movlw color_violet ; Color for Gas 5 + call PLED_set_color ; Set Color... + +profile_view_get_depth_no_line: call I2CREAD2 ; read first depth movff SSPBUF,lo ; low value call I2CREAD2 ; read first depth @@ -962,18 +1071,6 @@ return profile_view_get_depth_new1: -; incf average_divesecs+0,F -; movlw d'0' -; addwfc average_divesecs+1,F ; counter for average depth -; ; add depth to average registers -; movf lo,W -; addwf average_depth_hold_total+0,F -; movf hi,W -; addwfc average_depth_hold_total+1,F -; movlw d'0' -; addwfc average_depth_hold_total+2,F -; addwfc average_depth_hold_total+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar -; btfsc event_occured ; Was there an event attached to this sample? rcall profile_view_get_depth_new2 ; Yes, get information about this event @@ -999,6 +1096,7 @@ ; Stored Gas changed! call I2CREAD2 ; Read Gas# movff SSPBUF,active_gas ; store gas# + movff active_gas,average_depth_hold_total+3 ; keep copy to restore color after drawing 10min line decf timeout_counter2,F ; reduce counter dcfsnz active_gas,F movlw color_white ; Color for Gas 1 @@ -1018,7 +1116,6 @@ call PLED_set_color ; Set Color... return ;(The two bytes indicating the manual gas change will be ignored in the standard "ignore loop" above...) - ;Keep comments for future temperature graph ; call I2CREAD2 ; ignore byte ; decfsz timeout_counter2,F ; reduce counter @@ -1128,6 +1225,11 @@ cpfsgt lo ; Skip if lo>13 bra display_listdive2 ; use old (Pre 0x20) format + bsf logbook_format_0x21 ; Set flag for new 0x21 Format + movlw 0x21 + cpfseq lo ; Skip if 0x21 + bcf logbook_format_0x21 ; Clear flag for new 0x21 Format + call I2CREAD4 ; Skip Profile version (Block read) movff SSPBUF,lo ; in new format, read month @@ -1161,4 +1263,141 @@ output_16 ; Divetime minutes STRCAT_PRINT "'" ; Display header-row in list incf_eeprom_address d'37' ; 12 Bytes read from header, skip 37 Bytes in EEPROM (Remaining Header) + btfss logbook_format_0x21 ; 10byte extra? + return ; No, Done. + incf_eeprom_address d'10' ; Skip another 10 byte from the header for 0x21 format return + +logbook_convert_64k: ; Converts <1.91 logbook (32kB) to 64kB variant + call PLED_boot + call PLED_ClearScreen ; Clear screen + movlw color_red + call PLED_set_color ; Set to Red + DISPLAYTEXTH d'303' ; Please wait! + clrf EEADR + movlw d'1' + movwf EEADRH + movlw 0xAA + movwf EEDATA + call write_eeprom ; write 0xAA to indicate the logbook is already converted + clrf EEADRH ; Restore EEADRH +; convert logbook: +; Step 1: Copy 32k from 0xFE + 1 with bank switching to bank1 +; Step 2: Copy 32k from bank1 to bank0 +; Step 3: delete bank1 + call get_free_EEPROM_location ; Searches 0xFD, 0xFD, 0xFE and sets Pointer to 0xFE + rcall incf_eeprom_bank0 ; eeprom_address:2 now at 0xFE+1 +; Do Step 1: + ;logbook_temp5 and logbook_temp6 hold address in bank1 + ;logbook_temp1 and logbook_temp2 hold address in bank0 + movlw HIGH 0x8000 + movwf logbook_temp6 + movlw LOW 0x8000 + movwf logbook_temp5 ; load address for bank1 + movff eeprom_address+0,logbook_temp1 + movff eeprom_address+1,logbook_temp2 ; load address for bank0 + movlw 0x80 + movwf uart2_temp +logbook_convert2: + clrf uart1_temp ; counter for copy operation +logbook_convert3: + ; read source + movff logbook_temp1,eeprom_address+0 + movff logbook_temp2,eeprom_address+1 + call I2CREAD + movff SSPBUF,lo ; hold read value + rcall incf_eeprom_bank0 ; eeprom_address:2 +1 with bank switching + movff eeprom_address+0,logbook_temp1 + movff eeprom_address+1,logbook_temp2 ; write source address + ; write target + movff logbook_temp5,eeprom_address+0 + movff logbook_temp6,eeprom_address+1 + movf lo,W + call I2CWRITE ; writes WREG into EEPROM@eeprom_address + movlw d'1' + addwf logbook_temp5,F + movlw d'0' + addwfc logbook_temp6,F ; increase target address + decfsz uart1_temp,F + bra logbook_convert3 + btg LED_blue + decfsz uart2_temp,F ; 32kByte done? + bra logbook_convert2 ; No, continue +; Step 1 done. + bcf LED_blue +; Do Step 2: + movlw HIGH 0x0000 + movwf logbook_temp6 + movlw LOW 0x0000 + movwf logbook_temp5 ; load address for bank0 + movlw HIGH 0x8000 + movwf logbook_temp2 + movlw LOW 0x8000 + movwf logbook_temp1 ; load address for bank1 + movlw 0x80 + movwf uart2_temp +logbook_convert4: + clrf uart1_temp ; counter for copy operation +logbook_convert5: + ; read source + movff logbook_temp1,eeprom_address+0 + movff logbook_temp2,eeprom_address+1 + call I2CREAD + movff SSPBUF,lo ; hold read value + incf_eeprom_address d'1' + movff eeprom_address+0,logbook_temp1 + movff eeprom_address+1,logbook_temp2 ; write source address + ; write target + movff logbook_temp5,eeprom_address+0 + movff logbook_temp6,eeprom_address+1 + movf lo,W + call I2CWRITE ; writes WREG into EEPROM@eeprom_address + incf_eeprom_address d'1' + movff eeprom_address+0,logbook_temp5 + movff eeprom_address+1,logbook_temp6 ; write target address + decfsz uart1_temp,F + bra logbook_convert5 + btg LED_red + decfsz uart2_temp,F ; 32kByte done? + bra logbook_convert4 ; No, continue +; Step 2 done. + bcf LED_red +; Do Step 3: + movlw HIGH 0x8000 + movwf logbook_temp2 + movlw LOW 0x8000 + movwf logbook_temp1 ; load address for bank1 + movlw 0x80 + movwf uart2_temp +logbook_convert6: + clrf uart1_temp ; counter for copy operation +logbook_convert7: + ; write target + movff logbook_temp1,eeprom_address+0 + movff logbook_temp2,eeprom_address+1 + movlw 0xFF + call I2CWRITE ; writes WREG into EEPROM@eeprom_address + incf_eeprom_address d'1' + movff eeprom_address+0,logbook_temp1 + movff eeprom_address+1,logbook_temp2 ; write target address + decfsz uart1_temp,F + bra logbook_convert7 + btg LED_red + btg LED_blue + decfsz uart2_temp,F ; 32kByte done? + bra logbook_convert6 ; No, continue +; Step 3 done. + bcf LED_red + bcf LED_blue + return + +incf_eeprom_bank0: + movlw d'1' ; increase address + addwf eeprom_address+0,F + movlw d'0' + addwfc eeprom_address+1,F + btfss eeprom_address+1,7 ; at address 8000? + return ; no, skip + clrf eeprom_address+0 ; Clear eeprom address + clrf eeprom_address+1 + return \ No newline at end of file
--- a/code_part1/OSTC_code_asm_part1/menu_reset.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_reset.asm Thu Jun 23 01:37:59 2011 +0200 @@ -110,7 +110,7 @@ ; DEFAULT MIN MAX CF_DEFAULT CF_CENTI, d'100', d'50', d'250' ; dive_threshold 100cm CF_DEFAULT CF_CENTI, d'30', d'10', d'100' ; surf_threshold 30cm - CF_DEFAULT CF_SEC, d'240', d'30', d'240' ; diveloop_timeout 240s + CF_DEFAULT CF_INT15, d'240', d'0', d'600' ; diveloop_timeout 240s CF_DEFAULT CF_SEC, d'120', d'30', d'240' ; surfloop_timeout 120s CF_DEFAULT CF_SEC, d'5', d'1', d'30' ; premenu_timeout 5s @@ -135,11 +135,11 @@ CF_DEFAULT CF_INT8, d'10', d'1', d'120' ; sampling_rate 10s CF_DEFAULT CF_INT8, d'6', d'0', d'15' ; sampling_divisor_temp /6 CF_DEFAULT CF_INT8, d'6', d'0', d'15' ; sampling_divisor_deco /6 - CF_DEFAULT CF_INT8, d'0', d'0', d'15' ; sampling_divisor_tank never + CF_DEFAULT CF_INT8, d'6', d'0', d'15' ; sampling_divisor_gf /6 CF_DEFAULT CF_INT8, d'0', d'0', d'15' ; sampling_divisor_ppo2 never CF_DEFAULT CF_INT8, d'0', d'0', d'15' ; sampling_divisor_deco2 never - CF_DEFAULT CF_INT8, d'0', d'0', d'15' ; sampling_divisor_nyu2 never + CF_DEFAULT CF_INT8, d'12', d'0', d'15' ; sampling_divisor_cns /12 CF_DEFAULT CF_PERCENT, d'20', d'5', d'75' ; cns_display_high 20% CF_DEFAULT CF_INT15, d'0', d'0', 0 ; logbook_offset No Offset, but 15Bit value CF_DEFAULT CF_INT8, d'3', d'2', d'6' ; last_deco_depth 3m @@ -169,7 +169,7 @@ CF_DEFAULT CF_CENTI, d'161', d'100', d'161' ; color_warn_ppo2_cbar ppO2 warn CF_DEFAULT CF_INT8, d'15', d'7', d'20' ; color_warn_celocity_mmin warn at xx m/min - CF_DEFAULT CF_SEC+CF_NEG,d'42', -d'120',d'120' ; time_correction_value_default Adds to Seconds on Midnight + CF_DEFAULT CF_SEC+CF_NEG,d'0', -d'120' ,d'120' ; time_correction_value_default Adds to Seconds on Midnight CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF#49 Show Altimeter in surface mode CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF50 Show Log-Marker CF_DEFAULT CF_BOOL, d'1', 0, 0 ; CF51 Show Stopwatch @@ -451,18 +451,25 @@ ; Write the two bytes lo:hi into EEPROM reset_eeprom_value: incf EEADR,F - movff lo, EEDATA ; Lowbyte Defaul value - call write_eeprom + movff lo, EEDATA ; Lowbyte Default value + + movlw d'127' ; Work-around to prevent writing at EEPROM 0x00 to 0x04 + cpfslt EEADR ; EEADR > 127? + call write_eeprom ; Yes, write! incf EEADR,F movff hi, EEDATA ; Highbyte default value - goto write_eeprom + + movlw d'127' ; Work-around to prevent writing at EEPROM 0x00 to 0x04 + cpfslt EEADR ; EEADR > 127? + call write_eeprom ; Yes, write! + return reset_external_eeprom: ; deletes complete external eeprom! clrf eeprom_address+0 clrf eeprom_address+1 - movlw d'2' + movlw d'4' movwf temp3 reset_eeprom02: clrf temp4 @@ -482,7 +489,7 @@ decfsz temp4,F bra reset_eeprom01 ; do this 256 times decfsz temp3,F - bra reset_eeprom02 ; and this all 2 times -> 512 *64Bytes = 32KB + bra reset_eeprom02 ; and this all 4 times -> 1024 *64Bytes = 64KB bcf eeprom_blockwrite ; clear blockwrite flag
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm Thu Jun 23 01:37:59 2011 +0200 @@ -521,12 +521,12 @@ ;---- Updates interval line ---------------------------------------------- WIN_TOP .35 lfsr FSR2,letter - OUTPUTTEXTH .306 ; Interval: + OUTPUTTEXTH .307 ; Interval: movff char_I_dive_interval,lo movf lo,W bnz PLED_simulator_data_1 - OUTPUTTEXTH .307 ; Now + OUTPUTTEXTH .308 ; Now clrf POSTINC2 ; End buffer. bra PLED_simulator_data_2 @@ -865,6 +865,7 @@ WIN_TOP .177 STRCPY "temp:" SAFE_2BYTE_COPY temperature, lo + call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required output_16 call word_processor @@ -955,7 +956,7 @@ WIN_INVERT .1 ; Init new Wordprocessor DISPLAYTEXT .248 ; OSTC Simulator WIN_INVERT .0 ; Init new Wordprocessor - DISPLAYTEXTH .306 ; Interval: + DISPLAYTEXTH .307 ; Interval: DISPLAYTEXT .249 ; Start Dive DISPLAYTEXTH .277 ; Bottom Time: DISPLAYTEXTH .278 ; Max. Depth: @@ -975,18 +976,7 @@ movff last_temperature+1,hi movff last_temperature+0,lo lfsr FSR2,letter - - btfss hi,7 ; Negative temperature ? - bra PLED_temp_surfmode_1 ; No: continue - - PUTC '-' ; Display "-" - - comf hi ; Then, 16bit sign changes. - negf lo - btfsc STATUS,C - incf hi - -PLED_temp_surfmode_1: + call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required movlw d'3' movwf ignore_digits bsf leftbind ; left orientated output @@ -1011,18 +1001,7 @@ movff last_temperature+0,lo lfsr FSR2,letter - - btfss hi,7 ; Negative temperature ? - bra PLED_temp_divemode_1 ; No: continue - - PUTC '-' ; Display "-" - - comf hi ; Then, 16bit sign changes. - negf lo - btfsc STATUS,C - incf hi - -PLED_temp_divemode_1: + call PLED_convert_signed_temperature ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required movlw d'3' movwf ignore_digits bsf leftbind ; left orientated output @@ -1585,7 +1564,7 @@ movlw .039 cpfslt hi - bra depth_greater_99_84mtr + bra depth_greater_99_84mtr btfsc depth_greater_100m ; Was depth>100m during last call call PLED_clear_depth ; Yes, clear depth area @@ -1601,7 +1580,7 @@ movff lo,sub_b+0 incf sub_b+0,F movlw d'0' - addwfc sub_b+1,F ; Add 1mBar offset + addwfc sub_b+1,F ; Add 1mBar offset call sub16 ; sub_c = sub_a - sub_b btfss neg_flag ; Depth lower then 10m? rcall depth_less_10mtr ; Yes, add extra space @@ -1624,7 +1603,7 @@ bsf leftbind bsf ignore_digit4 - output_16 ; Full meters in Big font + output_16 ; Full meters in Big font bcf leftbind bra pled_depth3 @@ -1645,14 +1624,14 @@ STRCPY "." - movlw HIGH d'9' + movlw HIGH d'20' ; Display 0.0m if lower then 20cm movwf sub_a+1 - movlw LOW d'9' + movlw LOW d'20' movwf sub_a+0 movff hi,sub_b+1 movff lo,sub_b+0 call sub16 ; sub_c = sub_a - sub_b - btfss neg_flag ; Depth lower then 0.1m? + btfss neg_flag ; Depth lower then 0.3m? bra pled_depth4 ; Yes, display manual Zero movlw d'4' @@ -1907,6 +1886,17 @@ movwf wait_temp bra update_batt_voltage2a +PLED_convert_signed_temperature: + btfss hi,7 ; Negative temperature ? + return ; No, return +; Yes, negative temperature! + PUTC '-' ; Display "-" + comf hi ; Then, 16bit sign changes. + negf lo + btfsc STATUS,C + incf hi + return ; and return + PLED_convert_date: ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD) tstfsz EEDATA @@ -2232,6 +2222,57 @@ STRCAT_PRINT "m" return +PLED_stopwatch_show_gauge: + btfsc menubit ; Divemode menu active? + return ; Yes, return + ; BIG Stopwatch + call PLED_divemask_color ; Set Color for Divemode mask + DISPLAYTEXTH d'310' ; Stopwatch + DISPLAYTEXTH d'309' ; Average + call PLED_standard_color + ostc_debug 'V' ; Sends debug-information to screen if debugmode active + WIN_TOP .80 + WIN_LEFT .90 + WIN_FONT FT_MEDIUM + call PLED_standard_color + + lfsr FSR2,letter + movff average_divesecs+0,lo ; Stopwatch + movff average_divesecs+1,hi ; Stopwatch + movlw d'2' + subwf lo,F + movlw d'0' + subwfb hi,F ; Subtract 2 seconds + call convert_time ; converts hi:lo in seconds to mins (hi) and secs (lo) + movff lo,wait_temp + movff hi,lo + clrf hi + movlw d'0' + bcf leftbind + bsf show_last3 + output_16_3 ;Displays only 0...999 + PUTC ':' + movff wait_temp,lo + output_99x + call word_processor + + ostc_debug 'U' ; Sends debug-information to screen if debugmode active + WIN_TOP .136 + WIN_LEFT .90 + WIN_FONT FT_MEDIUM + call PLED_standard_color + lfsr FSR2,letter + movff avr_rel_pressure+0,lo + movff avr_rel_pressure+1,hi + call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar] + bsf ignore_digit5 ; do not display 1cm depth + output_16dp d'3' + bcf leftbind + STRCAT_PRINT "m" + WIN_FONT FT_SMALL ; Reset... + return + + PLED_total_average_show: ; Non-Resettable Average call PLED_divemask_color ; Set Color for Divemode mask @@ -2367,6 +2408,7 @@ DISPLAYTEXT .251 ; - 1m DISPLAYTEXT .252 ; +10m DISPLAYTEXT .253 ; -10m + DISPLAYTEXTH .306 ; Quit Sim return ;----------------------------------------------------------------------------- @@ -2696,7 +2738,7 @@ cpfseq hi ; All gases shown? bra PLED_gas_list_loop ; No - DISPLAYTEXT d'122' ; Gas 6.. + DISPLAYTEXT d'122' ; More return ; return (OC mode) PLED_splist_start: @@ -3097,8 +3139,7 @@ return PLED_const_ppO2_too_hi: - movlw '>' - movwf POSTINC2 ; Put ">" from WREG into buffer + PUTC '>' setf lo ; show ">2.55" clrf hi ; clear hi call PLED_warnings_color ; Set Warning color
--- a/code_part1/OSTC_code_asm_part1/simulator.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/simulator.asm Thu Jun 23 01:37:59 2011 +0200 @@ -24,10 +24,10 @@ ; ToDo: menu_simulator: - movlw d'1' - movwf logbook_temp1 ; Bottom time + movlw d'3' + 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 @@ -96,7 +96,8 @@ simulator_inc_interval: movff char_I_dive_interval,PRODL - incf PRODL,F + movlw .3 + addwf PRODL,F movlw .24*6 ; Max 24h delay. cpfslt PRODL clrf PRODL @@ -153,6 +154,7 @@ ; This override is done in ISR too, but do it right now also: movff sim_pressure+0,amb_pressure+0 movff sim_pressure+1,amb_pressure+1 + call comp_air_pressure0 ; Make sure to have depth in rel_pressure:2 bcf menubit2 bcf menubit3 @@ -343,7 +345,7 @@ bsf simulatormode_active ; normal simulator mode bsf standalone_simulator ; Standalone Simulator active bsf no_sensor_int ; Disable sensor interrupt - clrf T3CON ; Restart time3 counter, + clrf T3CON ; Disable timer3 counter, clrf TMR3L ; so the simu won't stop right away. clrf TMR3H
--- a/code_part1/OSTC_code_asm_part1/sleepmode.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/sleepmode.asm Thu Jun 23 01:37:59 2011 +0200 @@ -74,6 +74,8 @@ rcall pressuretest_sleep_fast ; Gets pressure without averaging (faster!) + SAFE_2BYTE_COPY amb_pressure_avg, amb_pressure ; copy for compatibility + call check_temp_extrema ; Check for temperature extremas call deco_calc_CNS_decrease_15min ; compute CNS decay in sleep only @@ -131,12 +133,12 @@ rcall pressuretest_sleep_fast ; Gets pressure without averaging (faster!) - ; compare current ambient pressure with threshold CF6==1160mbar. + ; compare current ambient pressure with threshold CF6==1160mbar. GETCUSTOM15 d'6' ; loads pressure threshold into lo,hi movff lo,sub_a+0 ; power on if ambient pressure is greater threshold movff hi,sub_a+1 - SAFE_2BYTE_COPY amb_pressure, sub_b - call sub16 ; Is (1160mbar - amb_pressure) < 0 ? + SAFE_2BYTE_COPY amb_pressure_avg, sub_b + call sub16 ; Is (1160mbar - averaged(amb_pressure)) < 0 ? bsf sleepmode btfsc neg_flag ; Wake up from Sleep? bcf sleepmode ; amb_pressure>pressure_offset_divemode: wake up! @@ -182,6 +184,8 @@ nop sleep ; Wait at least 35ms (every 16.5ms Timer1 wakeup) call get_pressure_value ; State2: Get pressure (51us) + clrf amb_pressure_avg+0 + clrf amb_pressure_avg+1 ; clear for sleep routine call calculate_compensation ; calculate temperature compensated pressure (233us) return
--- a/code_part1/OSTC_code_asm_part1/spanish_text.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/spanish_text.asm Thu Jun 23 01:37:59 2011 +0200 @@ -96,7 +96,7 @@ ; 32 custom function descriptors I (FIXED LENGTH = 15 chars). TCODE .40, .35, "Buceo Inic. [m]" ;036 Start Dive [m] (depth to switch to dive mode) TCODE .40, .35, "Buceo Fin. [m]" ;037 End Dive [m] (depth to switch back to surface mode) - TCODE .40, .35, "Retras Fin[min]" ;038 End Delay [min] (duration dive screen stays after end of dive) + TCODE .40, .35, "Retras Fin[sec]" ;038 End Delay [sec] (duration dive screen stays after end of dive) TCODE .40, .35, "Apagado [min]" ;039 Power Off [min] TCODE .40, .35, "Pre-menú [min]" ;040 Pre-menu [min] (Delais to keep surface-mode menus displayed) TCODE .40, .35, "Vel. [m/min]" ;041 velocity[m/min] @@ -117,10 +117,10 @@ TCODE .40, .35, "frec. muestreo " ;056 sampling rate TCODE .40, .35, "Divisor Temp " ;057 Divisor Temp TCODE .40, .35, "Divisor Datdeco" ;058 Divisor Decodat - TCODE .40, .35, "Divisor SinUso1" ;059 Divisor NotUse1 + TCODE .40, .35, "Divisor GF " ;059 Divisor GF TCODE .40, .35, "Divisor ppO2 " ;060 Divisor ppO2 TCODE .40, .35, "Divisor Depurac" ;061 Divisor Debug - TCODE .40, .35, "Divisor SinUso2" ;062 Divisor NotUse2 + TCODE .40, .35, "Divisor CNS " ;062 Divisor CNS TCODE .40, .35, "Mues.CNSbuc.[%]" ;063 CNSshow dive[%] TCODE .40, .35, "Despl. diario " ;064 Logbook offset TCODE .40, .35, "Ult. Deco a [m]" ;065 Last Deco at[m] @@ -391,7 +391,11 @@ TCODE .50, .130, "¡Aborta!" ;304 Aborted ;@5 variant TCODE .0, .0, "Futuro TTS" ;305 Future TTS (=10 chars. Title for @5 customview). +; + TCODE .100, .125, "SalirSim" ;306 Quit Sim (=8char max. Quit Simulator mode) ;Dive interval - TCODE .20, .35, "Interval:" ;306 Interval: - TCODE .0, .0, "Now" ;307 Now + TCODE .20, .35, "Interval:" ;307 Interval: + TCODE .0, .0, "Now " ;308 Now (7 chars min) + TCODE .100, .113, "Promedio" ;309 Average + TCODE .116, .54, "Crono." ;310 Stopwatch (BIG Stopwatch in Gauge mode) ;=============================================================================
--- a/code_part1/OSTC_code_asm_part1/start.asm Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/start.asm Thu Jun 23 01:37:59 2011 +0200 @@ -26,15 +26,7 @@ movlb b'00000001' ; ram bank 1 selected movff STKPTR,temp10 clrf temp10+1 - call init - - read_int_eeprom d'92' ; Read number of CF used in this firmware - movlw 0xFF ; First start value - cpfseq EEDATA ; Compare - bra start2 ; Normal power-on/hard reset boot - bra first_start ; Reset and jump to surfmode -start2: btfsc divemode ; Reset from Divemode? call PLED_resetdebugger ; Yes! Something went wrong, show reset informations start3: @@ -67,7 +59,8 @@ call pressuretest_sleep_fast ; Gets pressure without averaging (faster!) bcf sleepmode ; Normal mode again - SAFE_2BYTE_COPY amb_pressure, last_surfpressure + SAFE_2BYTE_COPY amb_pressure_avg, last_surfpressure + SAFE_2BYTE_COPY amb_pressure_avg, amb_pressure movff last_surfpressure+0,last_surfpressure_15min+0 movff last_surfpressure+1,last_surfpressure_15min+1 movff last_surfpressure+0,last_surfpressure_30min+0 @@ -102,9 +95,9 @@ movlb b'00000001' ; select ram bank 1 ; check firmware and reset Custom Functions after an update - movlw LOW 0x101 + movlw d'1' movwf EEADR - movlw HIGH 0x101 + movlw d'1' movwf EEADRH call read_eeprom ; read current version x movff EEDATA,temp1 @@ -123,9 +116,9 @@ bra restart ; x and y are equal -> do not reset cf check_firmware_new: - movlw LOW 0x101 ; store current version in EEPROM + movlw d'1' ; store current version in EEPROM movwf EEADR - movlw HIGH 0x101 + movlw d'1' movwf EEADRH movlw softwareversion_x movwf EEDATA @@ -135,9 +128,23 @@ movwf EEDATA call write_eeprom ; write version y clrf EEADRH ; Reset EEADRH - goto reset_all_cf ; resets all custom functions bank0 and bank1 and jumps to "restart" + +; Reset CF48 + movlw d'1' + movwf EEADRH ; EEPROM Bank1 + clrf EEDATA ; =0 + write_int_eeprom d'191' + write_int_eeprom d'192' + write_int_eeprom d'193' + write_int_eeprom d'194' ; Reset Default and Current Value to zero + clrf EEADRH +; goto reset_all_cf ; resets all custom functions bank0 and bank1 and jumps to "restart" restart: + movlw b'00000011' + movwf T3CON ; Timer3 with 32768Hz clock running + clrf TMR3L + clrf TMR3H bcf LED_red bcf LED_blue ; all LEDs off GETCUSTOM8 d'48' ; time correction value @@ -184,8 +191,13 @@ bsf high_altitude_mode ; No, Set Flag! ; Should we disable sleep (hardware emulator) - movlw .0 - cpfsgt EEDATA ; >256 +restart_loop: + btfss 0xF81,0,A + bra restart_loop + btfss 0xF81,1,A + bra restart_loop + movlw 0x80 + cpfslt 0xFB3,A bsf nsm ; NO-SLEEP-MODE : for hardware debugging call gassetup_sort_gaslist ; Sorts Gaslist according to change depth @@ -224,6 +236,16 @@ cpfseq EEDATA bcf debug_mode ; clear flag if <> 1 +; Check if logbook has been converted already (Internal EEPROM 0x100=0xAA) + movlw LOW 0x100 + movwf EEADR + movlw HIGH 0x100 + movwf EEADRH + call read_eeprom ; read byte + movlw 0xAA + cpfseq EEDATA ; is 0xAA already? + call logbook_convert_64k ; No, convert now (And write 0xAA to internal EEPROM 0x100) + goto surfloop ; Jump to Surfaceloop!
--- a/code_part1/OSTC_code_c_part2/p2_deco.c Fri Jun 10 01:14:38 2011 +0200 +++ b/code_part1/OSTC_code_c_part2/p2_deco.c Thu Jun 23 01:37:59 2011 +0200 @@ -989,14 +989,17 @@ { assert( 0 <= char_I_current_gas && char_I_current_gas <= (NUM_GAS+1) ); - if( (char_I_current_gas <= NUM_GAS) // Gas6 == manual set. - && char_I_deco_gas_change[char_I_current_gas-1] - ) + if( char_I_current_gas <= NUM_GAS ) // Gas1..Gas5 { - sim_gas_last_used = char_I_current_gas-1; - sim_gas_last_depth = char_I_deco_gas_change[sim_gas_last_used]; - // temp_depth_limit = ??? + sim_gas_last_used = char_I_current_gas; + + // Note: if current is first gas, we must find it, but not set + // last depth change to surface. + if( char_I_deco_gas_change[sim_gas_last_used-1] ) + sim_gas_last_depth = char_I_deco_gas_change[sim_gas_last_used-1]; } + else + sim_gas_last_used = 0; // Gas 6 = manual set } ////////////////////////////////////////////////////////////////////////////// @@ -1038,7 +1041,7 @@ if( switch_deco < deco_gas_change[j] ) { switch_deco = deco_gas_change[j]; - switch_last = j+1; + switch_last = j+1; // 1..5 } } } @@ -1083,7 +1086,7 @@ { assert( 0 <= sim_gas_last_used && sim_gas_last_used <= NUM_GAS ); - if( sim_gas_last_used == 0 ) + if( sim_gas_last_used == 0 ) // Gas6 = manualy set gas. { calc_N2_ratio = N2_ratio; calc_He_ratio = He_ratio;