Mercurial > public > hwos_code
changeset 629:237931377539
3.07 stable release
author | heinrichsweikamp |
---|---|
date | Fri, 29 Nov 2019 18:48:11 +0100 (2019-11-29) |
parents | cd58f7fc86db |
children | 4cd81bdbf15c |
files | src/adc_lightsensor.asm src/compass_ops.asm src/configuration.inc src/eeprom_rs232.asm src/eeprom_rs232.inc src/ghostwriter.asm src/hwos.asm src/hwos.inc src/isr.asm src/logbook.asm src/mcp.asm src/mcp.inc src/menu_tree.asm src/p2_deco.c src/sleepmode.asm src/start.asm src/surfmode.asm src/tft_outputs.asm |
diffstat | 18 files changed, 188 insertions(+), 192 deletions(-) [+] |
line wrap: on
line diff
--- a/src/adc_lightsensor.asm Thu Sep 19 12:01:29 2019 +0200 +++ b/src/adc_lightsensor.asm Fri Nov 29 18:48:11 2019 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File adc_lightsensor.asm combined next generation V3.03.5 +; File adc_lightsensor.asm combined next generation V3.06.1 ; ; ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. @@ -241,8 +241,7 @@ get_ambient_level1: ; using ambient sensor banksel isr_backup ; back to ISR default bank - movlw b'00000000' ; Vref+ = Vdd - movwf ADCON1 + clrf ADCON1 ; Vref+ = Vdd movlw b'00011101' ; power on ADC, select AN7 rcall wait_adc MOVII ADRESL,ambient_light @@ -486,7 +485,7 @@ banksel HW_variants ; switch to bank where OSTC model variant is stored btfsc analog_switches ; does the OSTC have analog switches? bra get_analog_switches_1 ; YES -get_analog_switches0: +get_analog_switches0: banksel common ; NO - back to bank common bcf analog_sw1_pressed ; - clear flag for analog switch 1 bcf analog_sw2_pressed ; - clear flag for analog switch 2 @@ -502,9 +501,7 @@ get_analog_switches_2: bsf adc_is_running - movlw b'00001010' ; left justified - movwf ADCON2 -; movlw b'00000000' ; Vref+ = Vdd + bcf ADCON2,ADFM ; left justified clrf ADCON1 movlw b'00100101' ; power on ADC, select AN9 rcall wait_adc @@ -614,8 +611,7 @@ bsf analog_sw1_pressed ; set right button as pressed get_analog_switches_4: - movlw b'10001010' ; restore to right justified - movwf ADCON2 + bsf ADCON2,ADFM ; restore to right justified bcf adc_is_running banksel common ; back to bank common btfsc analog_sw1_pressed ; right button pressed?
--- a/src/compass_ops.asm Thu Sep 19 12:01:29 2019 +0200 +++ b/src/compass_ops.asm Fri Nov 29 18:48:11 2019 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File compass_ops.asm combined next generation V3.03.5 +; File compass_ops.asm combined next generation V3.06.1 ; ; Compass Operations ; @@ -379,7 +379,6 @@ ;----------------------------------------------------------------------------- - global TFT_compass_fast TFT_compass_fast: WIN_TINY .0,.50 STRCPY "Cx:"
--- a/src/configuration.inc Thu Sep 19 12:01:29 2019 +0200 +++ b/src/configuration.inc Fri Nov 29 18:48:11 2019 +0100 @@ -1,7 +1,7 @@ #ifdef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ; ============================================================================ ; -; File configuration.inc combined next generation V3.04.3 +; File configuration.inc combined next generation V3.06.2 ; ; OSTC hwOS Configuration ; @@ -24,7 +24,7 @@ #endif #define softwareversion_x 0x03 -#define softwareversion_y 0x05 +#define softwareversion_y 0x07 #define softwareversion_beta 0x00 @@ -76,8 +76,8 @@ ; #endif -#define _language_1 en -#define _language_2 de +#define _language_1 fr +#define _language_2 it #ifdef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
--- a/src/eeprom_rs232.asm Thu Sep 19 12:01:29 2019 +0200 +++ b/src/eeprom_rs232.asm Fri Nov 29 18:48:11 2019 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File eeprom_rs232.asm combined next generation V3.04.3 +; File eeprom_rs232.asm combined next generation V3.06.2 ; ; Internal EEPROM, RS232 ; @@ -100,18 +100,17 @@ ;============================================================================= - IFDEF _external_sensor - global disable_ir_s8 disable_ir_s8: banksel TXSTA2 ; select bank for IO register access clrf TXSTA2 clrf RCSTA2 banksel common ; back to bank common - bcf ir_power ; IR off - bcf mcp_power ; power-down instrumentation amp - bsf s8_npower ; power-down S8 digital interface - bcf s8_digital_avail ; digital S8 interface not available + bcf PIE3,RC2IE ; disable RC2 INT + bcf ir_power ; IR off + bcf mcp_power ; power-down instrumentation amp + bsf s8_npower ; power-down S8 digital interface + bcf s8_digital_avail ; digital S8 interface not available return @@ -133,12 +132,13 @@ movwf RCSTA2 banksel common ; - back to bank common bsf ir_power ; - power-up IR - btfss ir_power - bra $-6 - return + btfss ir_power ; - power-up confirmed? + bra $-6 ; NO - loop and wait + bsf PIE3,RC2IE ; - enable RC2 INT + return ; - done enable_s8: - banksel TXSTA2 ; select bank for IO register access + banksel TXSTA2 ; select bank for IO register access clrf TXSTA2 clrf RCSTA2 banksel common ; back to bank common @@ -179,8 +179,6 @@ bsf s8_digital_avail ; digital S8 interface available return - ENDIF ; _external_sensor - ;============================================================================= global enable_rs232 @@ -332,7 +330,7 @@ ; Store last time/date ; Store 0x700 to 0x780 (pres_tissue_N2 and pres_tissue_He) movlw HIGH .512 ; =2 - movwf EEADRH + movwf EEADRH ; set EEPROM address, high byte ; indicate valid data in vault movlw 0xAA @@ -364,7 +362,7 @@ movff int_O_desaturation_time+1,EEDATA; get desaturation time, high byte write_int_eeprom .10 ; store value - SMOVII surface_interval,mpr ; ISR-safe copy of surface interval + SMOVII surface_interval_mins,mpr ; ISR-safe copy of surface interval movff mpr+0,EEDATA ; get surface interval, low byte write_int_eeprom .11 ; store value movff mpr+1,EEDATA ; get surface interval, high byte @@ -397,9 +395,9 @@ global restore_decodata_from_eeprom restore_decodata_from_eeprom: movlw LOW .512 ; =0 - movwf EEADR + movwf EEADR ; set EEPROM address, low byte movlw HIGH .512 ; =2 - movwf EEADRH + movwf EEADRH ; set EEPROM address, high byte ; restore date and time read_int_eeprom .1 @@ -430,7 +428,7 @@ movff EEDATA,mpr+0 ; cache value in mpr read_int_eeprom .12 ; read surface interval, high byte movff EEDATA,mpr+1 ; cache value in mpr - SMOVII mpr,surface_interval ; ISR-safe copy-back of surface interval + SMOVII mpr,surface_interval_mins ; ISR-safe copy-back of surface interval read_int_eeprom .13 ; read leading tissue's supersaturation movff EEDATA,int_O_lead_supersat+0 ; restore value @@ -452,8 +450,8 @@ incf EEADR,F decfsz lo,F ; all done? bra restore_decodata_from_eeprom2 ; NO - loop - clrf EEADRH ; YES - return + clrf EEADRH ; YES - revert EEPROM high address pointer to default + return ; - done ;=============================================================================
--- a/src/eeprom_rs232.inc Thu Sep 19 12:01:29 2019 +0200 +++ b/src/eeprom_rs232.inc Fri Nov 29 18:48:11 2019 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File eeprom_rs232.inc combined next generation V3.03.1 +; File eeprom_rs232.inc combined next generation V3.06.1 ; ; ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. @@ -26,19 +26,20 @@ extern rs232_wait_tx extern rs232_wait_tx2 - IFDEF _external_sensor extern enable_ir_s8 extern disable_ir_s8 - ENDIF extern write_int_eeprom_1 extern read_int_eeprom_1 extern read_eeprom extern write_eeprom + extern update_battery_registers extern retrieve_battery_registers + extern vault_decodata_into_eeprom extern restore_decodata_from_eeprom + extern do_logoffset_common_write extern do_logoffset_common_read extern eeprom_reset_logbook_pointers
--- a/src/ghostwriter.asm Thu Sep 19 12:01:29 2019 +0200 +++ b/src/ghostwriter.asm Fri Nov 29 18:48:11 2019 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File ghostwriter.asm combined next generation V3.03.7 +; File ghostwriter.asm combined next generation V3.06.2 ; ; Ghostwriter (Log profile recorder) ; @@ -1095,13 +1095,6 @@ call do_logoffset_common_write ; write incremented offset as the new offset change_logbook_offset2: - clrf mpr+0 ; prepare a 4 byte null value to clear the last dive time - clrf mpr+1 ; ... - clrf mpr+2 ; ... - clrf mpr+3 ; ... - SMOVFF mpr,lastdive_time ; ISR-safe 4 byte copy of null value to last dive time counter - - ; ISR-safe 3 byte copy of minutes:2 and seconds to last dive duration SMOVTT counted_divetime_mins,lastdive_duration
--- a/src/hwos.asm Thu Sep 19 12:01:29 2019 +0200 +++ b/src/hwos.asm Fri Nov 29 18:48:11 2019 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File hwos.asm combined next generation V3.03.7 +; File hwos.asm combined next generation V3.06.1 ; ; Definition of the hwOS dive computer platform. ; @@ -293,7 +293,7 @@ ; Timer 3 for IR-RX Timeout IFDEF _external_sensor clrf T3GCON ; reset Timer3 gate control register - movlw b'10001001' ; synced, 1:1 prescaler -> 2 seconds till overrun @ 32768 Hz, + movlw b'10001101' ; not synced, 1:1 prescaler -> 2 seconds till overrun @ 32768 Hz, ; incrementing by 1 bit each 30.51757813 µs movwf T3CON ENDIF @@ -336,7 +336,7 @@ ; Timer 5 for ISR-independent wait routines clrf T5GCON ; reset Timer5 gate control register - movlw b'10001011' ; synced, 16 bit mode, 1:1 prescaler -> 2 seconds till overrun @ 32768 Hz, + movlw b'10001111' ; not synced, 16 bit mode, 1:1 prescaler -> 2 seconds till overrun @ 32768 Hz, movwf T5CON ; incrementing by 1 bit each 30.51757813 µs @@ -344,7 +344,7 @@ ; Timer 7 for 62.5 ms Interrupt (sensor states) clrf T7GCON ; reset Timer7 gate control register - movlw b'10001001' ; 1:1 prescaler -> 2 seconds @ 32768 Hz, synced + movlw b'10001101' ; 1:1 prescaler -> 2 seconds @ 32768 Hz, not synced movwf T7CON clrf TMR7L movlw .248 @@ -387,7 +387,7 @@ movwf PIE2 movlw b'00000000' ; Bit1: TMR5 movwf PIE5 - movlw b'00100001' ; Bit0: RTCC, Bit5: UART2 + movlw b'00000001' ; Bit0: RTCC, Bit5: UART2 (Default OFF) movwf PIE3 movlw b'00001000' ; Bit3: TMR7 movwf PIE5
--- a/src/hwos.inc Thu Sep 19 12:01:29 2019 +0200 +++ b/src/hwos.inc Fri Nov 29 18:48:11 2019 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File hwos.inc combined next generation V3.04.3 +; File hwos.inc combined next generation V3.06.2 ; ; OSTC Platform Definitions ; @@ -906,8 +906,8 @@ ;---- other Timers uptime res 4 ; [sec] uptime of the OSTC since last cold start -lastdive_time res 4 ; [sec] time since last dive -surface_interval res 2 ; [min] surface interval +surface_interval_secs res 4 ; [sec] surface interval counted in seconds +surface_interval_mins res 2 ; [min] surface interval counted in minutes simulator_time res 1 ; [min] real runtime of the simulator ;---- Data for Pressure and Temperature Calculation (MS5541)
--- a/src/isr.asm Thu Sep 19 12:01:29 2019 +0200 +++ b/src/isr.asm Fri Nov 29 18:48:11 2019 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File isr.asm combined next generation V3.03.7 +; File isr.asm combined next generation V3.06.2 ; ; INTERUPT subroutines ; @@ -39,7 +39,8 @@ HighInt: ; initialize interrupt code banksel isr_backup ; default bank for all ISR code is bank ISR data - rcall isr_registers_backup ; back-up registers + movff PRODL,PROD_backup+0 ; back-up PRODL + movff PRODH,PROD_backup+1 ; back-up PRODH ; serve buttons btfsc PIR1,TMR1IF ; timer 1 interrupt (button hold-down timer)? rcall timer1int ; YES - reset timer @@ -54,9 +55,12 @@ rcall isr_uart2 ; YES - get a byte from the IR/S8 link btfsc PIR2,TMR3IF ; timer 3 interrupt? rcall isr_timer3 ; YES - check bytes received from IR/S8 link for being a valid telegram - ELSE - bcf PIR3,RC2IF ; Clear UART 2 interrupt? - bcf PIR2,TMR3IF ; Clear timer 3 interrupt? + ELSE + bcf PIR3,RC2IF ; clear UART 2 interrupt + bcf PIR2,TMR3IF ; clear timer 3 interrupt + ; fill-up to keep code size identical to _external_sensor variant, see "Attention" below + nop + nop ENDIF ; serve pressure and temperature sensor @@ -68,7 +72,8 @@ rcall isr_rtcc ; YES - do every 1/2 s tasks: read RTC, trigger timed tasks, adjust CPU speed, gauge battery, etc. ; clean up and exit - rcall isr_registers_restore ; restore registers + movff PROD_backup+0,PRODL ; restore PRODL + movff PROD_backup+1,PRODH ; restore PRODH bsf trigger_isr_updates ; signal that the ISR had kicked in retfie FAST ; return from interrupt restoring BSR, STATUS and WREG @@ -86,21 +91,17 @@ ;bra isr_set_speed_to_normal ; NO - default to normal speed isr_set_speed_to_normal: - movlw b'00000000' ; coding for x4 PLL disabled - movwf OSCTUNE ; switch off x4 PLL + clrf OSCTUNE ; switch off x4 PLL movlw b'01110010' ; select 16 MHz movwf OSCCON ; set prescaler movlw T2CON_NORMAL ; PWM1 dimming factor for speed 'normal' - movwf T2CON ; adjust PWM1 for LED dimming bra isr_adjust_speed_exit isr_set_speed_to_eco: - movlw b'00000000' ; coding for x4 PLL disabled - movwf OSCTUNE ; switch off x4 PLL + clrf OSCTUNE ; switch off x4 PLL movlw b'00110010' ; select 1 MHz movwf OSCCON ; set prescaler movlw T2CON_ECO ; PWM1 dimming factor for speed 'eco' - movwf T2CON ; adjust PWM1 for LED dimming bra isr_adjust_speed_exit isr_set_speed_to_fastest: @@ -108,20 +109,19 @@ btfsc lv_core ; on OSTC with low voltage core? movlw b'01100010' ; YES - reduce to 8 MHz movwf OSCCON ; set prescaler - movlw b'01000000' ; coding for x4 PLL enable - movwf OSCTUNE ; switch on x4 PLL -> 64 MHz on high voltage core, 32 MHz on low voltage core + bsf OSCTUNE,6 ; switch on x4 PLL -> 64 MHz on high voltage core, 32 MHz on low voltage core movlw T2CON_FASTEST ; PWM1 dimming factor for speed 'fastest' - movwf T2CON ; adjust PWM1 for LED dimming ;bra isr_adjust_speed_exit isr_adjust_speed_exit: + movwf T2CON ; adjust PWM1 for LED dimming btfss OSCCON,HFIOFS ; PLL stabilized? bra isr_adjust_speed_exit ; NO - loop to give it some more time return ; YES - done ; Attention: fill-up the gap between the end of this section ; and the next section which starts at 0x00080 !! - nop + ;nop block_0_code_end: ; marker to find end of code in block 0 in linker report file @@ -132,19 +132,6 @@ restore_flash_0x00080: goto restore_flash - -;============================================================================= -; back-up and restore registers -; -isr_registers_backup: - MOVII PRODL,PROD_backup ; back-up PRODH:PRODL - return - -isr_registers_restore: - MOVII PROD_backup,PRODL ; restore PRODH:PRODL - return - - ;============================================================================= ; routines for handling digital-attached external sensors ; @@ -404,8 +391,9 @@ rrcf pressure_abs_avg+1 ; divide by 2, again rrcf pressure_abs_avg+0 - ; copy into result register + ; copy into result register and set update flag MOVII pressure_abs_avg,pressure_abs +; bsf trigger_pres_update ; signal a pressure update ; build average for temperature bcf STATUS,C ; clear carry bit by default @@ -434,9 +422,8 @@ bsf trigger_temp_changed ; set flag for temperature change isr_sensor_state2_3: - ; reset state counter and set update flag + ; reset state counter clrf sensor_state_counter ; reset state counter -; bsf trigger_pres_update ; signal a pressure update btfss reset_max_pressure ; shall clear the max pressure? bra isr_sensor_state2_3a ; NO - continue with checking for pressure change bcf reset_max_pressure ; YES - clear request flag @@ -605,7 +592,7 @@ movwf rtc_year isr_rtcc_2: - ; get ambient light level and set max_CCPR1L + ; every full second - get ambient light level and set max_CCPR1L call get_ambient_level ; get ambient light level and set max_CCPR1L banksel isr_backup ; back to ISR default bank (for safety only) @@ -616,9 +603,14 @@ btfsc divemode ; in dive mode? rcall isr_divemode_1sec ; YES - do the every second dive mode tasks + ; increment surface interval counted in seconds btfsc divemode ; in dive mode? btfsc simulatormode ; YES - in simulator mode? - rcall isr_update_lastdive_time ; NO - YES - increment the last dive time + rcall inc_surface_interval_secs ; NO - YES - increment the surface interval (seconds timer) + + ; reset the surface interval timers if requested + btfsc reset_surface_interval ; shall reset both surface interval timers? + call clr_surface_interval ; YES ; reset the timebase if requested btfss reset_timebase ; shall reset the timebase? @@ -646,28 +638,29 @@ return ; NO - done ; new full minute - clrf timebase_secs ; YES - reset timer - bsf trigger_full_minute ; - set flag for a new minute has begun + clrf timebase_secs ; reset timer + bsf trigger_full_minute ; set flag for a new minute has begun - btfsc divemode ; - in dive mode? - btfsc simulatormode ; YES - in simulator mode? - rcall inc_surface_interval ; NO - YES - increment surface interval + ; increment surface interval counted in minutes + btfsc divemode ; in dive mode? + btfsc simulatormode ; YES - in simulator mode? + rcall inc_surface_interval_mins ; NO - YES - increment surface interval (minutes timer) - btfss simulatormode ; - in simulator mode? - bra isr_rtcc_4 ; NO - infsnz simulator_time,F ; YES - increment real runtime of the simulator, did wrap around (became zero)? - setf simulator_time ; YES - disallow wrap-around, keep at 255 instead + btfss simulatormode ; in simulator mode? + bra isr_rtcc_4 ; NO + infsnz simulator_time,F ; YES - increment real runtime of the simulator, did wrap around (became zero)? + setf simulator_time ; YES - disallow wrap-around, keep at 255 instead isr_rtcc_4: - incf timebase_mins,F ; - increment minutes timer - movlw .59 ; - max. for minutes timer - cpfsgt timebase_mins ; - minutes timer > max.? - return ; NO - done + incf timebase_mins,F ; increment minutes timer + movlw .59 ; max. for minutes timer + cpfsgt timebase_mins ; minutes timer > max.? + return ; NO - done ; new full hour - clrf timebase_mins ; YES - reset timer - bsf trigger_full_hour ; - set flag for a new hour has begun - return ; - done + clrf timebase_mins ; YES - reset timer + bsf trigger_full_hour ; - set flag for a new hour has begun + return ; - done ; increment overall OSTC uptime @@ -679,14 +672,6 @@ addwfc uptime+3,F return - ; increment time since last dive, called every second when not in dive mode (or when in simulator mode) -isr_update_lastdive_time: - incf lastdive_time+0,F - clrf WREG - addwfc lastdive_time+1,F - addwfc lastdive_time+2,F - addwfc lastdive_time+3,F - return ; process the timeout timer isr_update_timeout: @@ -786,15 +771,15 @@ isr_divemode_1sec_2: INCI total_divetime_secs ; increase total dive time (regardless of start_dive_threshold) btfss count_divetime ; shall the dive time be counted (regarding start_dive_threshold)? - bra isr_divemode_1sec_4 ; NO (too shallow / apnoe at surface) + bra isr_divemode_1sec_4 ; NO - too shallow / apnoe at surface incf counted_divetime_secs,F ; YES - increase dive time (displayed dive time) movlw d'59' ; - 60 seconds make a minute cpfsgt counted_divetime_secs ; - next full minute reached? - bra isr_divemode_1sec_3 ; NO - done + bra isr_divemode_1sec_3 ; NO - continue clrf counted_divetime_secs ; YES - reset seconds to 0 INCI counted_divetime_mins ; - increase dive minutes bsf divetime_longer_1min ; - set flag for dive time exceeding 1 minute - ;bra isr_divemode_1sec_3 ; - done + ;bra isr_divemode_1sec_3 ; - continue isr_divemode_1sec_3: ; submerged btfss FLAG_apnoe_mode ; in apnoe mode? @@ -831,13 +816,6 @@ return ; - done - - - - -isr_divemode_1sec_3_dive: - - ;============================================================================= ; BCD to Binary conversion ; Input WREG = value in BCD @@ -932,29 +910,46 @@ ;============================================================================= -; Increment surface interval (counted in minutes) while still in desaturation +; Increment surface interval (counted in minutes and in seconds) ; ; int_O_desaturation_time is only computed while in start, surface mode, -; menue_tree or ghostwriter. So the ISR may clock surface_interval past -; the actual surface interval time. But TFT_surface_lastdive will check -; int_O_desaturation_time and in case int_O_desaturation_time is zero it -; will not show surface_interval but lastdive_time instead. Thus the glitch -; will remain invisible. +; menue_tree or ghostwriter. So the ISR may clock surface_interval_mins +; past the actual surface interval time. But TFT_surface_lastdive will +; check int_O_desaturation_time and in case int_O_desaturation_time is +; zero it will not show surface_interval_mins but surface_interval_secs instead. +; Thus the glitch will remain invisible. ; -inc_surface_interval: ; called every minute when not in dive mode (in banksel common context) - btfsc reset_surface_interval ; shall reset the surface interval timer? - bra inc_surface_interval_1 ; YES - movff int_O_desaturation_time+0,isr_lo ; NO - check desaturation time - movff int_O_desaturation_time+1,WREG - iorwf isr_lo,W ; - inclusive-or low & high byte, desaturation time = 0 ? - bz inc_surface_interval_1 ; YES - reset surface interval timer - INCI surface_interval ; NO - increment surface interval - return ; - done -inc_surface_interval_1: - bcf reset_surface_interval ; reset request flag - CLRI surface_interval ; reset surface interval timer + +inc_surface_interval_secs: ; called every second when not in dive mode + incf surface_interval_secs+0,F ; increment the lowest byte + clrf WREG ; clear WREG + addwfc surface_interval_secs+1,F ; add carry from byte before, if it did wrap-around + addwfc surface_interval_secs+2,F ; add carry from byte before, if it did wrap-around + addwfc surface_interval_secs+3,F ; add carry from byte before, if it did wrap-around return ; done +inc_surface_interval_mins: ; called every minute when not in dive mode + movff int_O_desaturation_time+0,isr_lo ; get desaturation time, low byte + movff int_O_desaturation_time+1,WREG ; get desaturation time, high byte + iorwf isr_lo,W ; inclusive-or low & high byte, desaturation time = 0 ? + bz clr_surface_interval_mins ; YES - reset surface interval minutes counter + INCI surface_interval_mins ; NO - increment surface interval + return ; - done + +clr_surface_interval: + bcf reset_surface_interval ; reset request flag + ; clear the surface interval counted in seconds + clrf surface_interval_secs+0 ; reset surface interval (seconds), lowest byte + clrf surface_interval_secs+1 ; ... + clrf surface_interval_secs+2 ; ... + clrf surface_interval_secs+3 ; reset surface interval (seconds), highest byte +clr_surface_interval_mins: + ; clear the surface interval counted in minutes + movff opt_diveTimeout,surface_interval_mins+0 ; set surface interval (minutes), low byte, to dive timeout offset + clrf surface_interval_mins+1 ; reset surface interval (minutes), high byte + + return ; done + ;============================================================================= END
--- a/src/logbook.asm Thu Sep 19 12:01:29 2019 +0200 +++ b/src/logbook.asm Fri Nov 29 18:48:11 2019 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File logbook.asm combined next generation V3.03.5 +; File logbook.asm combined next generation V3.06.1 ; ; Logbook ; @@ -51,8 +51,8 @@ profile_temp1:2 ; temp for profile display profile_temp2:2 ; temp for profile display logbook_sample_counter:2 ; amount of read samples - y_scale:2 ; y-scale (The horizontal lines) - x_scale:2 ; x-scale (The vertical lines) + y_scale:2 ; y-scale (the horizontal lines) + x_scale:2 ; x-scale (the vertical lines) logbook_pixel_x_pos ; x2 position of current pixel in X-direction logbook_min_temp_pos ; lowest row in the temp graph logbook_max_temp_pos ; lowest row in the temp graph @@ -66,7 +66,7 @@ vertical_interval:2 ; holds interval of samples for vertical 10min line backup_color1 ; used for restoring drawing color backup_color2 ; used for restoring drawing color - backup_divedata ; used to backup depth and salinity + salinity ; salinity during the dive fill_between_rows ; used for fill between rows logbook_temp ; used as temp logbook_temp_backup ; used as backup for temp @@ -761,7 +761,7 @@ setf logbook_cur_tp+0 ; initialize Tp°, before the first recorded point setf logbook_cur_tp+1 clrf logbook_last_tp ; also reset previous Y for Tp° - clrf logbook_ceiling ; Ceiling = 0, correct value for no ceiling + clrf logbook_ceiling ; ceiling = 0, correct value for no ceiling movlw profile_top+.1 movwf logbook_min_temp_pos ; initialize for displaying the lowest temperature movlw profile_top+profile_height_pixels @@ -836,7 +836,7 @@ movf logbook_cur_tp+0,W ; did we had already a valid Tp°C record? andwf logbook_cur_tp+1,W incf WREG - bz profile_display_skip_temp ; NO - just skip drawing. + bz profile_display_skip_temp ; NO - just skip drawing movlw LOW (((profile_height_pixels-.10)*.256)/.370) ; fixed tp° scale: (-2 .. +35°C * scale256 )/153pix movwf xB+0 @@ -857,14 +857,14 @@ sublw profile_top+profile_height_pixels-.10 ; upside-down: Y = .75 + (.153 - result) movwf xC+0 - ; Check limits + ; check limits movlw profile_top+.1 movwf xC+1 cpfsgt xC+0 movff xC+1,xC+0 - movlw color_orange - call TFT_set_color + movlw color_orange ; select color for temperature curve + call TFT_set_color ; set color movf logbook_last_tp,W ; do we have a valid previous value? bz profile_display_temp_1 ; NO - skip the vertical line @@ -1026,7 +1026,7 @@ cpfslt win_leftx2 ; limit left border to 130 movwf win_leftx2 WIN_FONT FT_TINY - movlw color_orange ; use same color as tp° curve + movlw color_yellow ; changed from color_orange to color_yellow for better readability call TFT_set_color MOVII logbook_min_tp,mpr @@ -1537,27 +1537,30 @@ logbook_page2_1: ; Salinity - WIN_SMALL .5,.140 + WIN_SMALL .5,.165 ; ex WIN_SMALL .5,.140 LOG_POINT_TO log_salinity STRCPY_TEXT tDvSalinity bsf leftbind call ext_flash_byte_read_plus ; read salinity movff ext_flash_rw,lo - movff ext_flash_rw,backup_divedata ; backup for average depth display + movff ext_flash_rw,salinity ; store salinity for later use output_8 STRCAT_PRINT "%" ; Average depth - WIN_SMALL .5,.165 + WIN_SMALL .5,.140 ; ex WIN_SMALL .5,.165 STRCPY_TEXT tAVG LOG_POINT_TO log_avr_depth call ext_flash_byte_read_plus ; read average low movff ext_flash_rw,lo call ext_flash_byte_read_plus ; read average high movff ext_flash_rw,hi - movf backup_divedata,W ; salinity for this dive - call adjust_depth_with_salinity_log ; compute salinity setting (FROM WREG!) into lo:hi [mbar] - output_16dp .3 + movf salinity,W ; salinity for this dive + call adjust_depth_with_salinity_log ; compute salinity into lo:hi [mbar] + bsf ignore_digit5 ; no cm (flag will be cleared by output_16) + movlw .1 ; no 1000 meters + movwf ignore_digits ; ... + output_16dp .3 ; xxx.y STRCAT_PRINT "m" btfss aux_flag ; dive done in a deco mode? @@ -1814,15 +1817,23 @@ output_99x ; minute STRCAT_PRINT "" ; display 1st row of details + ; Get salinity for this dive + LOG_POINT_TO log_salinity + call ext_flash_byte_read_plus ; read salinity + movff ext_flash_rw,salinity ; store salinity + ; Show max depth and dive time WIN_SMALL .5,.35 STRCAT "Max:" LOG_POINT_TO log_max_depth - call ext_flash_byte_read_plus ; read max depth + call ext_flash_byte_read_plus ; read max depth, low byte movff ext_flash_rw,lo - call ext_flash_byte_read_plus ; read max depth + call ext_flash_byte_read_plus ; read max depth, high byte movff ext_flash_rw,hi + movf salinity,W ; salinity for this dive + call adjust_depth_with_salinity_log ; compute salinity setting into lo:hi [mbar] + TSTOSS opt_units ; 0=Meters, 1=Feets bra logbook_page2_depth_metric ; 1 - do metric ; 0 - do imperial
--- a/src/mcp.asm Thu Sep 19 12:01:29 2019 +0200 +++ b/src/mcp.asm Fri Nov 29 18:48:11 2019 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File mcp.asm combined next generation V3.03.1 +; File mcp.asm combined next generation V3.06.1 ; ; Basic routines for RX circuity ; @@ -17,8 +17,6 @@ ;============================================================================= - IFDEF _external_sensor - global mcp_sleep mcp_sleep: bcf INTCON3,INT3IE ; disable INT3 @@ -27,8 +25,6 @@ bra $-6 ; NO - loop waiting return ; YES - done - ENDIF - ;============================================================================= END
--- a/src/mcp.inc Thu Sep 19 12:01:29 2019 +0200 +++ b/src/mcp.inc Fri Nov 29 18:48:11 2019 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File mcp.inc combined next generation V3.03.1 +; File mcp.inc combined next generation V3.06.1 ; ; ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. @@ -9,7 +9,4 @@ ; 2012-09-03 : [mH] creation - IFDEF _external_sensor extern mcp_sleep ; power down IR receiver - ENDIF -
--- a/src/menu_tree.asm Thu Sep 19 12:01:29 2019 +0200 +++ b/src/menu_tree.asm Fri Nov 29 18:48:11 2019 +0100 @@ -546,10 +546,14 @@ ENDIF do_settings_menu: + IFDEF _hwos_sport + bsf ble_available ; For very old OSTC sport + ENDIF + btfsc ble_available ; BLE available? bra do_settings_menu_ble ; YES - - MENU_BEGIN tSystSets, .5 + + MENU_BEGIN tSystSets, .5 MENU_CALL tInfoMenu, do_info_menu MENU_CALL tSetTimeDate, do_date_time_menu MENU_CALL tDispSets, do_dispsets_menu
--- a/src/p2_deco.c Thu Sep 19 12:01:29 2019 +0200 +++ b/src/p2_deco.c Fri Nov 29 18:48:11 2019 +0100 @@ -1,5 +1,5 @@ // *************************************************************************** -// p2_deco.c combined next generation V3.04.3 +// p2_deco.c combined next generation V3.06.1 // // Created on: 12.05.2009 // Author: heinrichs weikamp, contributions by Ralph Lembcke and others @@ -1973,7 +1973,7 @@ real_pres_tissue_He[ci] = 0.0; // He real_pres_tissue_N2[ci] = N2_equilibrium; // N2 - // reset tissue pressures for scaled for tissue graphics + // reset tissue pressures for scaled tissue graphics char_O_tissue_pres_He[ci] = 0; // He char_O_tissue_pres_N2[ci] = 10; // N2 char_O_tissue_pressure[ci] = 10; // combined
--- a/src/sleepmode.asm Thu Sep 19 12:01:29 2019 +0200 +++ b/src/sleepmode.asm Fri Nov 29 18:48:11 2019 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File sleepmode.asm combined next generation V3.03.6 +; File sleepmode.asm combined next generation V3.06.1 ; ; Sleep Mode ; @@ -23,7 +23,7 @@ #include "i2c.inc" #include "mcp.inc" #include "wait.inc" -#include "tft_outputs.inc" +#include "tft_outputs.inc" extern vault_decodata_into_eeprom @@ -74,10 +74,8 @@ bsf sleepmode ; flag being in sleep mode bsf block_sensor_interrupt ; suspend ISR from executing sensor interrupts - IFDEF _external_sensor call disable_ir_s8 ; power-down IR/S8 interrupts call mcp_sleep ; power-down RX power supply - ENDIF clrf ADCON0 ; power-down ADC module call disable_rs232 ; power-down USB @@ -176,6 +174,8 @@ btfsc battery_gauge_available ; is a battery gauge IC available? bra one_sec_sleep_1 ; YES - check for charger + btfsc ble_available ; Skip "USB" check in all Bluetooth models (Required for very old OSTC sport) + bra one_sec_sleep_2 ; - continue btfsc vusb_in ; NO - USB plugged in? bcf sleepmode ; YES - terminate sleep mode bra one_sec_sleep_2 ; - continue @@ -387,15 +387,15 @@ btfsc charge_in_sleep ; already showing charge screen? bra sleepmode_sleepwalk ; YES - skip the actual sleep (But wait) - banksel T7GCON ; switch bank, T7* is outside access RAM - clrf T7GCON ; reset timer7 gate control register - movlw b'10001101' ; 1:1 prescaler -> 2 seconds @ 32768 Hz, not synced - movwf T7CON +; banksel T7GCON ; switch bank, T7* is outside access RAM +; clrf T7GCON ; reset timer7 gate control register +; movlw b'10001101' ; 1:1 prescaler -> 2 seconds @ 32768 Hz, not synced +; movwf T7CON sleep sleep - clrf T7GCON ; reset timer7 gate control register - movlw b'10001001' ; 1:1 prescaler -> 2 seconds @ 32768 Hz, synced - movwf T7CON +; clrf T7GCON ; reset timer7 gate control register +; movlw b'10001001' ; 1:1 prescaler -> 2 seconds @ 32768 Hz, synced +; movwf T7CON sleepmode_sleep_1: movff BSR_backup,BSR ; restore BSR return
--- a/src/start.asm Thu Sep 19 12:01:29 2019 +0200 +++ b/src/start.asm Fri Nov 29 18:48:11 2019 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File start.asm combined next generation V3.04.3 +; File start.asm combined next generation V3.06.1 ; ; Startup subroutines ; @@ -160,6 +160,8 @@ ; 15 minutes sampling buffer into the reference buffer from where it is loaded by the ISR rcall sample_surface_pressure ; 1st pass rcall sample_surface_pressure ; 2nd pass + + ; wait until initial surface pressure value has been loaded into the ISR btfsc update_surface_pressure ; has the ISR confirmed loading of the surface pressure? bra $-2 ; NO - not yet, loop until ISR has confirmed loading @@ -170,9 +172,9 @@ ; restore tissue pressures from EEPROM (if available) movlw HIGH .512 ; =2 movwf EEADRH ; set EEPROM address, high byte - read_int_eeprom .0 - clrf EEADRH - movlw 0xAA ; coding for tissue pressures available + read_int_eeprom .0 ; read tissue storage information flag + clrf EEADRH ; revert EEPROM high address pointer to default + movlw 0xAA ; load coding for tissue pressures available cpfseq EEDATA ; tissue pressures available? bra start_1 ; NO - no tissue pressures available call restore_decodata_from_eeprom ; YES - reload tissue pressures from EEPROM @@ -504,11 +506,12 @@ global restart_set_modes_and_flags restart_set_modes_and_flags: call option_restore_all ; restore all options settings from EEPROM + call disable_ir_s8 ; switch off IR/S8 digital interface by default (for all compile versions!) IFDEF _external_sensor - call disable_ir_s8 ; switch off IR/S8 digital interface by default - WAITMS d'100' ; Some delay to power down S8-HUD properly + WAITMS d'100' ; some delay to power down S8-HUD properly ENDIF + ; setup sampling rate movlw .2 ; default to 2 seconds movwf sampling_rate ; write setting
--- a/src/surfmode.asm Thu Sep 19 12:01:29 2019 +0200 +++ b/src/surfmode.asm Fri Nov 29 18:48:11 2019 +0100 @@ -491,8 +491,9 @@ btfsc screen_dump_avail ; YES - screen dump enabled? return ; YES - no COMM mode to be able to make screen shots of the menu and simulator mode ENDIF + btfss ble_available ; Skip "USB" check in all Bluetooth models (Required for very old OSTC sport) goto comm_mode_usb ; YES / NO - proceed to COMM mode, will also set CPU to speed normal - + return global reset_timeout_surfmode reset_timeout_surfmode:
--- a/src/tft_outputs.asm Thu Sep 19 12:01:29 2019 +0200 +++ b/src/tft_outputs.asm Fri Nov 29 18:48:11 2019 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File tft_outputs.asm next combined generation V3.04.3 +; File tft_outputs.asm next combined generation V3.06.2 ; ; high-level Display Outputs ; @@ -4619,7 +4619,7 @@ iorwf mpr+1,W ; inclusive-or with high byte, check if desaturation time is zero bz TFT_surface_lastdive_1 ; YES - show last dive time ; NO - show surface interval - SMOVII surface_interval,mpr ; - ISR-safe copy of surface interval + SMOVII surface_interval_mins,mpr ; - ISR-safe copy of surface interval in minutes call convert_time ; - convert hi:lo in minutes to hours (up:hi) and minutes (lo) movf hi,W ; - swap hi and lo movff lo,hi ; ... @@ -4632,7 +4632,7 @@ STRCAT_PRINT "m " ; bra TFT_surface_lastdive_2 ; TFT_surface_lastdive_1: - SMOVFF lastdive_time,xC ; ISR-safe copy of lastdive_time:4 to xC:4 + SMOVFF surface_interval_secs,xC ; ISR-safe copy of surface_interval_secs:4 to xC:4 call info_menu_uptime_com ; use part of info_menu_uptime to convert and display in days and hours TFT_surface_lastdive_2: WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row+(surf_gaslist_spacing*.1) @@ -4646,6 +4646,7 @@ TFT_surface_lastdive_3: WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row+(surf_gaslist_spacing*.2) MOVII lastdive_maxdepth,mpr + call adjust_depth_with_salinity ; compute (current) salinity setting into hi:lo [mbar] bsf leftbind ; print without leading spaces TSTOSS opt_units ; 0=Meter, 1=Feet bra TFT_surface_lastdive_metric ; 0 - metric @@ -4656,6 +4657,7 @@ TFT_surface_lastdive_4: WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row+(surf_gaslist_spacing*.3) MOVII lastdive_avgdepth,mpr + call adjust_depth_with_salinity ; compute (current) salinity setting into hi:lo [mbar] bsf leftbind ; print without leading spaces TSTOSS opt_units ; 0=Meter, 1=Feet bra TFT_surface_metric ; 0 - metric and return