# HG changeset patch # User heinrichsweikamp # Date 1603960155 -3600 # Node ID 8c1f1f334275a220e052667281b88f90a7b9f2b5 # Parent 0ff82370991d12acff776343f9958427c46d09c1 3.13 release diff -r 0ff82370991d -r 8c1f1f334275 src/adc_lightsensor.asm --- a/src/adc_lightsensor.asm Mon Aug 10 15:34:38 2020 +0200 +++ b/src/adc_lightsensor.asm Thu Oct 29 09:29:15 2020 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File adc_lightsensor.asm * combined next generation V3.09.4e +; File adc_lightsensor.asm * combined next generation V3.11.1 ; ; ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. @@ -66,10 +66,10 @@ bcf LEDr ; switch off red LED bcf TRISJ,2 ; activate Chrg-Out output bsf CHRG_OUT ; start charger - nop ; Ignore some noise - nop - nop - nop + nop ; ignore some noise + nop ; ... + nop ; ... + nop ; ... btfss CHRG_IN ; charging? bra charge_cc_active ; YES - charging in CC mode bcf CHRG_OUT ; NO - stop charger @@ -256,7 +256,7 @@ btfsc sleepmode ; in sleep mode? return ; YES - done btfsc adc_is_running ; NO - ADC in use? - return ; YES - return + return ; YES - abort banksel HW_descriptor ; NO - select bank where hardware descriptor is stored btfsc ambient_sensor ; - ambient sensor available? bra get_ambient_level1 ; YES - use sensor @@ -283,19 +283,6 @@ ; ambient_light:2 is between 4096 (direct sunlight) and about 200 (darkness) ; first: divide by 16 - ; bcf STATUS,C ; old /16 code - ; rrcf ambient_light+1 - ; rrcf ambient_light+0 - ; bcf STATUS,C - ; rrcf ambient_light+1 - ; rrcf ambient_light+0 - ; bcf STATUS,C - ; rrcf ambient_light+1 - ; rrcf ambient_light+0 - ; bcf STATUS,C - ; rrcf ambient_light+1 - ; rrcf ambient_light+0 - movlw .4 ; divide by 2^4 = 16 get_ambient_level1_loop: bcf STATUS,C ; clear carry @@ -318,11 +305,6 @@ movwf ambient_light+0 ; avoid ADC clipping get_ambient_level2: -; movlw .10 -; subwf ambient_light+0,F ; subtract 10 (ADC Offset) -; btfsc STATUS,N -; movwf ambient_light+0 ; avoid clipping - movff opt_brightness,isr_lo ; get brightness setting btfsc RCSTA1,7 ; UART module on? @@ -330,13 +312,12 @@ incf isr_lo,F ; adjust 0-2 to 1-3 - movlw ambient_light_max_high_cr ; cR and 2 hardware brightest setting - - banksel HW_descriptor ; select bank where hardware descriptor and model variant is stored - btfss battery_gauge_available - movlw ambient_light_max_high_15V ; 1.5V battery brightest setting + banksel HW_descriptor ; select bank where hardware descriptor and model variant are stored + movlw ambient_light_max_high_cr ; default to cR and 2 hardware brightest setting + btfss battery_gauge_available ; battery gauge available? + movlw ambient_light_max_high_15V ; NO - change to 1.5V battery brightest setting btfsc battery_is_36v ; 3.6V battery in use? - movlw ambient_light_max_high_36V ; YES - 3.6V battery brightest setting + movlw ambient_light_max_high_36V ; YES - change to 3.6V battery brightest setting banksel isr_backup ; back to ISR default bank dcfsnz isr_lo,F ; eco setting? @@ -375,9 +356,12 @@ global get_analog_inputs get_analog_inputs: bsf adc_is_running ; =1: the ADC is in use + btfsc screen_type3 ; display 3 ? + bra get_analog_inputs2 ; yes, skip here btfsc TFT_PWM ; PWM active? bra get_analog_inputs ; YES - wait for PWM low +get_analog_inputs2: movlw b'00100000' ; 2.048V Vref+ -> 1 LSB = 500 µV movwf ADCON1 ; ... @@ -527,6 +511,10 @@ bra get_analog_switches0 ; YES - abort (and clear both flags) get_analog_switches_2: + ; reset the latch register in case it's externally pulled down. mH This is a test + bsf power_sw1 ; switch on power supply for switch 1 + bsf power_sw2 ; switch on power supply for switch 2 + bsf adc_is_running ; flag that ADC is in use bcf ADCON2,ADFM ; left justified clrf ADCON1 ; diff -r 0ff82370991d -r 8c1f1f334275 src/comm.asm --- a/src/comm.asm Mon Aug 10 15:34:38 2020 +0200 +++ b/src/comm.asm Thu Oct 29 09:29:15 2020 +0100 @@ -246,8 +246,9 @@ comm_command_error: WIN_SMALL comm_status4_column, comm_status4_row ; select font and output position FONT_COLOR_WARNING ; set warning color - STRCPY_PRINT "Parameter Error" ; print failure message + STRCPY_PRINT "Unknown Parameter" ; print failure message FONT_COLOR_MEMO ; back to standard color + bra comm_service_exit ; abort ;bra comm_drain_rx_queue ; continue with draining the RX queue diff -r 0ff82370991d -r 8c1f1f334275 src/configuration.inc --- a/src/configuration.inc Mon Aug 10 15:34:38 2020 +0200 +++ b/src/configuration.inc Thu Oct 29 09:29:15 2020 +0100 @@ -1,7 +1,7 @@ #ifdef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ; ============================================================================ ; -; File configuration.inc * combined next generation V3.09.5 +; File configuration.inc * combined next generation V3.12.3 ; ; OSTC hwOS Configuration ; @@ -24,7 +24,7 @@ #endif #define fw_version_major 0x03 -#define fw_version_minor 0x0B +#define fw_version_minor 0x0D #define fw_version_beta 0x00 @@ -43,12 +43,12 @@ #endif #define firmware_creation_year 0x14 -#define firmware_creation_month 0x05 -#define firmware_creation_day 0x19 +#define firmware_creation_month 0x0A +#define firmware_creation_day 0x1C -#define firmware_expire_year 0x15 -#define firmware_expire_month 0x02 -#define firmware_expire_day 0x01 +#define firmware_expire_year 0x16 +#define firmware_expire_month 0x0A +#define firmware_expire_day 0x1C #ifdef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx @@ -64,7 +64,7 @@ ; 122.880 max. available #endif -#define _hwos_tech_2_TR +#define _hwos_tech_3_cR #ifdef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx @@ -79,8 +79,8 @@ ; #endif -#define _language_1 en -#define _language_2 none +#define _language_1 de +#define _language_2 en #ifdef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx @@ -98,6 +98,7 @@ ; _rx_update RX firmware update (OSTC TR) mem: + 2.282 byte (dependent on RX firmware size) ; _gas_contingency auto-switch to alternative tanks on depleption mem: + 804 byte ; _cave_mode cave mode return calculation mem: + 3.035 byte +; _big_divemenu big font dive menu -- UNDER DEVELOPMENT YET ; _firmware_recovery means for backing up and restoring 2nd firmware mem: + 472 byte ; _min_depth_option resettable min. and max. depth mem: + 4 byte ## special user group only ## ; _screendump screen dump function mem: + 348 byte ## special user group only ## @@ -125,6 +126,7 @@ #define NOT_INCLUDED_gas_contingency #define NOT_INCLUDED_external_sensor #define NOT_INCLUDED_cave_mode +#define NOT_INCLUDED_big_divemenu #define NOT_INCLUDED_firmware_recovery #define NOT_INCLUDED_min_depth_option #define NOT_INCLUDED_screendump @@ -144,6 +146,7 @@ #define _gas_contingency #define NOT_INCLUDED_external_sensor #define NOT_INCLUDED_cave_mode +#define NOT_INCLUDED_big_divemenu #define _firmware_recovery #define NOT_INCLUDED_min_depth_option #define NOT_INCLUDED_screendump @@ -163,6 +166,7 @@ #define _gas_contingency #define NOT_INCLUDED_external_sensor #define _cave_mode +#define NOT_INCLUDED_big_divemenu #define _firmware_recovery #define NOT_INCLUDED_min_depth_option #define NOT_INCLUDED_screendump @@ -182,9 +186,10 @@ #define _external_sensor #define _gas_contingency #define NOT_INCLUDED_cave_mode +#define NOT_INCLUDED_big_divemenu #define _firmware_recovery #define NOT_INCLUDED_min_depth_option -#define NOT_INCLUDED_screendump +#define _screendump #endif @@ -201,6 +206,7 @@ #define _external_sensor #define _gas_contingency #define _cave_mode +#define NOT_INCLUDED_big_divemenu #define _firmware_recovery #define NOT_INCLUDED_min_depth_option #define NOT_INCLUDED_screendump @@ -220,6 +226,7 @@ #define _rx_update #define NOT_INCLUDED_external_sensor #define NOT_INCLUDED_cave_mode +#define NOT_INCLUDED_big_divemenu #define _firmware_recovery #define NOT_INCLUDED_min_depth_option #define NOT_INCLUDED_screendump diff -r 0ff82370991d -r 8c1f1f334275 src/divemenu_tree.asm --- a/src/divemenu_tree.asm Mon Aug 10 15:34:38 2020 +0200 +++ b/src/divemenu_tree.asm Thu Oct 29 09:29:15 2020 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File divemenu_tree.asm * combined next generation V3.09.5 +; File divemenu_tree.asm * combined next generation V3.12.3 ; ; OSTC dive mode menu ; @@ -149,7 +149,7 @@ main_divemenu_pscr_sensors: MENU_BEGIN_DIVE .6 MENU_CALL tDiveBailout, do_divemode_gaslist_bail - MENU_CALL tCCRSensor, do_divemode_setpoint_pscr + MENU_CALL tCCRModeSensor, do_divemode_setpoint_pscr MENU_CALL tDivemenu_Premix, do_divemode_gaslist MENU_CALL tDivemenu_Avg_Mkr, do_reset_avg_set_mkr MENU_DYNAMIC dyn_toggle_gf, do_toggle_gf @@ -172,9 +172,9 @@ ; do_switch_sp_calc: bcf warn_det_sensors_lost ; clear fallback condition (revoke all sensors lost warning) - clrf WREG ; switch to fixed SP - movff WREG,opt_ccr_mode ; =0: Fixed SP (CCR) / calculated (pSCR), =1: Sensor, =2: Auto SP - movff WREG,char_I_const_ppO2 ; set setpoint to 0, this forces deco engine to take the computed ppO2 + clrf dive_ccr_mode ; switch to fixed SP + clrf WREG ; set setpoint to 0, this forces deco engine to take the computed ppO2 + movff WREG,char_I_const_ppO2 ; ... bra do_switch_sp_com ; continue with common part ENDIF ; _ccr_pscr @@ -526,7 +526,7 @@ do_divemode_splist: bsf short_gas_descriptions ; do not show "SP" etc. movlw .1 ; default to first menu item - movff opt_ccr_mode,lo ; get CCR mode (0: Fixed SP, 1: Sensor, 2: Auto SP) + movff dive_ccr_mode,lo ; get CCR mode (0: Fixed SP, 1: Sensor, 2: Auto SP) dcfsnz lo,F ; mode = sensor ? movlw .6 ; YES - load menu item number for 'sensor' btfsc warn_det_sensors_lost ; all sensors lost? @@ -541,12 +541,13 @@ ENDIF ; _external_sensor do_divemode_splist_no_sensor: - MENU_BEGIN_DIVE .5 + MENU_BEGIN_DIVE .6 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp + MENU_CALL tCCRModeAutoSP, do_switch_auto MENU_END @@ -559,7 +560,7 @@ MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_switch_sp - MENU_CALL tCCRSensor, do_divemode_sensor + MENU_CALL tCCRModeSensor, do_divemode_sensor MENU_END ENDIF ; _external_sensor @@ -583,8 +584,19 @@ call transmit_setpoint ; transmit current setpoint from WREG (in cbar) to external electronics ENDIF bcf warn_det_sensors_lost ; clear fallback condition (revoke all sensors lost warning) - clrf WREG ; switch to fixed SP - movff WREG,opt_ccr_mode ; =0: Fixed SP (CCR) / calculated (pSCR), =1: Sensor, =2: Auto SP + clrf dive_ccr_mode ; switch to fixed SP + bra do_switch_sp_com ; continue with common part + + +;----------------------------------------------------------------------------- +; Call Function - switch to Auto-SP (CCR) +; +do_switch_auto: + movff opt_setpoint_cbar+0,char_I_const_ppO2 ; selected 1st setpoint + bcf warn_det_sensors_lost ; clear fallback condition + movlw .2 ; switch to auto SP + movwf dive_ccr_mode ; =0: fixed SP (CCR) / calculated (pSCR), =1: Sensor, =2: auto SP + bsf restart_auto_sp ; restart auto SP selection ;bra do_switch_sp_com ; continue with common part @@ -595,7 +607,7 @@ bsf event_occured ; set global event byte bsf event_SP_change ; set setpoint event flag - ; Clear some flags in case we were in bailout before... + ; clear some flags in case we were in bailout before... bcf bailout_mode ; end bailout mode bcf better_gas_available ; =1: a better gas is available and a gas change is advised in dive mode bcf better_dil_available ; =1: a better diluent is available and a gas change is advised in dive mode @@ -658,7 +670,7 @@ ; do_switch_sensor: movlw .1 ; switch to sensor (0: fixed/ calculated SP, 1: Sensor, 2: AutoSP) - movff WREG,opt_ccr_mode ; ... + movwf dive_ccr_mode ; ... ; check for external HUD/ppO2 Monitor btfss ext_input_optical ; do we have an optical input? diff -r 0ff82370991d -r 8c1f1f334275 src/divemode.asm --- a/src/divemode.asm Mon Aug 10 15:34:38 2020 +0200 +++ b/src/divemode.asm Thu Oct 29 09:29:15 2020 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File divemode.asm * combined next generation V3.09.5 +; File divemode.asm * combined next generation V3.12.3 ; ; Dive Mode ; @@ -311,12 +311,6 @@ call div16x16 ; xC = xA / xB = depth in full meters movff xC+0,depth_meter ; store result as depth in [m], only low byte needed - IFDEF _ccr_pscr - ; adjust auto-setpoint - btfsc FLAG_ccr_mode ; in CCR mode? - call check_dive_autosp ; YES - check for Auto-SP - ENDIF - ; check for new max pressure btfss trigger_pres_max_changed ; has the max pressure changed? bra diveloop_loop_4 ; NO - continue with tasks every 1/1 second @@ -327,6 +321,12 @@ diveloop_loop_4: ; continue tasks every 1/1 second + IFDEF _ccr_pscr + ; adjust auto-setpoint + btfsc FLAG_ccr_mode ; in CCR mode? + call check_dive_autosp ; YES - check for Auto-SP + ENDIF + IFDEF _external_sensor btfsc FLAG_ccr_mode ; in CCR mode? rcall calc_deko_divemode_sensor ; YES - process sensor readings @@ -1161,7 +1161,7 @@ ; it will be overwritten if we have a usable sensor reading btfsc bailout_mode ; check if we are in bailout bra check_sensor_vote ; YES - no sensor data transfer to char_I_const_ppO2 in this case - movff opt_ccr_mode,WREG ; NO - get mode (0: Fixed SP, 1: Sensor, 2: Auto SP) + movf dive_ccr_mode,W ; NO - get mode (0: Fixed SP, 1: Sensor, 2: Auto SP) sublw .1 ; - in sensor mode? bnz check_sensor_vote ; NO - not in sensor mode - no transfer of sensor data to char_I_const_ppO2 tstfsz xB+0 ; YES - check if we have found at least one usable sensor @@ -1207,7 +1207,7 @@ check_warn_sensor_0: ; we are in CCR or pSCR mode btfsc bailout_mode ; check if we are in bailout bra check_warn_sensor_done ; YES - no warning in this case - movff opt_ccr_mode,WREG ; get mode (0: Fixed SP, 1: Sensor, 2: Auto SP) + movf dive_ccr_mode,W ; get mode (0: Fixed SP, 1: Sensor, 2: Auto SP) sublw .1 ; in sensor mode? bnz check_warn_sensor_done ; NO - not in sensor mode - no warning in this case @@ -1805,10 +1805,10 @@ call menuview_toggle_reset ; YES - terminate the pre-menu timeout_divemode_2: + INCI dive_timeout_timer ; increment timeout timer + btfss divetime_longer_1min ; does the dive already last for longer than one minute? - return ; NO - suspend timeout - - INCI dive_timeout_timer ; increment timeout timer + bra timeout_divemode_sub_1min ; NO - use a short timeout to achieve some extra hysteris when starting the dive btfsc FLAG_apnoe_mode ; in apnoe mode? bra timeout_divemode_apnoe ; YES - use apnoe timeout @@ -1829,6 +1829,10 @@ MOVLI simulator_timeout,sub_a ; get simulator timeout in seconds directly into sub_a bra timeout_divemode_com_sec ; continue with common part for seconds +timeout_divemode_sub_1min: + MOVLI divetime_less_1min_timeout,sub_a ; use a short timeout as an extra hysteresis during the descent + bra timeout_divemode_com_sec ; continue with common part for seconds + timeout_divemode_com_min: mullw .60 ; multiply with 60 to convert minutes in WREG to seconds MOVII PRODL,sub_a ; copy resulting seconds to sub_a @@ -1953,9 +1957,9 @@ check_dive_modes_shallow: bcf count_divetime ; stop counting dive time - btfss divetime_longer_1min ; diving > one minute? - bcf divemode ; NO - quit dive mode as this was no real dive - return ; done +; btfss divetime_longer_1min ; diving > one minute? +; bcf divemode ; NO - quit dive mode as this was no real dive + return ; done mH ;----------------------------------------------------------------------------- @@ -2719,20 +2723,30 @@ ; Check for Auto-SP ; check_dive_autosp: - movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP - sublw .2 ; opt_ccr_mode = 2 (Auto SP)? + movf dive_ccr_mode,W ; =0: Fixed SP, =1: Sensor, =2: Auto SP + sublw .2 ; dive_ccr_mode = 2 (Auto SP)? bz check_dive_autosp2 ; YES - check return ; NO - return for sensor or fixed mode check_dive_autosp2: + ; check for restart request + btfss restart_auto_sp ; shall restart from 1st SP? + bra check_dive_autosp2a ; NO - skip next + bcf restart_auto_sp ; YES - clear request flag + bcf FLAG_SP2_used ; - flag SP 2, ... + bcf FLAG_SP3_used ; - flag SP 3, ... + bcf FLAG_SP4_used ; - flag SP 4, ... + bcf FLAG_SP5_used ; - flag SP 5 as unused so far + +check_dive_autosp2a: ; check SP2 btfsc FLAG_SP2_used ; SP 2 used so far? bra check_dive_autosp3 ; YES - continue with SP 3 movff opt_setpoint_change+1,lo ; NO - get depth in m tstfsz lo ; - SP change depth = 0 ? - bra check_dive_autosp2a ; NO - continue + bra check_dive_autosp2b ; NO - continue bra check_dive_autosp3 ; YES - continue with SP 3 -check_dive_autosp2a: +check_dive_autosp2b: decf lo,W ; SP change depth -1 -> WREG cpfsgt depth_meter ; current depth > change depth - 1 ? bra check_dive_autosp3 ; NO - continue with SP 3 @@ -3096,11 +3110,10 @@ ; In case we still have 3 (auto SP) selected out of previous CCR mode, we reset to 0. btfss FLAG_pscr_mode ; in pSCR mode? bra dive_boot_cc_part2_2 ; NO - movff opt_ccr_mode,WREG ; YES - get mode (=0: Fixed SP (CCR) / calculated SP (pSCR), =1: Sensor, =2: Auto SP) - sublw .2 ; opt_ccr_mode = 1 (Auto SP)? + movf dive_ccr_mode,W ; YES - get mode (=0: Fixed SP (CCR) / calculated SP (pSCR), =1: Sensor, =2: Auto SP) + sublw .2 ; dive_ccr_mode = 1 (Auto SP)? bnz dive_boot_cc_part2_2 ; NO - ok - movlw .0 ; YES - revert to calculated SP - movff WREG,opt_ccr_mode ; ... + clrf dive_ccr_mode ; YES - revert to calculated SP dive_boot_cc_part2_2: bsf event_SP_change ; set setpoint event flag @@ -3155,6 +3168,10 @@ ; reset max relative pressure (max depth) bsf reset_max_pressure ; request ISR to reset the max pressure + ; make working copy of opt_ccr_mode + movff opt_ccr_mode,dive_ccr_mode ; copy option setting + + IFDEF _min_depth_option ; reset the resettable min/max relative pressure (trip-wise min/max depth) bsf reset_trip_pressure ; request ISR to reset the resettable min/max pressure diff -r 0ff82370991d -r 8c1f1f334275 src/eeprom_rs232.asm --- a/src/eeprom_rs232.asm Mon Aug 10 15:34:38 2020 +0200 +++ b/src/eeprom_rs232.asm Thu Oct 29 09:29:15 2020 +0100 @@ -351,6 +351,7 @@ enable_rs232_1: btfss speed_is_normal ; speed = normal? bra enable_rs232_1 ; NO - loop waiting for ISR to have adjusted the speed + bsf TRISC,7 bcf PORTE,0 ; YES - switch port to comm bsf PORTJ,2 ; - /Reset (required for very old OSTC sport) movlw b'00100100' ; - TX configuration: TX enabled, async, high speed @@ -389,6 +390,8 @@ bcf PORTC,6 ; switch TX pin hard to GND bsf PORTE,0 ; power down BT chip bcf PORTJ,2 ; /Reset (required for very old OSTC sport) + bcf TRISC,7 + bcf PORTC,7 ; switch RX pin hard to GND return diff -r 0ff82370991d -r 8c1f1f334275 src/hwos.asm --- a/src/hwos.asm Mon Aug 10 15:34:38 2020 +0200 +++ b/src/hwos.asm Thu Oct 29 09:29:15 2020 +0100 @@ -173,7 +173,7 @@ movwf cpu_speed_request ; store CPU shall run with normal speed movwf cpu_speed_state ; store CPU does run with normal speed - ;bcf RCON,SBOREN ; brown-out off (not needed here, is handled in bootloader) + bcf RCON,SBOREN ; brown-out off (not needed here, is handled in bootloader) bcf RCON,IPEN ; priority interrupts off banksel WDTCON @@ -196,8 +196,7 @@ movwf ANCON0 ; ... movlw b'00000111' ; ANSEL1: AN8, AN9, AN10 -> analog input movwf ANCON1 ; ... - movlw b'00000010' ; ANSEL2: AN17 -> analog input - movwf ANCON2 ; ... + clrf ANCON2 banksel common ; back to bank common @@ -231,7 +230,7 @@ ; movlw b'00000000' ; init port clrf PORTF ; ... - movlw b'00001110' ; 1= input, <7:6> not implemented, RG0 -> TX3_PIEZO_CFG, , RG1 -> TX2, RG2 -> RX2, RG3 -> AN17_RSSI, RG4 -> SOSC_OUT, RG5 -> /RESET + movlw b'00000110' ; 1= input, <7:6> not implemented, RG0 -> TX3_PIEZO_CFG, , RG1 -> TX2, RG2 -> RX2, RG3 -> AN17_RSSI, RG4 -> SOSC_OUT, RG5 -> /RESET movwf TRISG ; ... movlw b'00000001' ; init port movwf PORTG ; ... @@ -315,7 +314,7 @@ movwf ADCON0 ; ... movlw b'00100000' ; 2.048V Vref+ movwf ADCON1 ; ... - movlw b'10111010' ; right aligned, 20 x T_AD acquisition time, FOSC/32 -> max. 40 MHz device clock speed + movlw b'10001111' ; right aligned, 2 x T_AD acquisition time, clock derived from A/D RC oscillator (To be CPU-clock independent) movwf ADCON2 ; ... @@ -398,15 +397,19 @@ ; 32768 Hz clock source, 1:1 prescaler -> timer counts at 30.51757813 µs/bit movwf T5CON ; ... - +; Timer 4 for debounce of new digital piezo circuity + movlw b'01111011' ; 1:8 Postscale, Prescale = 1, Timer 4 OFF + movwf T4CON + setf PR4 + ; turn off unused Timers - ;banksel 0xF16 ; addresses F16h...F5Fh are not part of the access RAM + banksel 0xF16 ; addresses F16h...F5Fh are not part of the access RAM movlw b'11000000' ; disable ECCP3 and ECCP2 movwf PMD0 ; ... IFDEF _external_sensor - movlw b'11010001' ; disable PSP, CTMU, Timer 4 and EMB + movlw b'11000001' ; disable PSP, CTMU and EMB ELSE - movlw b'11011001' ; disable PSP, CTMU, Timer 4, Timer 3 and EMB + movlw b'11001001' ; disable PSP, CTMU, Timer 3 and EMB ENDIF movwf PMD1 ; ... movlw b'11010111' ; disable timer 10, timer 8, timer 6 and comparators 1-3 @@ -442,7 +445,7 @@ movwf PIE5 ; ... movlw b'00000001' ; enable RTCC IRQ movwf PIE3 ; ... - movlw b'00001000' ; enable timer 7 IRQ + movlw b'00001001' ; enable timer 7 and timer 4 IRQ movwf PIE5 ; ... ; Release RESET from RX Circuitry diff -r 0ff82370991d -r 8c1f1f334275 src/hwos.inc --- a/src/hwos.inc Mon Aug 10 15:34:38 2020 +0200 +++ b/src/hwos.inc Thu Oct 29 09:29:15 2020 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File hwos.inc * combined next generation V3.09.5 +; File hwos.inc * combined next generation V3.12.3 ; ; OSTC Platform Definitions ; @@ -182,9 +182,10 @@ ; ---- End-of-Dive Timeouts #DEFINE simulator_timeout_normal .90 ; [min] timeout simulator mode -#DEFINE simulator_timeout_cave .240 ; [min] timeout simulator mode (cave mode) -#DEFINE apnoe_timeout .15 ; [min] timeout at surface in apnoe mode -#DEFINE simulator_timeout .15 ; [s] timeout at surface in simulator mode +#DEFINE simulator_timeout_cave .240 ; [min] timeout simulator mode (cave mode) +#DEFINE apnoe_timeout .15 ; [min] timeout at surface in apnoe mode +#DEFINE simulator_timeout .15 ; [s] timeout at surface in simulator mode +#DEFINE divetime_less_1min_timeout .5 ; [s] timeout at surface for very short dives ; ---- other Timeouts @@ -193,7 +194,7 @@ ; ---- Surface Mode Thresholds and Limits #DEFINE high_altitude_threshold .880 ; [mbar] ambient pressure at which to switch into high altitude mode -#DEFINE max_surfpressure .1030 ; [mbar] maximum value for internal surface pressure +#DEFINE max_surfpressure .1060 ; [mbar] maximum value for internal surface pressure #DEFINE pressure_noise_threshold .10 ; [mbar] deltaP threshold for start of fast display updating #DEFINE pressure_noise_lag_time .6 ; [1/4 secs] lag time of display updating after deltaP < threshold again @@ -293,17 +294,17 @@ ; Gauge IC -#DEFINE capacity_saft .281 ; 2.4Ah/0.085mAh/100 [%] -#DEFINE offset_saft .37300 ; 65536-(2.4Ah/0.085mAh) +#DEFINE capacity_saft .271 ; 2.3Ah/0.085mAh/100 [%] +#DEFINE offset_saft .38477 ; 65536-(2.3Ah/0.085mAh) -#DEFINE capacity_panasonic .94 ; 0.8Ah/0.085mAh/100 [%] +#DEFINE capacity_panasonic .94 ; 0.8Ah/0.085mAh/100 [%] #DEFINE offset_panasonic .56124 ; 65536-(0.8Ah/0.085mAh) #DEFINE capacity_ncr18650 .364 ; 3.1Ah/0.085mAh/100 [%] #DEFINE offset_ncr18650 .29065 ; 65536-(3.1Ah/0.085mAh) -#DEFINE capacity_ur16650 .271 ; 2.3Ah/0.085mAh/100 [%] -#DEFINE offset_ur16650 .38477 ; 65536-(2.3Ah/0.085mAh) +#DEFINE capacity_ur16650 .235 ; 2.0Ah/0.085mAh/100 [%] +#DEFINE offset_ur16650 .42006 ; 65536-(2.0Ah/0.085mAh) ; ---- Power Consumption Values @@ -532,7 +533,7 @@ #DEFINE count_divetime OS_flags_ISR2,2 ; =1: request ISR to count the dive time #DEFINE sensor_override_request OS_flags_ISR2,3 ; =1: request ISR to override the pressure sensor with a simulated depth #DEFINE tmr5_preemtion_allowed OS_flags_ISR2,4 ; =1: allow preemption of timeout counter -; OS_flags_ISR2,5 ; --- unused +#DEFINE button_hold_down_allowed OS_flags_ISR2,5 ; =1: OSTC uses mechanical push buttons #DEFINE sensor_override_active OS_flags_ISR2,6 ; =1: ISR output: switch to override-mode confirmed #DEFINE divetime_longer_1min OS_flags_ISR2,7 ; =1: ISR output: dive time is >= one minute @@ -577,7 +578,7 @@ #DEFINE backtrack_entire_full DM_flags_state,6 ; =1: the backtracking storage is entirely full (cave mode) #DEFINE backtrack_shutdown DM_flags_state,7 ; =1: the backtracking has shut down due to entirely full (cave mode) -;---- Dive Mode - O2 Sensors +;---- Dive Mode - O2 Sensors & Setpoint #DEFINE use_O2_sensor1 DM_flags_sensor,0 ; =1: sensor 1 shall be used #DEFINE use_O2_sensor2 DM_flags_sensor,1 ; =1: sensor 2 shall be used #DEFINE use_O2_sensor3 DM_flags_sensor,2 ; =1: sensor 3 shall be used @@ -585,7 +586,7 @@ #DEFINE voting_logic_sensor2 DM_flags_sensor,4 ; =1: sensor 2 is within the voting logic threshold #DEFINE voting_logic_sensor3 DM_flags_sensor,5 ; =1: sensor 3 is within the voting logic threshold ; DM_flags_sensor,6 ; --- unused -; DM_flags_sensor,7 ; --- unused +#DEFINE restart_auto_sp DM_flags_sensor,7 ; =1: re-run the auto SP selection from 1st SP ;---- Dive Mode - User Requests / General #DEFINE request_gas_change DM_flags_request,0 ; =1: request to change the gas @@ -1187,8 +1188,10 @@ pressure_rel_min_trip res 2 ; resettable minimum relative pressure pressure_rel_max_trip res 2 ; resettable maximum relative pressure ENDIF + +debounce_counter res 1 ; multiples of 16ms -; 143 byte used, 17 byte free +; 144 byte used, 16 byte free ;----------------------------------------------------------------------------- @@ -1292,6 +1295,7 @@ gaslist_gas res 1 ; used for transfer between gaslist.asm and menu_tree.asm best_gas_number res 1 ; number of the "best gas": 0= none found, 1-5= gases 1-5, 255= not computed active_gas res 1 ; the currently used OC/bailout gas (1-5) +dive_ccr_mode res 1 ; working copy of opt_ccr_mode while the dive IFDEF _ccr_pscr best_dil_number res 1 ; number of the "best dil": 0= none found, 1-5= dils 1-5, 255= not computed @@ -1431,7 +1435,7 @@ pressure_update_lag_counter res 1 ; lag time counter for fast surface pressure display updating -; 200 byte used, 8 byte free (208 byte total) +; 201 byte used, 7 byte free (208 byte total) ;----------------------------------------------------------------------------- diff -r 0ff82370991d -r 8c1f1f334275 src/i2c.asm --- a/src/i2c.asm Mon Aug 10 15:34:38 2020 +0200 +++ b/src/i2c.asm Thu Oct 29 09:29:15 2020 +0100 @@ -1003,12 +1003,25 @@ movlw 0x01 ; point to control reg B rcall I2C_TX_GAUGE ; send byte to the LT2942 gauge IC movlw b'11111000' ; automatic conversion every two seconds - movff WREG,SSP1BUF ; data byte TODO: movwf ?? + movwf SSP1BUF ; data byte rcall WaitMSSP ; wait for TX to complete rcall I2C_Check_ACK ; check for acknowledge by receiver bsf SSP1CON2,PEN ; stop condition bra WaitMSSP ; wait for TX to complete and return +;----------------------------------------------------------------------------- +; Sleep Gauge IC +; + global lt2942_sleep +lt2942_sleep: + movlw 0x01 ; point to control reg B + rcall I2C_TX_GAUGE ; send byte to the LT2942 gauge IC + movlw b'00111000' ; sleep + movwf SSP1BUF ; data byte + rcall WaitMSSP ; wait for TX to complete + rcall I2C_Check_ACK ; check for acknowledge by receiver + bsf SSP1CON2,PEN ; stop condition + bra WaitMSSP ; wait for TX to complete and return ;----------------------------------------------------------------------------- ; Read Gauge IC - Status Register @@ -1083,12 +1096,23 @@ btfss cc_active ; in CC charging mode? return ; NO - not charging, done + ; ignore false readings (>125°C) + movlw LOW .3307 + movwf sub_a+0 + movlw HIGH .3307 + movwf sub_a+1 + MOVII battery_temperature, sub_b + call cmpU16 ; sub_a - sub_b (with UNSIGNED values) + btfsc neg_flag ; result negative? + return ; YES - temperature > 125°C, not possible here. Skip test. + ; check for over-temperature while charging MOVLI max_battery_charge_temp,sub_a MOVII battery_temperature, sub_b call cmpU16 ; sub_a - sub_b (with UNSIGNED values) btfss neg_flag ; result negative? return ; NO - temperature <= threshold, ok, done + return ; YES - too hot, disable charging circuitry bsf charge_disable ; - set charging-inhibit signal bcf charge_enable ; - activate charging-inhibit signal diff -r 0ff82370991d -r 8c1f1f334275 src/i2c.inc --- a/src/i2c.inc Mon Aug 10 15:34:38 2020 +0200 +++ b/src/i2c.inc Thu Oct 29 09:29:15 2020 +0100 @@ -13,6 +13,7 @@ extern I2C_sleep_compass extern lt2942_init ; init gauge IC + extern lt2942_sleep ; sleep gauge IC extern lt2942_get_status ; read gauge IC status extern lt2942_get_voltage ; read battery voltage registers extern lt2942_get_temperature ; read battery temperature diff -r 0ff82370991d -r 8c1f1f334275 src/isr.asm --- a/src/isr.asm Mon Aug 10 15:34:38 2020 +0200 +++ b/src/isr.asm Thu Oct 29 09:29:15 2020 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File isr.asm * combined next generation V3.09.5 +; File isr.asm * combined next generation V3.11.1 ; ; INTERUPT subroutines ; @@ -40,6 +40,8 @@ ; serve buttons btfsc PIR1,TMR1IF ; timer 1 interrupt (button hold-down timer)? rcall timer1int ; YES - reset timer + btfsc PIR5,TMR4IF ; timer 4 interrupt (button debounce) + rcall timer4int ; YES, serve the interrupt btfsc INTCON,INT0IF ; right button activity? rcall isr_switch_right ; YES - check right switch btfsc INTCON3,INT1IF ; left button activity? @@ -107,18 +109,12 @@ movwf OSCCON ; set prescaler 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' - ;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 + bra isr_adjust_speed_exit ; 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 @@ -137,6 +133,12 @@ isr_handler CODE 0x00084 ;============================================================================= +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 + ;----------------------------------------------------------------------------- ; Handle digitally-attached external Sensors ; @@ -277,6 +279,39 @@ ENDIF ; _external_sensor + +;----------------------------------------------------------------------------- +; Timer 4 - Button debounce (For new digital piezo circuit) + +timer4int: + bcf PIR5,TMR4IF + decfsz debounce_counter,F + return + bcf T4CON,TMR4ON ; Stop timer 4 + clrf TMR4 ; reset + + movff opt_cR_button_right,WREG ; 20-100; mH: opt_cR_button_right will also affect left button + bcf STATUS,C ; clear carry bit + rrcf WREG ; /2 -> 10-50 + bcf STATUS,C ; clear carry bit + rrcf WREG ; /2 -> 5-25 + decf WREG,W ; -1 + decf WREG,W ; -1 + decf WREG,W ; -1 -> 2-22 + +; movlw .5 ; initial delay + movwf debounce_counter ; multiples of 16ms + return + +timer4_restart: + movlw .5 ; extra delay + movwf debounce_counter + clrf TMR4 ; reset + bcf INTCON3,INT1IF ; clear ext. int 1 request + bcf INTCON,INT0IF ; clear ext. int 0 request + bsf INTCON,INT0IE ; enable INT0 IRQ + bsf INTCON3,INT1IE ; enable INT1 IRQ + return ;----------------------------------------------------------------------------- ; Tasks every 62.5 ms: Buttons, Dimming, Pressure/Temperature Sensor and CPU Speed @@ -288,45 +323,49 @@ movlw .248 ; reload timer 7, high byte (8x256 ticks -> 62.5 ms) movwf TMR7H ; ... (keep low byte running ) - btfss update_surface_pressure ; shall update the surface pressure? - bra isr_tmr7_0 ; NO - skip - bcf update_surface_pressure ; YES - clear request flag - MOVII pressure_abs_ref,pressure_surf ; - update surface pressure + btfss update_surface_pressure ; shall update the surface pressure? + bra isr_tmr7_1 ; NO - skip + bcf update_surface_pressure ; YES - clear request flag + MOVII pressure_abs_ref,pressure_surf ; - update surface pressure -isr_tmr7_0: +isr_tmr7_1: call get_analog_switches ; get analog readings - bank-safe, but CAUTION: returns in bank common banksel isr_backup ; back to ISR default bank btfss INTCON3,INT1IE ; external IRQ 1 enabled? - bra isr_tmr7_a ; NO - skip next + bra isr_tmr7_2 ; NO - skip next btfsc analog_sw2_pressed ; YES - analog switch 2 pressed? rcall isr_switch_left ; NO - get digital readings of left switch -isr_tmr7_a: + +isr_tmr7_2: btfss INTCON,INT0IE ; external IRQ 0 enabled? - bra isr_tmr7_b ; NO - skip next + bra isr_tmr7_3 ; NO - skip next btfsc analog_sw1_pressed ; YES - analog switch 1 pressed? rcall isr_switch_right ; NO - get digital readings of right switch -isr_tmr7_b: - btfss block_sensor_interrupt ; sensor interrupts disabled? - bra isr_tmr7_c ; NO - continue + +isr_tmr7_3: + btfsc block_sensor_interrupt ; sensor interrupts disabled? bra sensor_int_state_exit ; YES - goto exit -isr_tmr7_c: + ;bra isr_tmr7_4 ; NO - continue + +isr_tmr7_4: movf max_CCPR1L,W ; dim value cpfseq CCPR1L ; = current PWM value? rcall isr_dimm_tft ; NO - adjust until max_CCPR1L = CCPR1L IFDEF _external_sensor + decfsz ir_s8_timeout,F ; decrement IR/S8 timeout counter, became zero? - bra isr_tmr7_2 ; NO - continue + bra isr_sensor_state2 ; NO - continue with sensor movlw ir_timeout_value ; YES - get timeout value (in multiples of 62.5 ms) movwf ir_s8_timeout ; - reload timeout timer btfsc ext_input_optical ; - optical input in use? - bra isr_tmr7_1a ; YES - clear data + bra isr_tmr7_5 ; YES - clear data TSTOSS opt_s8_mode ; NO - S8 input in use? - bra isr_tmr7_2 ; NO - must be analog interface in use, keep data - ;bra isr_tmr7_1a ; YES - clear data + bra isr_sensor_state2 ; NO - must be analog interface in use, keep data + ;bra isr_tmr7_5 ; YES - clear data -isr_tmr7_1a: +isr_tmr7_5: clrf hud_status_byte ; S8/IR timeout clears all analog input readings to zero -> fallback will be triggered when in sensor mode CLRI hud_battery_mv ; clear battery voltage @@ -347,11 +386,10 @@ banksel isr_backup ; back to ISR default bank bsf trigger_S8_data_update ; signal a data update - ENDIF -isr_tmr7_2: + ENDIF ; _external_sensor -;isr_sensor_state2: +isr_sensor_state2: btfss sensor_state_counter,0 ; every 1/4 second bsf trigger_quarter_second ; set flag @@ -851,7 +889,14 @@ ; Check Buttons ; isr_switch_right: - bcf INTCON,INT0IE ; clear external interrupt 0 + bcf INTCON,INT0IE ; disable external interrupt 0 + + btfsc button_hold_down_allowed,A ; ignore for mechanical push buttons + bra isr_switch_right2 + btfsc T4CON,TMR4ON ; Timer4 running? + bra timer4_restart ; Yes, restart +isr_switch_right2: + btfss flip_screen ; 180° flipped? bsf switch_right ; NO - set flag for right button btfsc flip_screen ; 180° flipped? @@ -859,7 +904,14 @@ bra isr_switch_common ; continue with common part isr_switch_left: - bcf INTCON3,INT1IE ; clear external interrupt 1 + bcf INTCON3,INT1IE ; disable external interrupt 1 + + btfsc button_hold_down_allowed,A ; ignore for mechanical push buttons + bra isr_switch_left2 + btfsc T4CON,TMR4ON ; Timer4 running? + bra timer4_restart ; Yes, restart +isr_switch_left2: + btfss flip_screen ; 180° flipped? bsf switch_left ; NO - set flag for left button btfsc flip_screen ; 180° flipped? @@ -867,14 +919,17 @@ ;bra isr_switch_common ; continue with common part isr_switch_common: + btfss button_hold_down_allowed,A ; ignore for mechanical push buttons + bsf T4CON,TMR4ON ; Start timer 4 + btfsc tmr5_preemtion_allowed ; timer 5 preemption allowed? bsf PIR5,TMR5IF ; YES - preempt timer 5 movlw TMR1H_VALUE_FIRST ; load timer 1 (in steps of 7.8125 ms) movwf TMR1H ; ... clrf TMR1L ; ... bsf T1CON,TMR1ON ; start timer 1 - bcf INTCON3,INT1IF ; clear timer 1 IRQ request - bcf INTCON,INT0IF ; clear timer 0 IRQ request + bcf INTCON3,INT1IF ; clear ext. int 1 request + bcf INTCON,INT0IF ; clear ext. int 0 request return ; done @@ -883,8 +938,8 @@ ; timer1int: bcf PIR1,TMR1IF ; clear timer 1 IRQ request - bcf INTCON,INT0IF ; clear timer 0 IRQ request - bcf INTCON3,INT1IF ; clear timer 1 IRQ request + bcf INTCON,INT0IF ; clear ext. int 0 request + bcf INTCON3,INT1IF ; clear ext. int 1 request ; digital btfss switch_left1 ; left button hold-down? diff -r 0ff82370991d -r 8c1f1f334275 src/logbook.asm --- a/src/logbook.asm Mon Aug 10 15:34:38 2020 +0200 +++ b/src/logbook.asm Thu Oct 29 09:29:15 2020 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File logbook.asm * combined next generation V3.09.5 +; File logbook.asm * combined next generation V3.12.2 ; ; Logbook ; @@ -1387,22 +1387,22 @@ ; deco model GF version STRCAT_PRINT "ZH-L16+GF" ; print model label WIN_SMALL .5,.90 ; set position - STRCPY_TEXT tSD2 ; print label - MOVII header_buffer+index_gf_lo_hi,mpr ; get GF factors + STRCPY_TEXT tGF2 ; print label "GF :" + MOVII header_buffer+index_gf_lo_hi,mpr ; get GF factors bra logbook_decomodel_com ; continue with common part logbook_decomodel_1: ; deco model none-GF version STRCAT_PRINT "ZH-L16" ; print model label WIN_SMALL .5,.90 ; set position - STRCPY_TEXT tGF2 ; print label + STRCPY_TEXT tSD2 ; print label "S/D:" MOVII header_buffer+index_factor_sat_desat,mpr; get both factors ;bra logbook_decomodel_com ; continue with common part logbook_decomodel_com: - output_256 ; print saturation factor + output_256 ; print GF low / saturation factor STRCAT "%/" - movff hi,lo ; print desaturation factor + movff hi,lo ; print GF high / desaturation factor output_256 ; ... PUTC_PRINT "%" ; append unit and dump buffer to screen diff -r 0ff82370991d -r 8c1f1f334275 src/menu_processor.asm --- a/src/menu_processor.asm Mon Aug 10 15:34:38 2020 +0200 +++ b/src/menu_processor.asm Thu Oct 29 09:29:15 2020 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File menu_processor.asm * combined next generation V3.09.5 +; File menu_processor.asm * combined next generation V3.12.1 ; ; Routines to handle all hwOS graphic/text menus. ; @@ -69,14 +69,14 @@ VARARGS_GET8 menu_item_count ; get number of items VARARGS_GET8 menu_vertical_start ; get vertical start position of 1st menu item - movf menu_vertical_start,W ; excite flags - bz menu_processor_no_title ; no menu title text -> skip reading menu title text address + movf menu_vertical_start,W ; excite flags, vertical start = 0, i.e. no menu title text? + bz menu_processor_no_title ; YES - skip reading menu title text address VARARGS_GET16 menu_title_addr ; get address of menu title text menu_processor_no_title: - movff TBLPTRL, menu_item_data_start+0 ; store base address for menu_read_menu_item_data + movff TBLPTRL, menu_item_data_start+0 ; store base address of menu items for menu_read_menu_item_data movff TBLPTRH, menu_item_data_start+1 ; ... movff TBLPTRU, menu_item_data_start+2 ; ... @@ -95,8 +95,11 @@ menu_processor_menu_title: ; prepare screen + btfsc screen_type3 ; screen type 3 ? + bra menu_processor_menu_title1 ; YES - screen type 3 has no backlight clrf CCP1CON ; stop PWM bcf PORTC,2 ; fade out backlight +menu_processor_menu_title1: call TFT_ClearScreen ; clear screen ; draw menu title @@ -252,14 +255,15 @@ movf item_funct_addr+0,W ; check if execute function call address is NULL iorwf item_funct_addr+1,W ; ... bz next_line_menu ; YES - not selectable, step cursor to next menu item - btfss divemode ; NO - in dive mode? + btfsc divemode ; NO - in dive mode? + bra menu_line_loop_pre1 ; YES - skip next rcall menu_draw_cursor_surf ; NO - draw the cursor (main menu style) - btfss imprint_time_date ; - currently imprinting the current time & date? - bra menu_line_loop_pre1 ; NO - skip - btfss switch_right ; YES - right button pressed, i.e. time or date changed? + btfss imprint_time_date ; - currently imprinting the current time & date? bra menu_line_loop_pre1 ; NO - skip - call TFT_imprint_time_date_fast ; YES - show a fast response on the screen (may momentarily show an illegal day/month combination) - call rtc_set_rtc ; - update time and date on RTC module (corrects illegal day/month combinations) + btfss switch_right ; YES - right button pressed, i.e. time or date changed? + bra menu_line_loop_pre1 ; NO - skip + call TFT_imprint_time_date_fast ; YES - show a fast response on the screen (may momentarily show an illegal day/month combination) + call rtc_set_rtc ; - update time and date on RTC module (corrects illegal day/month combinations) menu_line_loop_pre1: bcf switch_right ; clear left-over right button event @@ -269,21 +273,22 @@ btfsc divemode ; in dive mode? goto divemode_option_divemenu_return ; YES - return to it call reset_timeout_surfmode ; NO - reset timeout + ;bra menu_line_loop ; - operate menu HMI menu_line_loop: - call housekeeping ; - handle data imprinting, screen dump request, timeout and entering dive mode - btfsc switch_right ; - right button pressed? - bra do_line_menu ; YES - execute menu item function - btfss switch_left ; NO - left button pressed? - bra menu_line_loop ; NO - loop -next_line_menu: ; YES - step cursor to next menu item - bcf switch_left ; - clear button event - incf selected_item,F ; - increment cursor position to next item - movf selected_item,W ; - copy new item number to WREG - cpfseq menu_item_count ; - new item number beyond number of menu items? - bra menu_vertical_loop ; NO - redraw cursor - clrf selected_item ; YES - reset cursor position to first item - bra menu_vertical_loop ; - redraw cursor + call housekeeping ; handle data imprinting, screen dump request, timeout and entering dive mode + btfsc switch_right ; right button pressed? + bra do_line_menu ; YES - execute menu item function + btfss switch_left ; NO - left button pressed? + bra menu_line_loop ; NO - loop +next_line_menu: ; YES - step cursor to next menu item + bcf switch_left ; - clear button event + incf selected_item,F ; - increment cursor position to next item + movf selected_item,W ; - copy new item number to WREG + cpfseq menu_item_count ; - new item number beyond number of menu items? + bra menu_vertical_loop ; NO - redraw cursor + clrf selected_item ; YES - reset cursor position to first item + bra menu_vertical_loop ; - redraw cursor ;----------------------------------------------------------------------------- @@ -334,12 +339,25 @@ global menu_draw_lines_divemode menu_draw_lines_divemode: - movlw dm_menu_item1_row ; get row position for 1st item - movwf win_top ; set vertical output position - movlw dm_menu_item1_column ; get column position for 1st item - movwf win_leftx2 ; set horizontal output position + movff menu_item_count,menu_pos_max ; copy number of item in menu block to menu_pos_max (used by divemode instead of menu_item_count for no reason) + + IFDEF _big_divemenu + + btfss alt_layout_active ; big menu selected? + bra menu_draw_lines_divemode_small ; NO + ;bra menu_draw_lines_divemode_big ; YES + +menu_draw_lines_divemode_big: + WIN_STD dm_menu_item1_column+.16,dm_menu_item1_row+.22 + decf menu_pos_cur,W ; get selected item as 0..5 into WREG + movwf menu_item_start ; set first item to draw = selected item + bra menu_draw_menu_items_common ; continue with common part + + ENDIF ; _big_divemenu + +menu_draw_lines_divemode_small: + WIN_SMALL dm_menu_item1_column,dm_menu_item1_row clrf menu_item_start ; set first item in menu block as first item to draw - movff menu_item_count,menu_pos_max ; copy number of item in menu block to menu_pos_max bra menu_draw_menu_items_common ; continue with common part menu_draw_lines_surfmode: @@ -351,7 +369,7 @@ ; does the menu have more than 7 item ? movf menu_item_count,W ; get number of menu items addlw -(MENU_LINES_MAX+1) ; more than 7 item? - bn menu_draw_menu_items_common ; NO - continue with common part + bn menu_draw_menu_items_common ; NO - continue with common part movf selected_item,W ; YES - compute first item to be drawn as current cursor position - 6 addlw -(MENU_LINES_MAX-1) ; - ... btfsc STATUS,N ; - is this < 0 ? @@ -361,14 +379,14 @@ menu_draw_menu_items_common: movff menu_item_start,menu_item_curr ; initialize menu item counter - FONT_SIZE FT_SMALL ; set font size menu_draw_menu_items_loop: - FONT_COLOR_MEMO ; set default font color (may be changed by dynamic titles) + FONT_COLOR_MEMO ; set default font color (may had been changed by a dynamic title) + REINIT_BUFFER ; initialize output buffer again movf menu_item_curr,W ; get menu item to draw rcall menu_read_menu_item_data ; read menu item data movf item_type,W ; switch on menu item type: - bz menu_draw_menu_item_dynamic ; -> 0: call with dynamic title + bz menu_draw_menu_item_dynamic ; -> 0: call with dynamic title dcfsnz WREG ; bra menu_draw_menu_item_call ; -> 1: call with fixed title dcfsnz WREG ; @@ -376,26 +394,24 @@ bra menu_draw_menu_item_print ; no output in case of illegal type menu_draw_menu_item_dynamic: - movf item_title_addr+0,W ; check if call address is NULL iorwf item_title_addr+1,W ; ... btfsc STATUS,Z ; is null? - bra menu_draw_menu_item_no_print ; YES - no printing on this menu line - INIT_BUFFER ; NO - initialize buffer - movff menu_item_curr,PRODL ; - pass menu item position to call function + bra menu_draw_menu_item_after_print ; YES - no printing on this menu line + movff menu_item_curr,PRODL ; NO - pass menu item position to call function rcall menu_text_call ; - call dynamic title function bra menu_draw_menu_item_print ; - print menu item menu_draw_menu_item_call: movff item_title_addr+0,FSR1L ; point to multi-lingual text movff item_title_addr+1,FSR1H ; ... - call strcpy_text_FSR ; copy translated text to buffer + call strcat_text_FSR ; copy translated text to buffer bra menu_draw_menu_item_print ; print menu item menu_draw_menu_item_option: movff item_title_addr+0,FSR1L ; point to multi-lingual text movff item_title_addr+1,FSR1H ; ... - call strcpy_text_FSR ; copy translated text to buffer + call strcat_text_FSR ; copy translated text to buffer movff option_addr+0,FSR0L ; hand over address of option definition data movff option_addr+1,FSR0H ; ... btfsc option_addr+1,6 ; is the selected option an option group member? @@ -410,41 +426,49 @@ movlw MAX_LINE_LENGTH_DIVE ; YES - replace with maximum length for a dive mode menu item call TFT_buffer_trim_length ; fill up or cut buffer to max length PRINT ; print menu item to screen - ;bra menu_draw_menu_item_no_print ; continue with after-print actions + ;bra menu_draw_menu_item_after_print ; continue with after-print actions -menu_draw_menu_item_no_print: - movlw MENU_HEIGHT_SURF ; get menu items vertical spacing for surface mode - btfsc divemode ; in dive mode? - movlw MENU_HEIGHT_DIVE ; YES - replace with vertical spacing for dive mode - - addwf win_top,F ; adjust vertical output position - incf menu_item_curr,F ; go to next menu item - +menu_draw_menu_item_after_print: btfss divemode ; in dive mode? - bra menu_draw_menu_item_surfmode ; NO + bra menu_draw_menu_item_common ; NO ;bra menu_draw_menu_item_divemode ; YES menu_draw_menu_item_divemode: - movlw .3 ; load a 3 - cpfseq menu_item_curr ; just done menu item 3 ? + IFDEF _big_divemenu + btfsc alt_layout_active ; big menu selected? + return ; YES - done + ENDIF + + movlw .2 ; load a 2 + cpfseq menu_item_curr ; just done menu item 2 (last item in left column) ? bra menu_draw_menu_item_common ; NO - continue with common part movlw dm_menu_item4_row ; YES - set vertical position for 2nd column movff WREG,win_top ; - ... movlw dm_menu_item4_column ; - set horizontal position for 2nd column movff WREG,win_leftx2 ; - ... - bra menu_draw_menu_item_common ; - continue with common part + bra menu_draw_menu_item_common_1 ; - continue in common part -menu_draw_menu_item_surfmode: +menu_draw_menu_item_common: + movlw MENU_HEIGHT_SURF ; get menu items vertical spacing for surface mode + btfsc divemode ; in dive mode? + movlw MENU_HEIGHT_DIVE ; YES - replace with vertical spacing for dive mode + addwf win_top,F ; adjust vertical output position + +menu_draw_menu_item_common_1: + incf menu_item_curr,F ; increment menu item number + IFDEF scrolling_menu_enabled - movf menu_item_start,W ; get the number of the menu item that menu drawing started with - subwf menu_item_curr,W ; compute how many item have been drawn already - xorlw MENU_LINES_MAX ; compare with how max item fit the screen - btfsc STATUS,Z ; screen full? - return ; YES - done - ;bra menu_draw_menu_item_common ; NO - continue with common part + btfsc divemode ; in dive mode? + bra menu_draw_menu_item_common_2 ; YES - skip + movf menu_item_start,W ; NO - get the number of the menu item that menu drawing started with + subwf menu_item_curr,W ; - compute how many item have been drawn already + xorlw MENU_LINES_MAX ; - compare with how max item fit the screen + btfsc STATUS,Z ; - screen full? + return ; - YES - done + ;bra menu_draw_menu_item_common_2 ; NO - continue ENDIF ; scrolling_menu_enabled -menu_draw_menu_item_common: +menu_draw_menu_item_common_2: movf menu_item_curr,W ; get current menu item xorwf menu_item_count,W ; compare with total number of menu items, more item to do? bnz menu_draw_menu_items_loop ; YES - loop @@ -465,7 +489,7 @@ ; Draw the Cursor (Main Menu Style) ; menu_draw_cursor_surf: - WIN_LEFT MENU_LEFT-8 ; set horizontal start of cursor column + WIN_LEFT MENU_LEFT-8 ; set horizontal start of cursor column WIN_WIDTH .6 ; set width of cursor column WIN_HEIGHT .223 ; set preliminary hight of cursor column @@ -476,6 +500,8 @@ clrf WREG ; set color to black BOX_COLOR ; clear cursor area + FONT_SIZE FT_SMALL ; set font size + movf menu_item_start,W ; get number of menu item that is on the first line subwf selected_item,W ; compute line number of current menu item @@ -483,7 +509,7 @@ movf PRODL,W ; get computed vertical offset addwf menu_vertical_start,W ; add offset to vertical start position movwf win_top ; set final vertical position - bra menu_draw_cursor_common ; print cursor and return + bra menu_draw_cursor_common ; print cursor ;----------------------------------------------------------------------------- @@ -491,10 +517,23 @@ ; global menu_draw_cursor_dive menu_draw_cursor_dive: + IFDEF _big_divemenu + btfss alt_layout_active ; big menu selected? + bra menu_draw_cursor_dive_small ; NO + ;bra menu_draw_cursor_dive_big ; YES + +menu_draw_cursor_dive_big: + WIN_STD dm_menu_item1_column,dm_menu_item1_row+.20 + bra menu_draw_cursor_common ; print cursor + ENDIF ; _big_divemenu + +menu_draw_cursor_dive_small: ; clear cursor areas WIN_BOX_BLACK dm_menu_row+.1, dm_menu_lower-.1, dm_menu_item1_column-.8, dm_menu_item1_column-.1 WIN_BOX_BLACK dm_menu_row+.1, dm_menu_lower-.1, dm_menu_item4_column-.8, dm_menu_item4_column-.1 + FONT_SIZE FT_SMALL ; set font size + movlw dm_menu_item1_column-.8 ; load position of left column btfsc menu_pos_cur,2 ; cursor at menu item 4..6 ? movlw dm_menu_item4_column-.8 ; YES - replace with position of right column @@ -504,19 +543,18 @@ btfsc menu_pos_cur,2 ; cursor at menu item 4..6 ? addlw -.3 ; YES - subtract 3 to get line number in right column - mullw MENU_HEIGHT_DIVE ; multiply line number with vertical menu items spacing + mullw MENU_HEIGHT_DIVE ; multiply line number (0..2) with vertical menu items spacing movf PRODL,W ; get computed vertical offset addlw dm_menu_item1_row ; add offset to vertical start position movwf win_top ; set final vertical position - ;bra menu_draw_cursor_common ; print cursor and return + ;bra menu_draw_cursor_common ; print cursor ;----------------------------------------------------------------------------- ; Helper Function - common Part of drawing the Cursor ; menu_draw_cursor_common: - FONT_COLOR_MEMO ; set font color - FONT_SIZE FT_SMALL ; set font size + FONT_COLOR_MEMO ; set font color (may have changed in-between) STRCPY_PRINT "\xb7" ; print cursor return ; done diff -r 0ff82370991d -r 8c1f1f334275 src/menu_tree.asm --- a/src/menu_tree.asm Mon Aug 10 15:34:38 2020 +0200 +++ b/src/menu_tree.asm Thu Oct 29 09:29:15 2020 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File menu_tree.asm * combined next generation V3.09.5 +; File menu_tree.asm * combined next generation V3.12.2 ; ; OSTC Surface Menus ; @@ -783,7 +783,7 @@ ; do_return_menu_dive: call menu_processor_double_pop ; drop exit line and back to last line - ;bra do_menu_dive ; continue + ;bra do_menu_dive ; continue ;----------------------------------------------------------------------------- ; Dive Settings Menu - 1st Layer @@ -803,7 +803,7 @@ ; do_menu_dive_dive: IFDEF _cave_mode - MENU_BEGIN tDiveModeMenu, .6 + MENU_BEGIN tDiveSetup, .6 MENU_OPT_INC tDvMode, oDiveMode ; dive mode MENU_OPT_INC tCvMode, oCaveMode ; cave mode MENU_OPT_INC tFTTSMenu, oExtraTime ; fTTS/delay @@ -812,7 +812,7 @@ MENU_CALL tBack, do_return_menu_dive MENU_END ELSE - MENU_BEGIN tDiveModeMenu, .5 + MENU_BEGIN tDiveSetup, .5 MENU_OPT_INC tDvMode, oDiveMode ; dive mode MENU_OPT_INC tFTTSMenu, oExtraTime ; fTTS/delay MENU_OPT_INC tTimeoutDive, oDiveTimeout ; dive timeout @@ -827,24 +827,46 @@ ; do_return_menu_dive_deco: call menu_processor_double_pop ; drop exit line and back to last line - ;bra do_menu_dive_deco ; continue + ;bra do_menu_dive_deco ; continue ;----------------------------------------------------------------------------- ; Dive Settings Menu - 2nd Layer - Deco Mode ; do_menu_dive_deco: - MENU_BEGIN tDecoSetup, .6 + MENU_BEGIN tDecoSetup, .5 MENU_OPT_INC tDkMode, oDecoMode ; ZH-L16 /GF - MENU_OPT_INC tSaturationMult, osatmultgf ; saturation - MENU_OPT_INC tDesaturationMult, odesatmultgf ; desaturation + MENU_CALL tSDMenu, do_menu_dive_deco_SD ; SD settings + MENU_CALL tGFMenu, do_menu_dive_deco_GF ; GF settings MENU_OPT_INC tAltMode, oAltMode ; altitude mode - MENU_CALL tGFMenu, do_menu_dive_deco_GF ; GF settings MENU_CALL tBack, do_return_menu_dive MENU_END ;----------------------------------------------------------------------------- +; Dive Settings Menu - 3nd Layer - Deco Mode - SD Settings +; +do_menu_dive_deco_SD: + TSTOSS char_I_model ; in GF mode? + bra do_menu_dive_deco_SD_noGF ; NO + ;bra do_menu_dive_deco_SD_GF ; YES + +do_menu_dive_deco_SD_GF: + MENU_BEGIN tSDMenu, .3 + MENU_OPT_INC tSaturationMult, osatmultgf ; saturation GF mode + MENU_OPT_INC tDesaturationMult, odesatmultgf ; desaturation GF mode + MENU_CALL tBack, do_return_menu_dive_deco + MENU_END + +do_menu_dive_deco_SD_noGF: + MENU_BEGIN tSDMenu, .3 + MENU_OPT_INC tSaturationMult, osatmult ; saturation non-GF mode + MENU_OPT_INC tDesaturationMult, odesatmult ; desaturation non-GF mode + MENU_CALL tBack, do_return_menu_dive_deco + MENU_END + + +;----------------------------------------------------------------------------- ; Dive Settings Menu - 3nd Layer - Deco Mode - GF Settings ; do_menu_dive_deco_GF: @@ -1809,7 +1831,9 @@ ; Settings Menu - 3rd Layer - System Settings - adjust Piezo Buttons ; do_menu_piezo: - MENU_BEGIN tPiezo, .3 + MENU_BEGIN tPiezo, .5 + MENU_CALL tButtonExplain1, 0 + MENU_CALL tButtonExplain2, 0 MENU_OPT_INC tButtonleft, ocR_button_left ; left button sensitivity MENU_OPT_INC tButtonright, ocR_button_right ; right button sensitivity MENU_CALL tBack, do_return_menu_syssets_piezo @@ -2032,6 +2056,7 @@ global new_battery_select new_battery_select: call TFT_boot ; initialize TFT (includes clear screen) + call TFT_load_std_color_pallet ; load standard color pallet call TFT_Display_FadeIn ; dim up the display call menu_processor_reset ; reset menu stack ;bra do_new_battery_select ; enter menu system @@ -2056,6 +2081,7 @@ ; ------------------------------------------------------------------------------------------------------------------------------------------------------- ; 0x11: BLE and battery gauge ---> OSTC 2 (old model) NO YES internal 18650 ; 0x05: analog input and battery gauge ---> OSTC 2 cR NO YES internal 18650 + ; 0x15: BLE and analog input and battery gauge ---> OSTC 2 cR (2020 model) NO YES internal 18650 ; 0x33: BLE and RX module and ambient sensor and battery gauge ---> OSTC 2 TR NO YES internal 16650 ; 0x13: BLE and ambient sensor and battery gauge -+-> OSTC 2 (new model) NO YES internal 16650 ; +-> OSTC Plus YES YES 1.5V ----- NO! ----- 3.6V rechargeable @@ -2079,6 +2105,12 @@ bra $+4 bra use_18650_battery + movlw 0x15 ; OSTC 2 cR (2020 model) + cpfseq HW_descriptor + bra $+4 + bra use_18650_battery + + movlw 0x85 ; OSTC 2 cR with block write cpfseq HW_descriptor bra $+4 @@ -2094,32 +2126,33 @@ bra $+4 bra do_menu_new_battery_AA_charger - movlw 0x13 ; OSTC Plus and OSTC 2 (2017 model), w/o blockwrite + movlw 0x13 ; OSTC Plus and OSTC 2 (2017 model), w/o block write cpfseq HW_descriptor bra $+4 bra do_menu_new_battery_AA_charger - ; movlw 0x0A ; OSTC 3 (USB model) - ; cpfseq HW_descriptor - ; bra $+4 - ; bra do_menu_new_battery_AA_no_charge - ; movlw 0x1A ; OSTC 3 (BLE model) - ; cpfseq HW_descriptor - ; bra $+4 - ; bra do_menu_new_battery_AA_no_charge + movlw 0x0A ; OSTC 3 (USB model) + cpfseq HW_descriptor + bra $+4 + bra do_menu_new_battery_AA_no_charge + + movlw 0x1A ; OSTC 3 (BLE model) + cpfseq HW_descriptor + bra $+4 + bra do_menu_new_battery_AA_no_charge - ; movlw 0x02 ; OSTC Sport (USB model) - ; cpfseq HW_descriptor - ; bra $+4 - ; bra do_menu_new_battery_AA_no_charge + movlw 0x02 ; OSTC Sport (USB model) + cpfseq HW_descriptor + bra $+4 + bra do_menu_new_battery_AA_no_charge - ; movlw 0x52 ; OSTC Sport (BLE model) - ; cpfseq HW_descriptor - ; bra $+4 - ; bra do_menu_new_battery_AA_no_charge + movlw 0x52 ; OSTC Sport (BLE model) + cpfseq HW_descriptor + bra $+4 + bra do_menu_new_battery_AA_no_charge - bra do_menu_new_battery_AA_no_charge ; any other model + bra do_menu_new_battery_other_model ; any other model ;----------------------------------------------------------------------------- @@ -2130,6 +2163,19 @@ ;bra do_menu_new_battery_AA_charger ; continue ;----------------------------------------------------------------------------- +; Battery Selection for OSTC (Full selection) + +do_menu_new_battery_other_model: + MENU_BEGIN tNewBattTitle, .6 + MENU_CALL tNewBattOld, do_use_old_battery ; load data of old battery + MENU_CALL tNewBattNew15, do_use_15V_disposable ; not rechargeable + MENU_CALL tNewBattNew36, do_use_36V_disposable ; not rechargeable + MENU_CALL tNewBattAccu, do_menu_new_battery_36V_charge ; rechargeable -> goto safety question + MENU_CALL tNew16650, do_use_16650_battery ; OSTC 2 new model + MENU_CALL tNew18650, use_18650_battery ; OSTC 2 (2015 model) + MENU_END + +;----------------------------------------------------------------------------- ; Battery Selection for OSTC Plus (charging function) TODO: and OSTC 2 new model as of now ; do_menu_new_battery_AA_charger: diff -r 0ff82370991d -r 8c1f1f334275 src/p2_deco.c --- a/src/p2_deco.c Mon Aug 10 15:34:38 2020 +0200 +++ b/src/p2_deco.c Thu Oct 29 09:29:15 2020 +0100 @@ -1,5 +1,5 @@ // *************************************************************************** -// p2_deco.c combined next generation V3.09.4 +// p2_deco.c combined next generation V3.12.1 // // Created on: 12.05.2009 // Author: heinrichs weikamp, contributions by Ralph Lembcke and others @@ -879,7 +879,7 @@ #ifndef CROSS_COMPILE _asm movff 0x601,0xF7D // bank-safe load TMR5H from C variable tmr5_value first - movff 0x600,0xF7C // bank-safe load TMR5L from c variable tmr5_value thereafter + movff 0x600,0xF7C // bank-safe load TMR5L from C variable tmr5_value thereafter bcf 0xFBA,1,0 // clear timer 5 overrun flag (0xFBA = PIR5, bit 1 = TMR5IF) _endasm #else @@ -1794,10 +1794,19 @@ { //---- simulated tissues ------------------------------------------------------ - // correct sim_pres_respiration if shallower than calculated stop depth - calc_pres_respiration = ( real_pres_respiration < sim_pres_respiration ) ? real_pres_respiration : sim_pres_respiration; - - // +++ pressure surcharge if outside deco stops area yet ??? +#ifdef _cave_mode + // in cave mode? + if( !(main_status & CAVE_MODE) ) + { +#endif + + // (NO) - correct sim_pres_respiration if shallower than calculated stop depth + calc_pres_respiration = ( real_pres_respiration < sim_pres_respiration ) ? real_pres_respiration : sim_pres_respiration; + +#ifdef _cave_mode + } +#endif + status = deco_status; calc_O2_ratio = sim_O2_ratio; diff -r 0ff82370991d -r 8c1f1f334275 src/simulator.asm --- a/src/simulator.asm Mon Aug 10 15:34:38 2020 +0200 +++ b/src/simulator.asm Thu Oct 29 09:29:15 2020 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File simulator.asm * combined next generation V3.09.5 +; File simulator.asm * combined next generation V3.11.1 ; ; Deco Calculator ; @@ -60,7 +60,7 @@ #define decoplan_abort decoplan_flags,0 ; =1: deco calculations were aborted #define decoplan_last_stop_shown decoplan_flags,1 ; =1: last deco stop is shown -#define decoplan_pressures_shown decoplan_flags,2 ; =1: show gas volumes in bar as per tank sizes +#define decoplan_show_pressures decoplan_flags,2 ; =1: show bar, =0: show liters #define decoplan_overflow decoplan_flags,3 ; =1: result > 999 #define decoplan_toggleflag decoplan_flags,4 ; used to show calculation progress ; decoplan_flags,5 ; --- unused @@ -684,7 +684,7 @@ ; loop through deco plan pages deco_results_1: clrf decoplan_page ; start from first page - bcf decoplan_pressures_shown ; when showing the gas needs, start with volumes (liter) + bcf decoplan_show_pressures ; start with showing volumes (liter) deco_results_1a: WIN_BOX_BLACK .0, .239, .80, .159 ; clear the complete right part of the result column (top, bottom, left, right) rcall deco_results_page ; show a results page @@ -758,9 +758,9 @@ bcf decoplan_overflow ; no overflow in gas needs by default - btfss decoplan_pressures_shown ; results in bar? - bra deco_results_gas_volumes_2 ; NO - liter - ;bra deco_results_gas_volumes_1 ; YES - bar + btfss decoplan_show_pressures ; shall show pressures? + bra deco_results_gas_volumes_2 ; NO - volume in liter + ;bra deco_results_gas_volumes_1 ; YES - pressure in bar ; output of gas needs in bar deco_results_gas_volumes_1: @@ -774,6 +774,7 @@ bcf hi,int_invalid_flag ; clear flag for invalid data bcf hi,int_is_zero ; clear flag for zero + ; common part for liter and bar deco_results_gas_volumes_2: PUTC ":" ; print ":" output_9999 ; print volume or bar (0-9999) @@ -792,13 +793,17 @@ FONT_COLOR color_greenish ; set color TEXT_SMALL .80,.01,tGasUsage ; "Gas Usage" - btfsc decoplan_pressures_shown ; results shown in bar? - bra deco_results_gas_volumes_4 ; YES - TEXT_SMALL .120,.25,tLiterLong ; NO - in Liter then - bra deco_results_gas_volumes_5 ; - continue with initialization of housekeeping + btfsc decoplan_show_pressures ; showing pressures in bar? + bra deco_results_gas_volumes_4b ; YES - bar + ;bra deco_results_gas_volumes_4a ; NO - liter -deco_results_gas_volumes_4: - TEXT_SMALL .120,.25,tbar ; " bar" (with leading space) +deco_results_gas_volumes_4a: + TEXT_SMALL .120,.25,tLiterLong ; print "Liter" + bra deco_results_gas_volumes_5 ; continue with initialization of housekeeping + +deco_results_gas_volumes_4b: + TEXT_SMALL .120,.25,tbar ; print " bar" (with leading space) + ;bra deco_results_gas_volumes_5 ; continue with initialization of housekeeping deco_results_gas_volumes_5: call reset_timeout_surfmode ; reset timeout @@ -819,9 +824,9 @@ return ; YES deco_results_gas_volumes_7: - btfsc decoplan_pressures_shown ; results shown in bar? - bra deco_results_1 ; YES - show deco stops again - bsf decoplan_pressures_shown ; NO - but now + btfsc decoplan_show_pressures ; showing pressures in bar? + bra deco_results_1 ; YES - restart with deco stops again + bsf decoplan_show_pressures ; NO - but now lfsr FSR0,int_O_gas_need_pres ; - set base address of gas needs in bar bra deco_results_gas_common ; - re-run gas needs output in pressure mode diff -r 0ff82370991d -r 8c1f1f334275 src/sleepmode.asm --- a/src/sleepmode.asm Mon Aug 10 15:34:38 2020 +0200 +++ b/src/sleepmode.asm Thu Oct 29 09:29:15 2020 +0100 @@ -119,6 +119,7 @@ bcf PIE1,TMR1IE ; disable timer 1 interrupt bcf PIE2,TMR3IE ; disable timer 2 interrupt bcf PIE5,TMR7IE ; disable timer 7 interrupt + bcf PIE5,TMR4IE ; disable timer 4 interrupt bcf INTCON, INT0IE ; disable INT0 interrupt bcf INTCON3,INT1IE ; disable INT1 interrupt @@ -155,6 +156,7 @@ bsf PIE1,TMR1IE ; enable timer 1 interrupt bsf PIE2,TMR3IE ; enable timer 2 interrupt bsf PIE5,TMR7IE ; enable timer 7 interrupt + bsf PIE5,TMR4IE ; enable timer 4 interrupt bsf INTCON, INT0IE ; enable INT0 interrupt bsf INTCON3,INT1IE ; enable INT1 interrupt diff -r 0ff82370991d -r 8c1f1f334275 src/start.asm --- a/src/start.asm Mon Aug 10 15:34:38 2020 +0200 +++ b/src/start.asm Thu Oct 29 09:29:15 2020 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File start.asm * combined next generation V3.09.5 +; File start.asm * combined next generation V3.11.1 ; ; Startup subroutines ; @@ -319,9 +319,6 @@ clrf STKPTR ; clear return addresses stack call request_speed_normal ; request CPU speed change to normal speed - ; switch off backlight - clrf CCP1CON ; stop PWM - bcf PORTC,2 ; pull PWM out to GND bsf tft_is_dimming ; ignore ambient sensor ; clear flag groups @@ -384,7 +381,27 @@ bsf ext_input_s8_ana ; YES - it's a cR, S8/analog sensor input available restart4: - bsf lv_core ; default to low voltage core + ; Do the check for BLE-cR + IFDEF _external_sensor + bsf mcp_power ; power-up instrumentation amp (used by S8 and analog input) + banksel BAUDCON2 ; select bank for IO register access + movlw b'00000000' ; speed generator configuration: BRG16=0, normal for S8 + movwf BAUDCON2 ; ... + movlw b'00100000' ; TX configuration: BRGH=0, SYNC=0 + movwf TXSTA2 ; ... + movlw .25 ; speed configuration: SPBRGH:SPBRG = .25 : 9615 BAUD @ 16 MHz + movwf SPBRG2 ; ... + movlw b'10010000' ; RX configuration + movwf RCSTA2 ; ... + banksel common ; back to bank common + call get_analog_inputs + movff sensor1_mv+1,lo + movlw .58 ; ~ >1,500V + cpfslt lo ; >58 on the high byte -> confident that there is cR circuity + bsf ext_input_s8_ana ; YES - it's a cR, S8/analog sensor input available + call disable_ir_s8_analog ; power-down circuity again + ENDIF + bsf lv_core ; default to low voltage core movlw 0x80 ; point to 0x1F780 movwf TBLPTRL ; ... movlw 0xF7 ; ... @@ -406,6 +423,8 @@ ; OSTC sport 2019 hardware does not have an optical input btfsc lv_core ; low voltage core? bcf ext_input_optical ; YES - no optical input available + btfsc lv_core ; low voltage core? + bcf ext_input_s8_ana ; YES - can't be a cR, S8/analog sensor input disabled ; check FLASH for block-write capability bsf flash_block_write ; default to block-write capability available @@ -481,6 +500,12 @@ restart5: + ; configure button_hold_down_allowed flag + btfsc lv_core + bsf button_hold_down_allowed,A ; OSTC sport mod. 2019 + btfsc ext_input_optical + bsf button_hold_down_allowed,A ; OSTC3/old sport + ; manage hardware btfss ext_input_s8_ana ; OSTC with S8/analog input? bsf TRISB,3 ; NO - shut down power supply for S8 bulkhead @@ -519,7 +544,15 @@ banksel common ; - back to bank common restart6: - call TFT_load_std_color_pallet ; load standard color pallet + btfsc ext_input_s8_ana ; analog sensor input available? + bra restart7 ; Yes, continue + ; no sensors, reconfigure TRIS and ANSEL bits for AN8 + bcf TRISF,3 + banksel 0xF16 ; addresses F16h ... F5Fh are not part of the access RAM + bcf ANCON1,0 ; ANSEL1: AN8 -> no analog input + banksel common ; back to bank common + +restart7: btfsc divemode ; shall enter dive mode? goto diveloop ; YES - enter dive mode btfsc RCON,POR ; NO - was this a power-on reset? diff -r 0ff82370991d -r 8c1f1f334275 src/surfmode.asm --- a/src/surfmode.asm Mon Aug 10 15:34:38 2020 +0200 +++ b/src/surfmode.asm Thu Oct 29 09:29:15 2020 +0100 @@ -219,7 +219,7 @@ rcall reset_timeout_surfmode ; reset timeout surfloop_loop: -; call TFT_debug_output ; optional debug output + call TFT_debug_output ; optional debug output call test_switches_surfmode ; check switches diff -r 0ff82370991d -r 8c1f1f334275 src/text_english.inc --- a/src/text_english.inc Mon Aug 10 15:34:38 2020 +0200 +++ b/src/text_english.inc Thu Oct 29 09:29:15 2020 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File text_english.asm next combined generation V3.09.4k +; File text_english.asm next combined generation V3.12.3 ; ; English texts reference file. ; @@ -77,7 +77,7 @@ TCODE tSysSets, "System Settings" ; System Settings TCODE tExit, "Exit" ; Exit TCODE tResetMenu, "Reset Menu" ; Reset Menu - TCODE tDiveModeMenu, "Dive Setup" ; Dive Setup + TCODE tDiveModeMenu, "Dive/Deco Setup" ; Dive Setup TCODE tDiveSetup, "Dive Setup" ; Dive Setup TCODE tDecoSetup, "Deco Setup" ; Deco Setup @@ -104,7 +104,7 @@ ENDIF IFDEF _external_sensor - TCODE tCCRSensor, "Sensor" ; CCR/pSCR Sensor +; TCODE tCCRSensor, "Sensor" ; CCR/pSCR Sensor TCODE tCalibrateMenu, "Calibration" ; Calibration TCODE tCalibrationGas, "Cal. Gas O2:" ; Cal. Gas O2: TCODE tCalibrate, "Calibrate" ; Calibrate @@ -165,8 +165,8 @@ TCODE tNewBattNew36, "3.6V disposable (T1)" ; new 3.6V disposable TCODE tNewBattNew15, "1.5V disposable (T0)" ; new 1.5V disposable TCODE tNewBattAccu, "3.7V chargeable (T2)" ; new 3.7V rechargeable - TCODE tNew18650, "OSTC 2 or cR (T3)" ; internal battery on 2 (old) / cR - TCODE tNew16650, "OSTC 2 or TR (T4)" ; internal battery on 2 (new) / TR + TCODE tNew18650, "OSTC 2(2015), cR(T3)" ; internal battery on 2 (old) / cR + TCODE tNew16650, "OSTC 2(2017), TR(T4)" ; internal battery on 2 (new) / TR TCODE tConfirmChargeable1,"Confirm:" ; safety question, line 1 TCODE tConfirmChargeable2,"inserted Battery" ; safety question, line 2 TCODE tConfirmChargeable3,"is rechargeable" ; safety question, line 3 @@ -198,7 +198,7 @@ ENDIF TCODE tFTTSMenu, "fTTS/Delay : " ; Future TTS / Ascent Delay TCODE tTimeoutDive, "Dive Timeout: " ; Dive Timeout - TCODE tStoreApnoeDive, "Store Apnoe : " ; Store Apnoe Dives + TCODE tStoreApnoeDive, "Store Apnea : " ; Store Apnoe Dives TCODE tDvOC, "OC" ; 0 | keep order, enum! TCODE tDvCCR, "CCR" ; 1 | TCODE tDvGauge, "Gauge" ; 2 | @@ -222,12 +222,13 @@ TCODE tSaturationMult, "Saturation : " TCODE tDesaturationMult, "Desaturation: " TCODE tGFMenu, "GF Settings" ; GF Settings + TCODE tSDMenu, "SD Settings" ; SD Settings TCODE taGF_low, "aGF low :" ; aGF low TCODE taGF_high, "aGF high:" ; aGF high TCODE taGFenable, "aGF selectable:" ; aGF Selectable TCODE tDiveaGF_active, "using aGF" ; using aGF TCODE tSafetyStop, "Safety Stop : " ; Safety Stop: (max. 16 chars) - TCODE tExtendedStops, "extended Stop: " ; Extended Stops + TCODE tExtendedStops, "Extended Stop: " ; Extended Stops TCODE tLastDecostop, "Last Deco : " ; last Deco Stop Depth TCODE tDvSalinity, "Salinity : " ; Salinity TCODE tDepthWarn, "Depth Warning:" ; Depth Warning (no space after ':' on purpose) @@ -238,7 +239,7 @@ IFDEF _gas_contingency TCODE tGasContingencyDive,"Swap on empty: " ; swap tank on becoming empty ENDIF - TCODE tGasChangeTime, "Gas Change :+" ; additional Gas Change Time + TCODE tGasChangeTime, "Gas change time:+" ; additional Gas Change Time TCODE tSetup_Tank, "Setup Tank" ; Setup Tank TCODE tTankSize, "Tank Size: " ; Tank Size TCODE tTankUsablePress, "Turn Pres: " ; Tank Pressure Budget for Ascent (turn pressure) @@ -329,8 +330,10 @@ TCODE tImperial, "ft/°F" ; 1 ; 111 111 111 111 111 ; 5 rows by 12 chars each: 123456789012123456789012123456789012123456789012123456789012 - TCODE tDefName, "HW OSTC " + TCODE tDefName, "HW OSTC" ; " Read the Manual, know& understandthe inherentLimitations!" TCODE tPiezo, "Buttons" ; Buttons + TCODE tButtonExplain1, "Less % is" ; Less % is + TCODE tButtonExplain2, "more sensitive." ; more sensitive. TCODE tButtonleft, "Left Button:" ; Left Button TCODE tButtonright, "Right Button:" ; Right Button TCODE tAltMode, "Waiting Time:" @@ -375,7 +378,7 @@ TCODE tNoDeco, "No Deco" ; No Deco TCODE tMore, "more" ; more TCODE tSelectSetpoint, "Setpoint : " ; Setpoint - TCODE tuseAGF, "use aGF : " ; use alternative Grdient Factors + TCODE tuseAGF, "Use aGF : " ; use alternative Grdient Factors IFDEF _gas_contingency TCODE tGasContingencySim, "Gas Cont.: " ; Gas Contingency ENDIF diff -r 0ff82370991d -r 8c1f1f334275 src/text_french.inc --- a/src/text_french.inc Mon Aug 10 15:34:38 2020 +0200 +++ b/src/text_french.inc Thu Oct 29 09:29:15 2020 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File text_french.sm next combined generation V3.09.4k +; File text_french.sm next combined generation V3.12.3 ; ; French texts translation file. ; @@ -73,7 +73,7 @@ TCODE tSetTime, "Réglage Heure" ; Set Time TCODE tSetDate, "Réglage Date" ; Set Date TCODE tSetTimeDate, "Date & Heure" ; Time & Date - TCODE tDispSets, "Préfér. Réglages" ; Display Settings + TCODE tDispSets, "Préfér. Ecran" ; Display Settings TCODE tSysSets, "Préfér. Système" ; System Settings TCODE tExit, "Sortie" ; Exit TCODE tResetMenu, "Menu RaZ" ; Reset Menu @@ -104,7 +104,7 @@ ENDIF IFDEF _external_sensor - TCODE tCCRSensor, "Cellules CCR" ; CCR Sensor +; TCODE tCCRSensor, "Cellules CCR" ; CCR Sensor TCODE tCalibrateMenu, "Calibration" ; Calibration TCODE tCalibrationGas, "Cal. Gaz O2:" ; Cal. Gas O2: TCODE tCalibrate, "Calibrate" ; Calibrate @@ -165,8 +165,8 @@ TCODE tNewBattNew36, "3,6V jetable (T1)" ; new 3.6V disposable TCODE tNewBattNew15, "1,5V jetable (T0)" ; new 1.5V disposable TCODE tNewBattAccu, "3,7V chargeable (T2)" ; new 3.7V rechargeable - TCODE tNew18650, "OSTC 2 ou cR (T3)" ; internal battery on 2 (old) / cR - TCODE tNew16650, "OSTC 2 ou TR (T4)" ; internal battery on 2 (new) / TR + TCODE tNew18650, "OSTC 2(2015), cR(T3)" ; internal battery on 2 (old) / cR + TCODE tNew16650, "OSTC 2(2017), TR(T4)" ; internal battery on 2 (new) / TR TCODE tConfirmChargeable1,"Confirmer:" ; safety question, line 1 TCODE tConfirmChargeable2,"La pile insérée" ; safety question, line 2 TCODE tConfirmChargeable3,"est rechargeable" ; safety question, line 3 @@ -222,12 +222,13 @@ TCODE tSaturationMult, "Saturation : " ; Saturation TCODE tDesaturationMult, "Désaturation: " ; Desaturation TCODE tGFMenu, "Menu GF" ; GF Settings + TCODE tSDMenu, "Menu SD" ; SD Settings TCODE taGF_low, "aGF Bas : " ; aGF Low TCODE taGF_high, "aGF Haut: " ; aGF High TCODE taGFenable, "aGF Possible: " ; aGF Selectable TCODE tDiveaGF_active, "aGF Actif" ; using aGF TCODE tSafetyStop, "Palier Sécurité:" ; Safety Stop: (max. 16 chars) - TCODE tExtendedStops, "Paliers + Longs:" ; Extended Stops + TCODE tExtendedStops, "Chang. gaz libre:" ; Extended Stops TCODE tLastDecostop, "Dern.Palier : " ; last DecoStop Depth TCODE tDvSalinity, "Salinité : " ; Salinity TCODE tDepthWarn, "Alerte Prof.:" ; Depth Warning (no space after ':' on purpose) @@ -329,8 +330,10 @@ TCODE tImperial, "ft/°F" ; 111 111 111 111 111 ; 5 rows by 12 chars each: 123456789012123456789012123456789012123456789012123456789012 - TCODE tDefName, "HW OSTC " + TCODE tDefName, "HW OSTC" ;"Lire la doc.Connaitre etComprendre les limites de l'OSTC ! " TCODE tPiezo, "Bouton" ; Buttons + TCODE tButtonExplain1, "Less % is" ; Less % is + TCODE tButtonExplain2, "more sensitive." ; more sensitive. TCODE tButtonleft, "Bouton gauche:" ; Left button TCODE tButtonright, "Bouton droit :" ; Right button TCODE tAltMode, "Temps Attente:" ; Waiting Time @@ -500,7 +503,7 @@ ; Divemode menu - TCODE tDiveAckn, "OkVu?" ; Acknf? (max. 5 chars) (Acknowledge) + TCODE tDiveAckn, "OkVu?" ; Ackn? (max. 5 chars) (Acknowledge) TCODE tDivePreMenu, "Menu?" ; Menu? (max. 5 chars) TCODE tDiveLayout, "Affich" ; Layout (max. 6 chars) IFDEF _compass diff -r 0ff82370991d -r 8c1f1f334275 src/text_german.inc --- a/src/text_german.inc Mon Aug 10 15:34:38 2020 +0200 +++ b/src/text_german.inc Thu Oct 29 09:29:15 2020 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File text_german.asm next combined generation V3.09.4k +; File text_german.asm next combined generation V3.12.3 ; ; German texts translation file. ; @@ -70,8 +70,8 @@ TCODE tMainMenu, "Hauptmenü" ; MainMenu TCODE tLogbook, "Logbuch" ; Logbook TCODE tGasSetup, "OC Gas Setup" ; OC Gas Setup - TCODE tSetTime, "Zeit stellen" ; Set Time - TCODE tSetDate, "Datum stellen" ; Set Date + TCODE tSetTime, "Zeit einstellen" ; Set Time + TCODE tSetDate, "Datum einstellen" ; Set Date TCODE tSetTimeDate, "Datum & Uhrzeit" ; Time & Date TCODE tDispSets, "Anzeige" ; Display Settings TCODE tSysSets, "System" ; System Settings @@ -81,13 +81,13 @@ TCODE tDiveSetup, "Tauchgang" ; Dive Setup TCODE tDecoSetup, "Dekompression" ; Deco Setup - TCODE tSACSetup, "SAC Einstellung" ; SAC Setup + TCODE tSACSetup, "AMV Einstellung" ; SAC Setup TCODE tppO2Setup, "O2 Partialdruck" ; ppO2 Setup TCODE tStopsSetup, "Stopps & Tiefen" ; Stops & Depths TCODE tInfoMenu, "Informationen" ; Information IFDEF _ccr_pscr - TCODE tCCRSetup, "CCR/pSCR Menü" ; CCR/pSCR Setup + TCODE tCCRSetup, "CCR/pSCR Setup" ; CCR/pSCR Setup TCODE tDiluentSetup, "Diluent Menü" ; Diluent Setup ENDIF TCODE tFixedSetpoints, "CCR Setpoints" ; Fixed Setpoints @@ -104,7 +104,7 @@ ENDIF IFDEF _external_sensor - TCODE tCCRSensor, "Sensor" ; CCR/pSCR Sensor +; TCODE tCCRSensor, "Sensor" ; CCR/pSCR Sensor TCODE tCalibrateMenu, "Kalibrierung" ; Calibration TCODE tCalibrationGas, "Kal. Gas O2:" ; Cal. Gas O2: TCODE tCalibrate, "Kalibrieren" ; Calibrate @@ -120,7 +120,7 @@ TCODE tGaslist, "OC Gas Liste" TCODE tGaslistCC, "CC Gas Liste" ; CC Diluents TCODE tGasEdit, "Gas einstellen" - TCODE tType, "Type: " + TCODE tType, "Typ: " TCODE tGasDisabled, "Deaktiviert" ; | ENUM 1: Disabled TCODE tGasFirst, "Start" ; | 2: First TCODE tGasTravel, "Arbeit" ; | 3: Work (Travel, Bottom) @@ -139,7 +139,7 @@ TCODE tDepthPlus, "Tiefe +" TCODE tDepthMinus, "Tiefe -" TCODE tDepthReset, "Reset auf MOD:" - TCODE tSetup_GasMix, "Mix Einstellen" + TCODE tSetup_GasMix, "Mix einstellen" IFDEF _ccr_pscr TCODE tSPPlus, "ppO2 +" ; Setpoint ppO2 + TCODE tSensorFallback, "Fallback:" ; Fallback: @@ -148,7 +148,7 @@ TCODE tppO2Dil, "ppO2(Dil)" ; ppO2(Dil) TCODE tppO2Mix, "ppO2(Mix)" ; ppO2(Mix) TCODE tCCRMode, "Modus: " ; CCR/pSCR Mode - TCODE tCCRModeFixedSP, "fixe SP" ; 0 fixed for CCR / calculated for pSCR | ENUM group + TCODE tCCRModeFixedSP, "FesterSP" ; 0 fixed for CCR / calculated for pSCR | ENUM group TCODE tCCRModeSensor, "Sensor" ; 1 Sensor | TCODE tCCRModeAutoSP, "Auto SP" ; 2 Auto SP | ELSE @@ -165,8 +165,8 @@ TCODE tNewBattNew36, "3,6V Einweg (T1)" ; new 3.6V disposable TCODE tNewBattNew15, "1,5V Einweg (T0)" ; new 1.5V disposable TCODE tNewBattAccu, "3,7V aufladbar (T2)" ; new 3.7V rechargeable - TCODE tNew18650, "OSTC 2 oder cR (T3)" ; internal battery on 2 (old) / cR - TCODE tNew16650, "OSTC 2 oder TR (T4)" ; internal battery on 2 (new) / TR + TCODE tNew18650, "OSTC 2(2015), cR(T3)" ; internal battery on 2 (old) / cR + TCODE tNew16650, "OSTC 2(2017), TR(T4)" ; internal battery on 2 (new) / TR TCODE tConfirmChargeable1,"Bestätigung:" ; safety question, line 1 TCODE tConfirmChargeable2,"eingelegte Batterie" ; safety question, line 2 TCODE tConfirmChargeable3,"ist wiederaufladbar" ; safety question, line 3 @@ -205,7 +205,7 @@ TCODE tDvApnea, "Apnoe" ; 3 | TCODE tDvPSCR, "pSCR" ; 4 | TCODE tDvCC, "CC" - TCODE tDkMode, "Decotype: ZH-L16" + TCODE tDkMode, "Decotyp: ZH-L16" TCODE tZHL16, " " ; keep order, enum from here... TCODE tZHL16GF, "+GF" ; ...up to here! TCODE tPPO2Max, "Max. Arbeit:" @@ -222,6 +222,7 @@ TCODE tSaturationMult, "Sättigung : " TCODE tDesaturationMult, "Entsättigung: " TCODE tGFMenu, "GF Parameter" ; GF Settings + TCODE tSDMenu, "SD Parameter" ; SD Settings TCODE taGF_low, "aGF low :" ; aGF low TCODE taGF_high, "aGF high:" ; aGF high TCODE taGFenable, "aGF wählbar:" ; aGF Selectable @@ -232,15 +233,15 @@ TCODE tDvSalinity, "Salinität : " ; Salinity TCODE tDepthWarn, "Tiefenlimit:" ; Depth Warning (no space after ':' on purpose) TCODE tGasUsage, "Gasbedarf" ; Gas Usage - TCODE tSetWorkSAC, "Arbeits-SAC:" ; SAC Work: - TCODE tSetDecoSAC, "Deko SAC:" ; SAC Deco: + TCODE tSetWorkSAC, "Arbeits AMV:" ; SAC Work: + TCODE tSetDecoSAC, "Deko AMV:" ; SAC Deco: TCODE tCalcGasNeeds, "Gasmenge(B/O): " ; Calculate Gas (Bail Out) Needs IFDEF _gas_contingency TCODE tGasContingencyDive,"Swap on empty: " ; swap tank on becoming empty ENDIF - TCODE tGasChangeTime, "Gaswechsel :+" ; additional Gas Change Time - TCODE tSetup_Tank, "Tank Einstellen" ; Setup Tank - TCODE tTankSize, "Tank Größe : " ; Tank Size + TCODE tGasChangeTime, "Gaswechselzeit:+" ; additional Gas Change Time + TCODE tSetup_Tank, "Flasche" ; Setup Tank + TCODE tTankSize, "Flaschengröße:" ; Tank Size TCODE tTankUsablePress, "Umkehrdruck: " ; Tank Pressure Budget for Ascent (turn pressure) TCODE tLiter, " l" ; Liter as l TCODE tLiterLong, "Liter" ; Liter as Liter @@ -329,11 +330,13 @@ TCODE tImperial, "ft/°F" ; 111 111 111 111 111 ; 5 rows by 12 chars each: 123456789012123456789012123456789012123456789012123456789012 - TCODE tDefName, "HW OSTC " - TCODE tPiezo, "Taster" ; Buttons + TCODE tDefName, "HW OSTC" + TCODE tPiezo, "Taster" ; Buttons + TCODE tButtonExplain1, "Weniger % ist" ; Less % is + TCODE tButtonExplain2, "empfindlicher." ; more sensitive. TCODE tButtonleft, "Taster links :" ; Left button TCODE tButtonright, "Taster rechts:" ; Right button - TCODE tAltMode, "Wartezeit:" + TCODE tAltMode, "Wartezeit:" TCODE tAltModeFly, "Fliegen" TCODE tAltMode1000, "1000m" TCODE tAltMode2000, "2000m" diff -r 0ff82370991d -r 8c1f1f334275 src/text_italian.inc --- a/src/text_italian.inc Mon Aug 10 15:34:38 2020 +0200 +++ b/src/text_italian.inc Thu Oct 29 09:29:15 2020 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File text_italian.asm next combined generation V3.09.4k +; File text_italian.asm next combined generation V3.12.3 ; ; Italian texts translation file. ; @@ -26,9 +26,9 @@ TCODE tHeading, "Direzione:" ; Heading: TCODE tLastDive, "UltimaImm." ; Last Dive (Max 10 chars) - TCODE tFTTSSurf, "TTS Futuro :" ; Future TTS - TCODE tLastDecostopSurf, "UltimaTappa:" ; last deco stop surface custom view - TCODE tDvSalinitySurf, "Salinita' :" ; Salinity + TCODE tFTTSSurf, "TTS Futuro :" ; Future TTS + TCODE tLastDecostopSurf, "Ultima Tappa:" ; last deco stop surface custom view + TCODE tDvSalinitySurf, "Salinita' :" ; Salinity IFDEF _external_sensor TCODE tSensorMilliVolt, "Sensori mV" ; Sensors mV @@ -91,8 +91,8 @@ TCODE tDiluentSetup, "Imposta Diluente" ; Diluent Setup ENDIF TCODE tFixedSetpoints, "Setpoints Fissi" ; Fixed Setpoints - TCODE tBack, "indietro" ; back - TCODE tGas6, "Gas extra" ; edit & select Gas 6 + TCODE tBack, "indietro" ; back + TCODE tGas6, "Gas extr" ; edit & select Gas 6 IFDEF _rx_functions TCODE tTrSettings, "Display Press.ni" ; Pressure Display @@ -104,7 +104,7 @@ ENDIF IFDEF _external_sensor - TCODE tCCRSensor, "Sensori CCR" ; CCR Sensor +; TCODE tCCRSensor, "Sensori CCR" ; CCR Sensor TCODE tCalibrateMenu, "Calibrazione" ; Calibration TCODE tCalibrationGas, "Cal. Gas O2:" ; Cal. Gas O2: TCODE tCalibrate, "Calibra" ; Calibrate @@ -165,8 +165,8 @@ TCODE tNewBattNew36, "3,6V monouso (T1)" ; new 3.6V disposable TCODE tNewBattNew15, "1,5V monouso (T0)" ; new 1.5V disposable TCODE tNewBattAccu, "3,7V ricaricab. (T2)" ; new 3.7V rechargeable - TCODE tNew18650, "OSTC 2 o cR (T3)" ; internal battery on 2 (old) / cR - TCODE tNew16650, "OSTC 2 o TR (T4)" ; internal battery on 2 (new) / TR + TCODE tNew18650, "OSTC 2(2015), cR(T3)" ; internal battery on 2 (old) / cR + TCODE tNew16650, "OSTC 2(2017), TR(T4)" ; internal battery on 2 (new) / TR TCODE tConfirmChargeable1,"Conferma:" ; safety question, line 1 TCODE tConfirmChargeable2,"la batteria inserita" ; safety question, line 2 TCODE tConfirmChargeable3,"è ricaricabile" ; safety question, line 3 @@ -222,6 +222,7 @@ TCODE tSaturationMult, "Saturazione : " TCODE tDesaturationMult, "Desaturazione: " TCODE tGFMenu, "Menu GF" ; GF Settings + TCODE tSDMenu, "Menu SD" ; SD Settings TCODE taGF_low, "aGF Basso:" ; aGF low TCODE taGF_high, "aGF Alto :" ; aGF high TCODE taGFenable, "aGF Selezionabile:" ; aGF Selectable @@ -231,7 +232,7 @@ TCODE tLastDecostop, "Ultima Tappa : " ; last Deco Stop Depth TCODE tDvSalinity, "Salinita' : " ; Salinity TCODE tDepthWarn, "Depth Warning :" ; Depth Warning (no space after ':' on purpose) - TCODE tGasUsage, "Utilizzo" ; Gas Usage + TCODE tGasUsage, "Utilizzo" ; Gas Usage TCODE tSetWorkSAC, "SAC Fondo: " ; SAC Work: (space) TCODE tSetDecoSAC, "SAC Deco : " ; SAC Deco: (space) TCODE tCalcGasNeeds, "Calc.Gas(B/O): " ; Calculate Gas (Bail Out) Needs @@ -329,8 +330,10 @@ TCODE tImperial, "ft/°F" ; 111 111 111 111 111 ; 5 rows by 12 chars each: 123456789012123456789012123456789012123456789012123456789012 - TCODE tDefName, "HW OSTC " + TCODE tDefName, "HW OSTC" ;" Read the Manual, know& understandthe inherentLimitations!" TCODE tPiezo, "Bottone" ; Buttons + TCODE tButtonExplain1, "Less % is" ; Less % is + TCODE tButtonExplain2, "more sensitive." ; more sensitive. TCODE tButtonleft, "Bottone Sx:" ; Left Button TCODE tButtonright, "Bottone Dx:" ; Right Button TCODE tAltMode, "Attesa :" ; Waiting Time @@ -450,7 +453,7 @@ TCODE tCNSfTTS, "CNS fTTS" ; TCODE tCNSBO, "CNS B/O" ; TCODE tCNSnow, "CNS ora" ; - TCODE tCNSeod, "CNS fin." ; + TCODE tCNSeod, "CNS fin." ; IFDEF _cave_mode TCODE tCNScave, "CNS Cave" ; ENDIF diff -r 0ff82370991d -r 8c1f1f334275 src/text_multilang.asm --- a/src/text_multilang.asm Mon Aug 10 15:34:38 2020 +0200 +++ b/src/text_multilang.asm Thu Oct 29 09:29:15 2020 +0100 @@ -23,7 +23,7 @@ ;#undefine _language_1 ;#define _language_1 fr -;; + ;#undefine _language_2 ;#define _language_2 it diff -r 0ff82370991d -r 8c1f1f334275 src/tft.asm --- a/src/tft.asm Mon Aug 10 15:34:38 2020 +0200 +++ b/src/tft.asm Thu Oct 29 09:29:15 2020 +0100 @@ -231,8 +231,8 @@ clrf PORTH RD_L ; LOW RS_L ; LOW - bcf tft_nwr - bcf tft_cs + WR_L + NCS_L bcf tft_nreset bsf tft_power ; inverted... return @@ -550,7 +550,7 @@ movff max_CCPR1L,PRODL bsf tft_is_dimming ; TFT is dimming, ignore ambient sensor btfsc screen_type3 - bra TFT_Display_FadeOut_1 + return ; Do not fade out screen type 3 TFT_Display_FadeOut_0: movff PRODL,CCPR1L ; duty cycle WAITMS d'1' diff -r 0ff82370991d -r 8c1f1f334275 src/tft_outputs.asm --- a/src/tft_outputs.asm Mon Aug 10 15:34:38 2020 +0200 +++ b/src/tft_outputs.asm Thu Oct 29 09:29:15 2020 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File tft_outputs.asm * combined next generation V3.09.5 +; File tft_outputs.asm * combined next generation V3.12.3 ; ; high-level Display Outputs ; @@ -71,12 +71,12 @@ pallet_table: - ; mask disabled memo advice attention warning ; pallet - ; ------------ ----------------- ---------------- --------------- ------------- --------- ---------- - DB color_green, color_lightblue, color_white, color_green, color_yellow, color_red ; standard - DB color_red, color_dark_red, color_orange, color_greenish, color_pink, color_red ; reddish - DB color_cyan, color_dark_green, color_green, color_green, color_cyan, color_red ; greenish - DB color_blue, color_deepblue, color_lightblue, color_greenish, color_orange, color_red ; blueish + ; mask disabled memo advice attention warning ; pallet + ; --------------- ------------------- --------------- --------------- --------------- --------------- -------- + DB color_green, color_lightblue, color_white, color_green, color_yellow, color_red ; standard + DB color_red, color_dark_red, color_orange, color_greenish, color_pink, color_red ; reddish + DB color_cyan, color_dark_green, color_green, color_green, color_cyan, color_red ; greenish + DB color_blue, color_deepblue, color_lightblue,color_greenish, color_orange, color_red ; blueish ;============================================================================= @@ -927,7 +927,7 @@ ; Helper Function - set font color TFT_surfmode_startgas_helper: - movf pallet_color_disabled,W + movf pallet_color_disabled,W ; set default color tstfsz hi ; gas not disabled? movf pallet_color_memo,W ; YES - change to memo color movwf font_color ; set font color @@ -2017,8 +2017,8 @@ IFDEF _external_sensor - movff opt_ccr_mode,WREG ; get setpoint mode =0: Fixed SP, =1: Sensor, =2: Auto SP - sublw .1 ; opt_ccr_mode = 1 (Sensor) ? + movf dive_ccr_mode,W ; get setpoint mode =0: Fixed SP, =1: Sensor, =2: Auto SP + sublw .1 ; dive_ccr_mode = 1 (Sensor) ? bnz TFT_active_sp_label_2 ; NO - skip btfsc alt_layout_active ; YES - in alternative layout? bra TFT_active_sp_label_2 ; YES - no space available for the "*" @@ -2949,9 +2949,9 @@ movff int_O_TST_alt+1,WREG ; get high byte of the alternative total stops time btfsc WREG,int_is_zero ; total stops time = zero ? bra TFT_display_ftts_9 ; YES - show "NDL" - movff char_O_deco_info,WREG ; NO - get deco info vector - btfsc WREG,deco_zone ; - fTTS <= TTS ? - FONT_COLOR_ADVICE ; YES - set to advice color (green) + movff char_O_deco_info,WREG ; NO - get deco info vector + btfsc WREG,deco_zone ; - fTTS <= TTS ? + FONT_COLOR_ADVICE ; YES - set to advice color (green) TFT_display_ftts_7: bsf leftbind ; print left-aligned output_999 ; print ascent time (0-999) @@ -4716,7 +4716,7 @@ addwf win_leftx2,F ; add to base position movlw color_yellow ; color for GF high line BOX_COLOR ; draw line - bra TFT_dive_tissues_4 ; continue with number of leading tissue + bra TFT_dive_tissues_4 ; continue with number of leading tissue IFDEF _helium TFT_dive_tissues_3: @@ -6040,20 +6040,46 @@ ELSE - btfsc alt_layout_active ; alternative layout active? - return ; YES - abort +; btfsc alt_layout_active ; alternative layout active? +; return ; YES - abort WIN_TINY .100,.30 ; surface mode: fits under the textual logo in the upper right corner ; WIN_TINY .35, .0 ; dive mode: fits to the right side of the depth label ; WIN_TINY .0, . 0 ; dive mode: overwrites depth label FONT_COLOR_MEMO ; set color - - movff analog_sw1,mpr + + movff max_CCPR1L,lo + output_256 + PUTC "," + movff analog_sw2,lo; left + output_256 + PUTC "," + movff analog_sw1,lo; right output_256 - PUTC ',' - movff analog_sw2,mpr - output_256 - + +; ; deco engine scheduling performance +; MOVII int_O_profiling_overrun,mpr ; runtime +/- versus target +; btfss mpr+1,7 ; overrun? +; bra TFT_debug_output_1 ; YES +; bcf mpr+1,7 ; NO - clear flag +; PUTC "-" ; - print a minus +; bra TFT_debug_output_2 ; - continue +;TFT_debug_output_1: +; PUTC " " ; print a space instead of the minus +;TFT_debug_output_2: +; output_999 ; print time (0-999) +; PUTC "." ; print a dot as separator +; MOVII int_O_profiling_overrun_max,mpr ; get max runtime so far +; output_999 ; print (0-999) +; PUTC "." ; print a dot as separator +; movff char_O_profiling_overrun_phase,WREG ; get calculation phase causing the max runtime +; output_hex ; print a hex +; PUTC "." ; print a dot as separator +; movff char_O_profiling_runs_norm,mpr ; get runs/cycle normal plan +; output_99 ; print (0-99) +; PUTC "." ; print a dot as separator +; movff char_O_profiling_runs_alt,mpr ; get runs/cycle alternative plan +; output_99 ; print (0-99) PRINT ; dump to screen return ; done