Mercurial > public > hwos_code
changeset 235:23311219dacc
under construction: new hardware_flag to configure different hardware versions
author | heinrichsweikamp |
---|---|
date | Wed, 25 Feb 2015 16:49:59 +0100 |
parents | 57155164faad |
children | e2ea74646127 |
files | doc/ostc3_interface.odt src/adc_lightsensor.asm src/calibrate.asm src/comm.asm src/eeprom_rs232.asm src/i2c.asm src/isr.asm src/menu_tree.asm src/ostc3.inc src/sleepmode.asm src/start.asm src/surfmode.asm src/tft_outputs.asm |
diffstat | 13 files changed, 60 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/src/adc_lightsensor.asm Wed Feb 25 13:57:30 2015 +0100 +++ b/src/adc_lightsensor.asm Wed Feb 25 16:49:59 2015 +0100 @@ -27,7 +27,7 @@ global get_battery_voltage get_battery_voltage: ; starts ADC and waits until fnished - btfss cr_hardware + btfss rechargeable bra get_battery_voltage1 ; Normal ostc3 hardware call lt2942_get_accumulated_charge @@ -234,7 +234,7 @@ btfsc adc_running ; ADC in use? return ; Yes, return - btfss cr_hardware + btfss rechargeable bra get_ambient_level1 ; Normal ostc3 hardware banksel isr_backup ; Back to Bank0 ISR data @@ -303,7 +303,7 @@ banksel common ; flag is in bank1 movlw ambient_light_max_high_cr; cR hardware brightest setting - btfss cr_hardware + btfss rechargeable movlw ambient_light_max_high_15V; 1,5V battery brightest setting btfsc battery_is_36v ; 3,6V battery in use? movlw ambient_light_max_high_36V ; 3,6V battery brightest setting
--- a/src/calibrate.asm Wed Feb 25 13:57:30 2015 +0100 +++ b/src/calibrate.asm Wed Feb 25 16:49:59 2015 +0100 @@ -274,7 +274,7 @@ global compute_ppo2 ; compute mv_sensorX and ppo2_sensorX arrays compute_ppo2: - btfss cr_hardware ; cR hardware? + btfss rechargeable ; cR hardware? return ; No btfss s8_digital ; =1: Digital I/O
--- a/src/comm.asm Wed Feb 25 13:57:30 2015 +0100 +++ b/src/comm.asm Wed Feb 25 16:49:59 2015 +0100 @@ -94,7 +94,7 @@ dcfsnz timeout_counter,F bra comm_service_exit ; Timeout -> Exit comm_mode2: - btfsc cr_hardware + btfsc rechargeable bra comm_mode4 ; Skip call get_battery_voltage ; gets battery voltage @@ -484,6 +484,10 @@ cpfseq RCREG1 bra $+4 bra comm_identify ; Send firmware, serial, etc. + movlw "j" + cpfseq RCREG1 + bra $+4 + bra comm_hardware_descriptor ; Send hardware descriptor byte movlw "n" cpfseq RCREG1 bra $+4 @@ -724,6 +728,17 @@ bra comm_download_mode0 ; Done. +;----------------------------------------------------------------------------- +; Reply hardware descriptor byte +; + +comm_hardware_descriptor: + movlw "j" ; send echo + movwf TXREG1 + call rs232_wait_tx ; wait for UART + movff hardware_flag,TXREG1 + call rs232_wait_tx ; wait for UART + bra comm_download_mode0 ; Done. ;-----------------------------------------------------------------------------
--- a/src/eeprom_rs232.asm Wed Feb 25 13:57:30 2015 +0100 +++ b/src/eeprom_rs232.asm Wed Feb 25 16:49:59 2015 +0100 @@ -83,7 +83,7 @@ global enable_ir_s8 enable_ir_s8: ;init serial port2 (TRISG2) - btfsc cr_hardware + btfsc rechargeable bra enable_s8 ; Start S8 banksel BAUDCON2
--- a/src/i2c.asm Wed Feb 25 13:57:30 2015 +0100 +++ b/src/i2c.asm Wed Feb 25 16:49:59 2015 +0100 @@ -403,14 +403,14 @@ global lt2942_get_status lt2942_get_status: ; Read status register - bcf cr_hardware ; Clear flag + bcf rechargeable ; Clear flag clrf i2c_temp movlw 0x00 ; Point to Status reg call I2C_TX_GAUGE call I2C_RX_GAUGE movff SSP1BUF,WREG btfss WREG,7 ; 2942 found? - bsf cr_hardware ; Yes, set flag + bsf rechargeable ; Yes, set flag bsf SSP1CON2,PEN ; Stop condition rcall WaitMSSP return
--- a/src/isr.asm Wed Feb 25 13:57:30 2015 +0100 +++ b/src/isr.asm Wed Feb 25 16:49:59 2015 +0100 @@ -279,7 +279,7 @@ movwf ir_S8_timeout ; Reload timeout banksel common - btfss cr_hardware + btfss rechargeable bra isr_tmr7_1a ; Always with normal ostc3 hardware btfss s8_digital bra isr_tmr7_2 ; only when digital
--- a/src/menu_tree.asm Wed Feb 25 13:57:30 2015 +0100 +++ b/src/menu_tree.asm Wed Feb 25 16:49:59 2015 +0100 @@ -71,7 +71,7 @@ do_ccr_menu: bcf menu_show_sensors ; Clear flag bcf menu_show_sensors2 ; Clear flag - btfsc cr_hardware + btfsc rechargeable bra do_ccr_menu_c3 MENU_BEGIN tCCRSetup, .5 MENU_OPTION tCCRMode, oCCRMode, 0 @@ -325,7 +325,7 @@ do_settings_menu_more: - btfsc cr_hardware + btfsc rechargeable bra do_settings_menu_more_c3 MENU_BEGIN tSystSets, .6
--- a/src/ostc3.inc Wed Feb 25 13:57:30 2015 +0100 +++ b/src/ostc3.inc Wed Feb 25 16:49:59 2015 +0100 @@ -204,6 +204,16 @@ #DEFINE compass_fast_treshold .9 ; show new heading instantly if new and old > compass_fast_treshold #DEFINE compass_averaging .10 ; numbers of extra averaging +; Hardware defines +#DEFINE rechargeable hardware_flag,0 ; OSTC has rechargeable battery with battery management chip +#DEFINE ambient_sensor hardware_flag,1 ; OSTC has an ambient sensor +#DEFINE analog_o2_input hardware_flag,2 ; OSTC has analog inputs and S8 digital +#DEFINE optical_input hardware_flag,3 ; OSTC has an digital optical input +#DEFINE ble_available hardware_flag,4 ; OSTC has an BLE module +;unused +;unused +;unused + ;---------------------------- Macros ------------------------------------ TSTOSS macro opt_reg ; TeST Option Skip if not Zero @@ -340,6 +350,8 @@ flag10 res 1 flag11 res 1 +hardware_flag res 1 ; hardware descriptor flag + temp1 res 1 temp2 res 1 @@ -444,7 +456,6 @@ apnoe_timeout_counter res 1 apnoe_surface_mins res 1 apnoe_surface_secs res 1 -tft_gaslist_temp res 1 ; Profile storing AlarmType res 1 @@ -630,7 +641,7 @@ #DEFINE show_safety_stop flag9,4 ; =1: Show the safety stop #DEFINE safety_stop_active flag9,5 ; =1: The safety stop is currently displayed #DEFINE new_s8_data_available flag9,6 ; =1: New data frame recieved -#DEFINE cr_hardware flag9,7; =1: OSTC cR hardware +; unused #DEFINE s8_digital flag10,0; =1: Digital I/O #DEFINE menu_show_sensors2 flag10,1; =1: Update mV data in calibration menu
--- a/src/sleepmode.asm Wed Feb 25 13:57:30 2015 +0100 +++ b/src/sleepmode.asm Wed Feb 25 16:49:59 2015 +0100 @@ -125,7 +125,7 @@ btfsc oneminupdate ; one minute in sleep? rcall onemin_sleep ; do oneminute tasks, e.g. calculate desaturation - btfsc cr_hardware + btfsc rechargeable call get_battery_voltage ; Check for charger incf divemins+0,F ; counts to #test_pressure_in_sleep (5) @@ -145,7 +145,7 @@ btfsc neg_flag ; Wake up from Sleep? bra onesec_sleep1a ; Yes, skip button checks, wake up! - btfsc cr_hardware + btfsc rechargeable bra onesec_sleep1 ; No wake-up with cR hardware btfsc vusb_in ; USB plugged in? bra onesec_sleep1a ; Yes, skip button checks, wake up!
--- a/src/start.asm Wed Feb 25 13:57:30 2015 +0100 +++ b/src/start.asm Wed Feb 25 16:49:59 2015 +0100 @@ -139,7 +139,7 @@ goto use_old_batteries ; No, load last stored battery values call lt2942_get_status ; Check for gauge IC - btfsc cr_hardware ; cR hardware? + btfsc rechargeable ; cR hardware? goto use_old_batteries ; Yes, load last stored battery values ; No, cR and we have a power-on reset @@ -253,10 +253,11 @@ clrf flag8 clrf flag9 clrf flag10 - bsf tft_is_dimming ; TFT is dimming up (soon), ignore ambient sensor! + clrf hardware_flag ; hardware descriptor flag + bsf tft_is_dimming ; TFT is dimming up (soon), ignore ambient sensor! call lt2942_get_status ; Check for gauge IC - btfsc cr_hardware ; cR hardware? + btfsc rechargeable ; cR hardware? call lt2942_init ; Yes, init battery gauge IC ; Select high altitude (Fly) mode? @@ -270,9 +271,9 @@ btfss neg_flag ; Result negative (Ambient>880mbar)? bsf high_altitude_mode ; No, Set Flag! - btfss cr_hardware + btfss rechargeable bsf TRISB,3 - btfss cr_hardware + btfss rechargeable bsf TRISG,0 call ext_flash_disable_protection ; Disable write protection for external flash
--- a/src/surfmode.asm Wed Feb 25 13:57:30 2015 +0100 +++ b/src/surfmode.asm Wed Feb 25 16:49:59 2015 +0100 @@ -84,7 +84,7 @@ clrf ext_flash_address+1 clrf ext_flash_address+2 - btfsc cr_hardware + btfsc rechargeable call piezo_config ; Configure buttons clrf timeout_counter2
--- a/src/tft_outputs.asm Wed Feb 25 13:57:30 2015 +0100 +++ b/src/tft_outputs.asm Wed Feb 25 16:49:59 2015 +0100 @@ -866,20 +866,20 @@ WIN_SMALL dive_custom_dyn_mask_column1,dive_custom_dyn_mask_row1 movlw .1 - movwf tft_gaslist_temp+0 + movwf temp1 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint rcall TFT_dyn_gaslist_common WIN_SMALL dive_custom_dyn_mask_column1,dive_custom_dyn_mask_row2 - incf tft_gaslist_temp+0,F ; +1 - movf tft_gaslist_temp+0,W ; into W + incf temp1,F ; +1 + movf temp1,W ; into W rcall TFT_dyn_gaslist_common WIN_SMALL dive_custom_dyn_mask_column2,dive_custom_dyn_mask_row1 - incf tft_gaslist_temp+0,F ; +1 - movf tft_gaslist_temp+0,W ; into W + incf temp1,F ; +1 + movf temp1,W ; into W rcall TFT_dyn_gaslist_common WIN_SMALL dive_custom_dyn_mask_column2,dive_custom_dyn_mask_row2 - incf tft_gaslist_temp+0,F ; +1 - movf tft_gaslist_temp+0,W ; into W + incf temp1,F ; +1 + movf temp1,W ; into W rcall TFT_dyn_gaslist_common call TFT_standard_color return @@ -887,9 +887,9 @@ TFT_dyn_gaslist_common: cpfseq active_gas ;1-5 bra $+4 - incf tft_gaslist_temp+0,F ; +1 - movff tft_gaslist_temp+0,lo - movff tft_gaslist_temp+0,PRODL + incf temp1,F ; +1 + movff temp1,lo + movff temp1,PRODL decf PRODL,F ;-1 to have 0-4 bsf leftbind output_8 ; Gas number @@ -1206,7 +1206,7 @@ STRCAT_PRINT "mV " WIN_SMALL surf_menu_sensor4_column,surf_menu_sensor4_row - btfss cr_hardware + btfss rechargeable bra TFT_menu_hud_2 ; always for normal OSTC3 btfss s8_digital return ; Not for analog @@ -2808,7 +2808,7 @@ TFT_serial: WIN_TINY .5,.225 STRCPY "OSTC" ; Won't translate that... - btfsc cr_hardware + btfsc rechargeable bra TFT_serial2 STRCAT "3 #" bra TFT_serial3