Mercurial > public > hwos_code
changeset 645:070528a88715
3.16 release
author | heinrichsweikamp |
---|---|
date | Sun, 07 Nov 2021 12:39:23 +0100 |
parents | 1e695355dfc4 |
children | ef2ed7e3a895 |
files | src/adc_lightsensor.asm src/compass_ops.asm src/configuration.inc src/divemode.asm src/hwos.asm src/hwos.inc src/i2c.asm src/isr.asm src/logbook.asm src/menu_tree.asm src/ms5541.asm src/option_table.asm src/options.asm src/text_english.inc src/text_french.inc src/text_german.inc src/text_italian.inc src/tft.asm src/tft_outputs.asm |
diffstat | 19 files changed, 98 insertions(+), 78 deletions(-) [+] |
line wrap: on
line diff
--- a/src/adc_lightsensor.asm Mon May 24 18:41:51 2021 +0200 +++ b/src/adc_lightsensor.asm Sun Nov 07 12:39:23 2021 +0100 @@ -262,7 +262,7 @@ btfsc ambient_sensor ; - ambient sensor available? bra get_ambient_level1 ; YES - use sensor banksel isr_backup ; NO - back to ISR default bank - movff opt_brightness,isr_lo ; - get brightness selection + movff brightness,isr_lo ; - get brightness selection incf isr_lo,F ; - 0-2 -> 1-3 movlw ambient_light_max_high_cr ; - default selection to brightest setting dcfsnz isr_lo,F ; - level 0 (eco) selected? @@ -307,7 +307,7 @@ movwf ambient_light+0 ; avoid ADC clipping get_ambient_level2: - movff opt_brightness,isr_lo ; get brightness setting + movff brightness,isr_lo ; get brightness setting btfsc RCSTA1,7 ; UART module on? clrf isr_lo ; YES - set temporary to eco mode @@ -331,7 +331,7 @@ cpfslt ambient_light+0 ; smaller than WREG? movwf ambient_light+0 ; NO - set to max. - movff opt_brightness,isr_lo ; get brightness setting + movff brightness,isr_lo ; get brightness setting incf isr_lo,F ; adjust 0-2 to 1-3 movlw ambient_light_min_high ; default to highest setting dcfsnz isr_lo,F ; eco setting?
--- a/src/compass_ops.asm Mon May 24 18:41:51 2021 +0200 +++ b/src/compass_ops.asm Sun Nov 07 12:39:23 2021 +0100 @@ -313,6 +313,10 @@ ; btfsc compass_type1 ; compass1? ; bra compass_calibration_loop3 ; YES - skip gain stuff + banksel opt_compass_gain ; select bank options table + tstfsz opt_compass_gain ; =0? + bra $+4 ; No + bra compass_calibration_loop3 ; YES - skip gain stuff ; Test all axes for +4096 (Hi byte=16) banksel compass_DX ; select bank common2 movlw .16 @@ -337,19 +341,9 @@ cpfseq compass_DZ+1 bra $+4 bra compass_calibration_gainset - banksel common ; back to bank common - -; ; Three -; call I2C_RX_compass ; read compass -; call I2C_RX_accelerometer ; test accelerometer -; call compass_filter ; filter compass raw data -; -; ; Four times to get cleaner values -; call I2C_RX_compass ; read compass -; call I2C_RX_accelerometer ; test accelerometer -; call compass_filter ; filter compass raw data compass_calibration_loop3: + banksel common ; back to bank common ; and register only one value out of four: call compass_add_calibration ; check and store new max/min values (C-code) banksel common ; back to bank common
--- a/src/configuration.inc Mon May 24 18:41:51 2021 +0200 +++ b/src/configuration.inc Sun Nov 07 12:39:23 2021 +0100 @@ -24,7 +24,7 @@ #endif #define fw_version_major 0x03 -#define fw_version_minor 0x0F +#define fw_version_minor 0x10 #define fw_version_beta 0x00 @@ -43,12 +43,12 @@ #endif #define firmware_creation_year 0x15 -#define firmware_creation_month 0x05 -#define firmware_creation_day 0x15 +#define firmware_creation_month 0x0A +#define firmware_creation_day 0x0E #define firmware_expire_year 0x17 #define firmware_expire_month 0x0A -#define firmware_expire_day 0x1C +#define firmware_expire_day 0x0E #ifdef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
--- a/src/divemode.asm Mon May 24 18:41:51 2021 +0200 +++ b/src/divemode.asm Sun Nov 07 12:39:23 2021 +0100 @@ -554,7 +554,7 @@ movwf alarm_type ; - copy to alarm register bsf event_occured ; - set event flag movlw .0 ; - coding of brightness level ECO - movff WREG,opt_brightness ; - set brightness to ECO + movff WREG,opt_brightness_divemode ; - set brightness to ECO update_divemode60_1: ; max allowed runtime in simulator is 254 minutes in @@ -1973,11 +1973,16 @@ bra check_dive_modes_shallow ; NO - shallower than threshold btfsc divetime_longer_1min ; YES - diving > one minute? CLRI dive_timeout_timer ; YES - reset timeout counter + decfsz dive_threshold_debounce,F ; debounce counter + return + incf dive_threshold_debounce,F bsf divemode ; - set dive mode flag bsf count_divetime ; - count dive time return ; - done check_dive_modes_shallow: + movlw .5 ; load debounce counter + movwf dive_threshold_debounce 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
--- a/src/hwos.asm Mon May 24 18:41:51 2021 +0200 +++ b/src/hwos.asm Sun Nov 07 12:39:23 2021 +0100 @@ -181,7 +181,7 @@ bcf RCON,IPEN ; priority interrupts off banksel WDTCON - movlw b'10000000' ; setup watchdog + movlw b'00010000' ; setup watchdog, put VCORE Reg into Ultra Low-Power mode in Sleep movwf WDTCON ; ...
--- a/src/hwos.inc Mon May 24 18:41:51 2021 +0200 +++ b/src/hwos.inc Sun Nov 07 12:39:23 2021 +0100 @@ -1320,7 +1320,8 @@ 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 - +dive_threshold_debounce res 1 ; Countdown for entering dive mode + IFDEF _ccr_pscr best_dil_number res 1 ; number of the "best dil": 0= none found, 1-5= dils 1-5, 255= not computed active_dil res 1 ; the currently used diluent (1-5) @@ -1594,8 +1595,9 @@ i2c_error_vault res 2 ; Store last used device ID and data byte D1_buffer res 3 ; Buffer of D1 (Sensor raw data) D2_buffer res 3 ; Buffer of D2 (Sensor raw data) - -; 156 byte used, 93 byte free + +brightness res 1 ; =0: Eco, =1:Medium, =2:Full +; 157 byte used, 92 byte free ;----------------------------------------------------------------------------- @@ -1661,7 +1663,8 @@ opt_fw_version_minor res 1 ; firmware version, minor | opt_fw_version_beta res 1 ; firmware version, beta | opt_surface_interval res 1 ; surface interval, used by deco calculator -opt_brightness res 1 ; =0: Eco, =1:Medium, =2:Full +opt_brightness_divemode res 1 ; =0: Eco, =1:Medium, =2:Full +opt_brightness_surface res 1 ; =0: Eco, =1:Medium, =2:Full opt_salinity res 1 ; 0-5% opt_language res 1 ; current language: 0=EN, 1=DE, 2=FR, 3=SP opt_units res 1 ; 0:m/°C, 1:ft/°F
--- a/src/i2c.asm Mon May 24 18:41:51 2021 +0200 +++ b/src/i2c.asm Sun Nov 07 12:39:23 2021 +0100 @@ -756,13 +756,13 @@ rcall I2C_TX ; send byte movlw 0xA0 ; 0x20 with auto-increment (MSB=1) rcall I2C_TX ; send byte - movlw b'01110000' ; CTRL_REG1_M (10Hz) 0x20 + movlw b'01110000' ; CTRL_REG1_M (10Hz, X and Y in Ultra-high performance mode) 0x20 rcall I2C_TX ; send byte movlw b'01100000' ; CTRL_REG2_M (Full-scale: +/- 16gauss) 0x21 rcall I2C_TX ; send byte movlw b'01000000' ; CTRL_REG3_M (Continuous) 0x22 rcall I2C_TX ; send byte - movlw b'00000000' ; CTRL_REG4_M (Z in Low-power mode) 0x23 + movlw b'00001100' ; CTRL_REG4_M (Z in Ultra-high performance mode) 0x23 rcall I2C_TX ; send byte movlw b'00000000' ; CTRL_REG5_M 0x24 rcall I2C_TX ; send byte
--- a/src/isr.asm Mon May 24 18:41:51 2021 +0200 +++ b/src/isr.asm Sun Nov 07 12:39:23 2021 +0100 @@ -657,6 +657,7 @@ rcall isr_update_uptime ; increment overall OSTC uptime rcall isr_update_timeout ; process the timeout timer + movff opt_brightness_surface,brightness ; copy brightness - will be overwritten with opt_brightness_dive if in dive mdoe btfsc divemode ; in dive mode? rcall isr_divemode_1sec ; YES - do the every second dive mode tasks @@ -814,6 +815,7 @@ ; Every Second Tasks while in Dive Mode ; isr_divemode_1sec: + movff opt_brightness_divemode,brightness ; copy brightness for dive mode decfsz sampling_timer,F ; decrement sampling timer, became zero? bra isr_divemode_1sec_1 ; NO bsf trigger_sample_divedata ; YES - set trigger flag for sampling dive data @@ -866,6 +868,7 @@ return ; - done isr_divemode_1sec_4: ; at surface + movff opt_brightness_surface,brightness ; copy brightness btfss FLAG_apnoe_mode ; in apnoe mode? return ; NO - done bsf apnoe_at_surface ; YES - memorize been at the surface
--- a/src/logbook.asm Mon May 24 18:41:51 2021 +0200 +++ b/src/logbook.asm Sun Nov 07 12:39:23 2021 +0100 @@ -1575,12 +1575,15 @@ call TFT_surf_cv_tissues ; calculate time/date of the end of the dive - MOVTT header_buffer+index_date, rtc_latched_year ; get start of the dive - year, month, day - MOVII header_buffer+index_time, rtc_latched_hour ; get start of the dive - hour, minute - MOVCC header_buffer+index_divetime+2,rtc_latched_secs ; get duration of the dive - seconds - MOVII header_buffer+index_divetime+0,mpr ; get duration of the dive - minutes - call rtc_add_minutes ; add minutes in mpr to time/date in rtc_latched - + MOVTT header_buffer+index_date,rtc_latched_year ; get start of the dive - year, month, day + MOVII header_buffer+index_time,rtc_latched_hour ; get start of the dive - hour, minute + MOVII header_buffer+index_total_seconds,mpr ; get total dive duration in seconds into hi:lo + call convert_time ; convert seconds (in hi:lo) into minutes (in up:hi) and seconds (in lo) + MOVCC lo,rtc_latched_secs ; set duration of the dive - seconds + MOVCC hi,lo ; set duration of the dive - minutes, low byte + MOVCC up,hi ; set duration of the dive - minutes, high byte + call rtc_add_minutes ; add minutes in hi:lo to time/date in rtc_latched + ; print time/date of the end of the dive WIN_SMALL .8,.193 ; select font and output position MOVTT rtc_latched_year,mpr ; get computed end-of-dive date
--- a/src/menu_tree.asm Mon May 24 18:41:51 2021 +0200 +++ b/src/menu_tree.asm Sun Nov 07 12:39:23 2021 +0100 @@ -1537,7 +1537,7 @@ do_menu_dispsets: IF _language_2!=none MENU_BEGIN tDispSets, .7 - MENU_OPT_INC tBright, oBrightness + MENU_CALL tBright, do_menu_Brightness MENU_OPT_INC tLayout, oLayout MENU_OPT_INC tUnits, oUnits MENU_OPT_INC tLanguage, oLanguage @@ -1547,7 +1547,7 @@ MENU_END ELSE MENU_BEGIN tDispSets, .6 - MENU_OPT_INC tBright, oBrightness + MENU_CALL tBright, do_menu_Brightness MENU_OPT_INC tLayout, oLayout MENU_OPT_INC tUnits, oUnits MENU_OPT_INC tFlip, oFlipScreen @@ -1556,7 +1556,17 @@ MENU_END ENDIF +;----------------------------------------------------------------------------- +; Settings Menu - 3rd Layer - Display Settings - Brightness +; +do_menu_Brightness: + MENU_BEGIN tBright, .3 + MENU_OPT_INC tDvMode, oBrightness_dive + MENU_OPT_INC tBrightsurface, oBrightness_surface + MENU_CALL tBack, do_return_dispsets_menu + MENU_END + ;----------------------------------------------------------------------------- ; Settings Menu - 3rd Layer - Display Settings - Color Schemes ;
--- a/src/ms5541.asm Mon May 24 18:41:51 2021 +0200 +++ b/src/ms5541.asm Sun Nov 07 12:39:23 2021 +0100 @@ -281,12 +281,6 @@ call isr_div32x16 ; isr_xC:4 = isr_xC:4 / isr_xB:2 with isr_xA as remainder ; isr_xC:2 equals pressure in 1mbar - ; subtract 20mbar from the final result - movlw .20 - subwf isr_xC+0,F - movlw .0 - subwfb isr_xC+1,F - ; copy for compatibility of the next routines movff isr_xC+1,isr_xC+2 movff isr_xC+0,isr_xC+1 @@ -613,7 +607,24 @@ btfsc press_sensor_type ; New sensor found? call I2C_get_calib_MS5837 ; Yes, read C1 to C6 banksel isr_backup ; select bank ISR data + ; double-check sensor type + movlw 0xED + cpfseq C1+0 + bra get_calibration_data1 ; Not 0xED (I2C address false reading) + movlw 0xED + cpfseq C1+1 + bra get_calibration_data1 ; Not 0xED (I2C address false reading) + movlw 0xED + cpfseq C5+0 + bra get_calibration_data1 ; Not 0xED (I2C address false reading) + movlw 0xED + cpfseq C5+1 + bra get_calibration_data1 ; Not 0xED (I2C address false reading) + ; C1 and C5 are 0xEDED -> NOT Sensor 1 + bcf press_sensor_type + +get_calibration_data1: btfsc press_sensor_type ; New sensor found? bra get_calibration_data2 ; Yes, skip to the end
--- a/src/option_table.asm Mon May 24 18:41:51 2021 +0200 +++ b/src/option_table.asm Sun Nov 07 12:39:23 2021 +0100 @@ -152,7 +152,7 @@ ; Managing Settings OPTION_UINT8 oExtraTime, .0, .9, .0, tMinutes, 0x028, 0x24, char_I_extra_time ; extra bottom time for future TTS calculation - OPTION_ENUM8 oBrightness, .3, .0, tEco, 0x029, 0x2D, opt_brightness ; =0: Eco, =1:Medium, =2:Full + OPTION_ENUM8 oBrightness_dive, .3, .0, tEco, 0x029, 0x2D, opt_brightness_divemode ; =0: Eco, =1:Medium, =2:Full OPTION_UINT8 oDiveSalinity, salinity_min, salinity_max, .0, tPercent, 0x02A, 0x30, opt_salinity ; 0-4% OPTION_ENUM8 oCCRMode, .3, .0, tCCRModeFixedSP, 0x02B, 0x1F, opt_ccr_mode ; =0: Fixed SP, =1: Sensor, =2: Auto SP OPTION_ENUM8 oLanguage, .2, .0, tLang1, 0x02C, 0x32, opt_language ; language selection @@ -274,7 +274,7 @@ OPTION_UINT8 oPressureAdjust, .0, .255, .0, nounit, 0x0A5, 0x35, opt_pressure_adjust ; pressure sensor correction, SIGNED int (clipped to -20/+20 mbar in code) OPTION_BOOL oSafetyStop, .0, 0x0A6, 0x36, opt_safetystop ; =1: show safety stops OPTION_UINT8 oCalGasO2, .21, .100, .21, tPercent, 0x0A7, 0x37, opt_calibration_O2_ratio ; calibration gas %O2 (do not move in EEPROM, must stay at .149!) - ; 0x0A8 ; not used any more (ex opt_sensor_fallback) + OPTION_ENUM8 oBrightness_surface, .3, .2, tEco, 0x0A8, 0x38, opt_brightness_surface ; =0: Eco, =1:Medium, =2:Full OPTION_BOOL oFlipScreen, .0, 0x0A9, 0x39, opt_flip_screen ; =1: flip the screen OPTION_UINT8p10 ocR_button_left, .20, .80, .40, tPercent, 0x0AA, 0x3A, opt_cR_button_left ; left button sensitivity OPTION_UINT8p10 ocR_button_right, .20, .80, .40, tPercent, 0x0AB, 0x3B, opt_cR_button_right ; right button sensitivity
--- a/src/options.asm Mon May 24 18:41:51 2021 +0200 +++ b/src/options.asm Sun Nov 07 12:39:23 2021 +0100 @@ -422,13 +422,19 @@ retlw .1 ; YES - option not found, abort option_write_serial_execute: - rcall option_check_loaded ; check if new value is valid - btfss option_value_ok ; value valid? - retlw .2 ; NO - value not valid, abort - movff hi,INDF1 ; YES - take new value - btfss opt_eeprom_bank,7 ; - volatile option? - bsf option_changed ; NO - flag that EEPROM needs to be updated - retlw .0 ; - done + rcall option_check_loaded ; check if new value is valid + btfss option_value_ok ; value valid? + bra option_write_serial_invalid ; NO + movff hi,INDF1 ; YES - take new value + btfss opt_eeprom_bank,7 ; - volatile option? + bsf option_changed ; NO - flag that EEPROM needs to be updated + retlw .0 ; - done + +option_write_serial_invalid: + movlw 0x32 ; load serial id of the language option (oLanguage) + cpfseq lo ; option to write = language option ? + retlw .2 ; NO - value not valid, abort + retlw .0 ; YES - value not valid, but silently ignore ;-----------------------------------------------------------------------------
--- a/src/text_english.inc Mon May 24 18:41:51 2021 +0200 +++ b/src/text_english.inc Sun Nov 07 12:39:23 2021 +0100 @@ -287,7 +287,8 @@ ; Display settings - TCODE tBright, "Brightness: " ; Brightness + TCODE tBright, "Brightness" ; Brightness + TCODE tBrightsurface, "Surface Mode: " ; Surface Mode: TCODE tLayout, "Layout : " ; Layout TCODE tUnits, "Units : " ; Units IF _language_2!=none
--- a/src/text_french.inc Mon May 24 18:41:51 2021 +0200 +++ b/src/text_french.inc Sun Nov 07 12:39:23 2021 +0100 @@ -287,7 +287,8 @@ ; Display Settings - TCODE tBright, "Luminosité: " ; Brightness + TCODE tBright, "Luminosité" ; Brightness + TCODE tBrightsurface, "Mode Surface: " ; ...Surface TCODE tLayout, "Affichage : " ; Layout TCODE tUnits, "Unités : " ; Units IF _language_2!=none @@ -332,8 +333,8 @@ ; 5 rows by 12 chars each: 123456789012123456789012123456789012123456789012123456789012 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 tButtonExplain1, "% plus faible" ; Less % is + TCODE tButtonExplain2, "= plus sensible." ; more sensitive. TCODE tButtonleft, "Bouton gauche:" ; Left button TCODE tButtonright, "Bouton droit :" ; Right button TCODE tAltMode, "Temps Attente:" ; Waiting Time
--- a/src/text_german.inc Mon May 24 18:41:51 2021 +0200 +++ b/src/text_german.inc Sun Nov 07 12:39:23 2021 +0100 @@ -287,7 +287,8 @@ ; Display Settings - TCODE tBright, "Helligkeit: " ; Brightness + TCODE tBright, "Helligkeit" ; Brightness + TCODE tBrightsurface, "Oberfläche : " ; ...Surface TCODE tLayout, "Layout : " ; Layout TCODE tUnits, "Einheiten : " ; Units IF _language_2!=none
--- a/src/text_italian.inc Mon May 24 18:41:51 2021 +0200 +++ b/src/text_italian.inc Sun Nov 07 12:39:23 2021 +0100 @@ -287,7 +287,8 @@ ; Display Settings - TCODE tBright, "Luminosita': " ; Brightness + TCODE tBright, "Luminosita'" ; Brightness + TCODE tBrightsurface, "Superficie : " ; ...Surface TCODE tLayout, "Layout : " ; Layout TCODE tUnits, "Unita' : " ; Units IF _language_2!=none
--- a/src/tft.asm Mon May 24 18:41:51 2021 +0200 +++ b/src/tft.asm Sun Nov 07 12:39:23 2021 +0100 @@ -430,7 +430,7 @@ rcall TFT_ClearScreen setf CCPR1L ; duty cycle, 255 is required for OLED ; Set brightness - movff opt_brightness,PRODL ; =0: Eco, =1:Medium, =2:Full + movff brightness,PRODL ; =0: Eco, =1:Medium, =2:Full incf PRODL,F ; +1 dcfsnz PRODL,F rcall TFT_display3_low
--- a/src/tft_outputs.asm Mon May 24 18:41:51 2021 +0200 +++ b/src/tft_outputs.asm Sun Nov 07 12:39:23 2021 +0100 @@ -6070,30 +6070,11 @@ ; WIN_TINY .0, . 0 ; dive mode: overwrites depth label FONT_COLOR_MEMO ; set color - movff D1+2,lo - output_256 - PUTC "," - movff D1+0,lo - movff D1+1,hi - output_65535 - PRINT - WIN_TINY .100,.45 ; surface mode: fits under the textual logo in the upper right corner - movff D2+2,lo + movff ambient_light+0,lo output_256 PUTC "," - movff D2+0,lo - movff D2+1,hi - output_65535 - PRINT - WIN_TINY .100,.60 ; surface mode: fits under the textual logo in the upper right corner -; movf HW_flags_state3,W -; output_hex -; PUTC "," - movff max_CCPR1L,lo - output_256 - PUTC "," - movff divesecs_avg_trip+0,lo - movff divesecs_avg_trip+1,hi + movff ambient_light+0,lo + movff ambient_light+1,hi output_65535