Mercurial > public > hwos_code
diff src/menu_tree.asm @ 604:ca4556fb60b9
bump to 2.99beta, work on 3.00 stable
author | heinrichsweikamp |
---|---|
date | Thu, 22 Nov 2018 19:47:26 +0100 |
parents | cb59872ad53d |
children | 6341f6663579 |
line wrap: on
line diff
--- a/src/menu_tree.asm Thu Oct 11 21:06:29 2018 +0200 +++ b/src/menu_tree.asm Thu Nov 22 19:47:26 2018 +0100 @@ -1,6 +1,6 @@ ;============================================================================= ; -; File menu_tree.asm REFACTORED VERSION V2.98 +; File menu_tree.asm REFACTORED VERSION V2.99e ; ; OSTC menus ; @@ -9,7 +9,7 @@ ; HISTORY ; 2011-07-11 : [jDG] Creation. -#include "hwos.inc" ; Mandatory header +#include "hwos.inc" ; mandatory header #include "gaslist.inc" #include "menu_processor.inc" #include "start.inc" @@ -18,7 +18,7 @@ #include "tft.inc" #include "eeprom_rs232.inc" #include "external_flash.inc" -#include "shared_definitions.h" ; Mailbox from/to p2_deco.c +#include "shared_definitions.h" ; mailbox from/to p2_deco.c #include "isr.inc" #include "ghostwriter.inc" #include "adc_lightsensor.inc" @@ -39,15 +39,16 @@ extern rtc_set_rtc extern surfloop extern oColorSetDive + extern option_cleanup_oCCRMode -gui CODE +menu_tree CODE ;============================================================================= ; Main Menu do_return_main_menu: - call menu_processor_double_pop ; drop exit line and back to last line + call menu_processor_double_pop ; drop exit line and back to last line bra do_main_menu_common global do_main_menu @@ -79,7 +80,8 @@ call menu_processor_double_pop ; drop exit line and back to last line do_ccr_menu: - bcf menu_show_sensors2 ; stop imprinting of live sensor values + bcf menu_update_sensor_mv ; stop imprinting of live sensor values + call option_cleanup_oCCRMode ; in pSCR mode, revert AutoSP (2) to calculated SP (0) btfsc analog_o2_input bra do_ccr_menu_cR @@ -94,7 +96,7 @@ MENU_CALL tFixedSetpoints, do_fixed_setpoints MENU_CALL tPSCRMenu, do_PSCR_menu MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 - MENU_CALL tExit, do_return_main_menu + MENU_CALL tBack, do_return_main_menu MENU_END @@ -106,7 +108,7 @@ MENU_CALL tFixedSetpoints, do_fixed_setpoints MENU_CALL tPSCRMenu, do_PSCR_menu MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 - MENU_CALL tExit, do_return_main_menu + MENU_CALL tBack, do_return_main_menu MENU_END ; COMMENTED OUT - currently there is no difference between the OSTC 2 and 3 regarding this menu @@ -117,13 +119,13 @@ ; MENU_CALL tFixedSetpoints, do_fixed_setpoints ; MENU_CALL tPSCRMenu, do_PSCR_menu ; MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 -; MENU_CALL tExit, do_return_main_menu +; MENU_CALL tBack, do_return_main_menu ; MENU_END do_calibrate_menu: - call enable_ir_s8 ; Enable IR/S8-Port - bsf menu_show_sensors2 ; start imprinting of live sensor values + call enable_ir_s8 ; enable IR/S8-Port + bsf menu_update_sensor_mv ; start imprinting of live sensor values do_calibrate_menu2: MENU_BEGIN tCalibrateMenu, .6 @@ -132,30 +134,31 @@ MENU_CALL tDiveHudMask3, 0 MENU_OPTION tCalibrationGas,oCalGasO2, 0 MENU_CALL tCalibrate, do_calibrate_mix - MENU_CALL tExit, do_return_ccr_menu + MENU_CALL tBack, do_return_ccr_menu MENU_END do_calibrate_mix: - call calibrate_mix ; Calibrate with opt_calibration_O2_ratio, also calibrate S8 HUD if connected - WAITMS d'250' ; Wait for HUD v3 + call calibrate_mix ; calibrate with opt_calibration_O2_ratio, also calibrate S8 HUD if connected + WAITMS d'250' ; wait for HUD v3 movlw .9 movff WREG,customview_surfmode ; show sensor mV custom view after restart - goto restart ; Restart into surface mode + goto restart ; restart into surface mode do_diluent_setup: - bsf ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") - bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint - call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth + bsf FLAG_diluent_setup ; setting up diluents + bcf short_gas_decriptions ; do not use short versions of gaslist_strcat_gas_cd and gaslist_strcat_setpoint + bcf better_gas_hint ; do not mark the best gas/diluent (to be used in dive mode only) + call gaslist_cleanup_list ; take care that only one gas can be first MENU_BEGIN tDiluentSetup, .6 - MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu - MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu - MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu - MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu - MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu - MENU_CALL tExit, do_return_ccr_menu + MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu + MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu + MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu + MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu + MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu + MENU_CALL tBack, do_return_ccr_menu MENU_END @@ -163,7 +166,8 @@ call menu_processor_double_pop ; drop exit line and back to last line do_fixed_setpoints: - bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint + bcf short_gas_decriptions ; =1: use short versions of gaslist_strcat_gas_cd and gaslist_strcat_setpoint + bcf better_gas_hint ; do not mark the best gas/diluent (to be used in dive mode only) MENU_BEGIN tFixedSetpoints, .6 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu @@ -171,27 +175,27 @@ MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu - MENU_CALL tExit, do_return_ccr_menu + MENU_CALL tBack, do_return_ccr_menu MENU_END do_edit_sp_menu: - call gaslist_setSP ; Save current item. + movff PRODL,gaslist_gas ; get menu item we came from (0-4) MENU_BEGIN tFixedSetpoints, .5 MENU_DYNAMIC gaslist_strcat_setpoint_0, 0 MENU_CALL tSPPlus, gaslist_spplus MENU_CALL tDepthPlus, gaslist_spdepthplus MENU_CALL tDepthMinus, gaslist_spdepthminus - MENU_CALL tExit, do_return_fixed_setpoints + MENU_CALL tBack, do_return_fixed_setpoints MENU_END do_PSCR_menu: - MENU_BEGIN tPSCRMenu, .3 ; PSCR Menu + MENU_BEGIN tPSCRMenu, .3 ; pSCR Menu MENU_OPTION tPSCR_O2_drop, oPSCR_drop, 0 MENU_OPTION tPSCR_lungratio, oPSCR_lungratio, 0 - MENU_CALL tExit, do_return_ccr_menu + MENU_CALL tBack, do_return_ccr_menu MENU_END ;============================================================================= @@ -200,45 +204,53 @@ do_return_gas_menu: call menu_processor_double_pop ; drop exit line and back to last line - btfsc ccr_diluent_setup ; Return to CCR-Menu? - bra do_diluent_setup ; Yes. + btfsc FLAG_diluent_setup ; return to CCR-Menu? + bra do_diluent_setup ; YES do_gas_menu: - bcf ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") - bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint - call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth + bcf FLAG_diluent_setup ; not setting up diluents + bcf short_gas_decriptions ; do not use short versions of gaslist_strcat_gas_cd and gaslist_strcat_setpoint + bcf better_gas_hint ; do not mark the best gas/diluent (to be used in dive mode only) + call gaslist_cleanup_list ; takes care that only one gas can be first MENU_BEGIN tGaslist, .6 - MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu - MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu - MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu - MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu - MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu - MENU_CALL tExit, do_return_main_menu + MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu + MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu + MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu + MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu + MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu + MENU_CALL tBack, do_return_main_menu MENU_END do_return_edit_gas_menu: + IFDEF _rx_functions + bcf menu_update_tank_pres ; stop imprinting of tank pressure updates + bcf FLAG_pairing_mode ; not in pairing menu any more (back to normal timeout) + ENDIF call menu_processor_pop ; drop exit line and ... do_abort_gas_depth_menu: call menu_processor_pop ; back to last line bra do_edit_gas_menu_common +do_edit_gas_menu: + movff PRODL,gaslist_gas ; get menu item we came from (0-4) + movlw .5 ; offset between gases and diluents + btfsc FLAG_diluent_setup ; in CCR menu? + addwf gaslist_gas,F ; YES - add the offset -do_edit_gas_menu: - call gaslist_setgas ; set gaslist_gas - -do_edit_gas_menu_common: ; keep current gas - MENU_BEGIN tGasEdit, .6 +do_edit_gas_menu_common: + MENU_BEGIN tGasEdit, .7 MENU_DYNAMIC gaslist_gastitle, 0 MENU_DYNAMIC gaslist_MOD_END, 0 MENU_DYNAMIC gaslist_show_type, gaslist_toggle_type - MENU_CALL tSetup_mix, do_setup_mix - MENU_CALL tGasDepth, do_gas_depth_menu - MENU_CALL tExit, do_return_gas_menu + MENU_CALL tSetup_GasMix, do_setup_mix_menu + MENU_DYNAMIC gaslist_GasDepth, do_setup_depth_menu + MENU_CALL tSetup_Tank, do_setup_tank_menu + MENU_CALL tBack, do_return_gas_menu MENU_END -do_setup_mix: +do_setup_mix_menu: MENU_BEGIN tGasEdit, .7 MENU_DYNAMIC gaslist_gastitle, 0 MENU_DYNAMIC gaslist_MOD_END, 0 @@ -246,19 +258,46 @@ MENU_CALL tO2Minus, gaslist_mO2 MENU_CALL tHePlus, gaslist_pHe MENU_CALL tHeMinus, gaslist_mHe - MENU_CALL tExit, do_return_edit_gas_menu + MENU_CALL tBack, do_return_edit_gas_menu + MENU_END + + +do_setup_tank_menu: + IFDEF _rx_functions + btfsc FLAG_tr_enabled ; TR functions enabled? + bra do_setup_tank_menu_rx ; YES + ENDIF + + MENU_BEGIN tSetup_Tank, .6 + MENU_DYNAMIC gaslist_gastitle, 0 + MENU_DYNAMIC gaslist_tank_size_pres, 0 + MENU_CALL tTankSize, gaslist_tank_size + MENU_CALL tTankUsablePress, gaslist_tank_pres + MENU_CALL tCopyDilToOC, gaslist_copy_dil_to_oc + MENU_CALL tBack, do_return_edit_gas_menu MENU_END -do_gas_depth_menu: - movff gaslist_gas,WREG - lfsr FSR1,opt_gas_type ; Read opt_gas_type[WREG] - movff PLUSW1,lo ; Used as temp - movlw .3 ; 3=Deco - btfsc ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") - movlw .2 ; 2=Normal - cpfseq lo - bra do_abort_gas_depth_menu ; Non-Deco gas or "Normal" Diluent, abort! + IFDEF _rx_functions + +do_setup_tank_menu_rx: + setf pairing_slot ; prime slot number with 255 aka -1, used in pairing function + bsf FLAG_pairing_mode ; in pairing menu (longer timeout) + + MENU_BEGIN tSetup_Tank, .7 + MENU_DYNAMIC gaslist_gastitle, 0 + MENU_DYNAMIC gaslist_tank_id_pres, 0 ; when changing position, adopt TFT_menu_tank_pres! + MENU_DYNAMIC gaslist_tank_size_pres, 0 + MENU_CALL tTankPairing, gaslist_tank_pairing + MENU_CALL tTankSize, gaslist_tank_size + MENU_CALL tTankUsablePress, gaslist_tank_pres + MENU_CALL tBack, do_return_edit_gas_menu + MENU_END + + ENDIF + + +do_setup_depth_menu: MENU_BEGIN tGasEdit, .7 MENU_DYNAMIC gaslist_gastitle, 0 @@ -267,12 +306,12 @@ MENU_CALL tDepthPlus, gaslist_pDepth MENU_CALL tDepthMinus, gaslist_mDepth MENU_DYNAMIC gaslist_reset_mod_title, gaslist_reset_mod - MENU_CALL tExit, do_return_edit_gas_menu + MENU_CALL tBack, do_return_edit_gas_menu MENU_END ;============================================================================= -; Simulator menus +; Simulator Menus do_return_planner_menu: call menu_processor_pop ; drop exit line and ... @@ -286,15 +325,32 @@ ; to have correct simulator results after mode changes without prior excursion to surfacemode call option_save_all call restart_set_modes_and_flags - ; Reset dive time/depth to default values + ; reset dive time/depth to default values lfsr FSR0,odiveInterval call option_reset lfsr FSR0,obottomTime call option_reset lfsr FSR0,obottomDepth call option_reset + lfsr FSR0,oSimAGF + call option_reset do_planner_common: + movff opt_dive_mode,WREG ; get dive mode: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR + dcfsnz WREG,W ; subtract one, became zero? + bra do_planner_common_ccr ; YES - use CCR version + + MENU_BEGIN tPlan, .7 + MENU_OPTION tIntvl, odiveInterval, 0 + MENU_OPTION tBtDep, obottomDepth, 0 + MENU_CALL tInter, do_demo_divemode + MENU_OPTION tBtTm, obottomTime, 0 + MENU_OPTION tuseAGF, oSimAGF, 0 + MENU_CALL tDeco, do_demo_planner + MENU_CALL tBack, do_return_main_menu + MENU_END + +do_planner_common_ccr: MENU_BEGIN tPlan, .7 MENU_OPTION tIntvl, odiveInterval, 0 MENU_OPTION tBtDep, obottomDepth, 0 @@ -302,20 +358,19 @@ MENU_OPTION tBtTm, obottomTime, 0 MENU_CALL tDecoSetup, do_planner_config MENU_CALL tDeco, do_demo_planner - MENU_CALL tExit, do_return_main_menu + MENU_CALL tBack, do_return_main_menu MENU_END - do_planner_config: MENU_BEGIN tPlan, .3 MENU_OPTION tSelectSetpoint, oSimSetpoint, 0 MENU_OPTION tuseAGF, oSimAGF, 0 - MENU_CALL tExit, do_return_planner_menu + MENU_CALL tBack, do_return_planner_menu MENU_END ;============================================================================= -; Divemode menu +; Divemode Menu do_return_divemode_menu: call menu_processor_double_pop ; drop exit line and back to last line @@ -326,9 +381,9 @@ MENU_OPTION tDkMode, oDecoMode, 0 MENU_CALL tppO2settings, do_ppo2_menu MENU_OPTION tsafetystopmenu, oSafetyStop, 0 + MENU_CALL tDecoparameters, do_decoparameters_menu MENU_CALL t2ndDecoPlanMenu, do_2nd_deco_plan_menu - MENU_CALL tDecoparameters, do_decoparameters_menu - MENU_CALL tExit, do_return_main_menu + MENU_CALL tBack, do_return_main_menu MENU_END @@ -339,7 +394,7 @@ MENU_DYNAMIC divesets_ppo2_min, do_toggle_ppo2_min MENU_DYNAMIC divesets_ppo2_min_cc, do_toggle_ppo2_min_cc MENU_OPTION tShowppO2, oShowppO2, 0 - MENU_CALL tExit, do_return_divemode_menu + MENU_CALL tBack, do_return_divemode_menu MENU_END @@ -349,71 +404,55 @@ do_decoparameters_menu: movff char_I_deco_model,lo ; 0 = ZH-L16, 1 = ZH-L16-GF tstfsz lo - bra do_decoparameters_menugf ; <> 0 -> GF menu! + bra do_decoparameters_menu_gf ; <> 0 -> GF menu! ; NON-GF menu - MENU_BEGIN tDecoparameters, .4 + MENU_BEGIN tDecoparameters, .6 + MENU_OPTION tSetBotUse, obottom_usage, 0 + MENU_OPTION tSetDecoUse, odeco_usage, 0 MENU_OPTION tSaturationMult, osatmult, 0 MENU_OPTION tDesaturationMult, odesatmult, 0 - MENU_OPTION tLastDecostop, oLastDeco, 0 - MENU_CALL tExit, do_return_divemode_menu + MENU_CALL tMore, do_decoparameters_menu_more + MENU_CALL tBack, do_return_divemode_menu MENU_END -do_decoparameters_menugf: +do_decoparameters_menu_gf: ; GF menu MENU_BEGIN tDecoparameters, .7 - MENU_OPTION tGF_low, oGF_low, 0 - MENU_OPTION tGF_high, oGF_high, 0 - MENU_CALL taGFMenu, do_aGF_menu + MENU_OPTION tSetBotUse, obottom_usage, 0 + MENU_OPTION tSetDecoUse, odeco_usage, 0 + MENU_CALL tGFMenu, do_GF_menu MENU_OPTION tSaturationMult, osatmultgf, 0 MENU_OPTION tDesaturationMult, odesatmultgf, 0 - MENU_OPTION tLastDecostop, oLastDeco, 0 - MENU_CALL tExit, do_return_divemode_menu + MENU_CALL tMore, do_decoparameters_menu_more + MENU_CALL tBack, do_return_divemode_menu MENU_END -do_return_2nd_deco_plan_menu: - call menu_processor_double_pop ; drop exit line and back to last line - -do_2nd_deco_plan_menu - MENU_BEGIN t2ndDecoPlanMenu, .7 - MENU_OPTION tFTTSMenu, oExtraTime, 0 - MENU_OPTION tCalcAscGas, oCalcAscGas, 0 - MENU_OPTION tSetBotUse, obottom_usage, 0 - MENU_OPTION tSetDecoUse, odeco_usage, 0 - MENU_CALL tTankSizes, do_tank_sizes_menu - MENU_CALL tTankFillPress, do_tank_fill_press_menu - MENU_CALL tExit, do_return_divemode_menu +do_decoparameters_menu_more: + MENU_BEGIN tDecoparameters, .4 + MENU_OPTION tLastDecostop, oLastDeco, 0 + MENU_OPTION tAscentSpeed, oAscentSpeed, 0 + MENU_OPTION tGasChangeTime, oGasChangeTime, 0 + MENU_CALL tBack, do_return_decoparameters_menu MENU_END -do_tank_sizes_menu: - MENU_BEGIN tTankSizes, .6 - MENU_OPTION tGas1, oTankSize1, 0 - MENU_OPTION tGas2, oTankSize2, 0 - MENU_OPTION tGas3, oTankSize3, 0 - MENU_OPTION tGas4, oTankSize4, 0 - MENU_OPTION tGas5, oTankSize5, 0 - MENU_CALL tExit, do_return_2nd_deco_plan_menu +do_2nd_deco_plan_menu: + MENU_BEGIN t2ndDecoPlanMenu, .3 + MENU_OPTION tFTTSMenu, oExtraTime, 0 + MENU_OPTION tCalcAscGas, oCalcAscGas, 0 + MENU_CALL tBack, do_return_divemode_menu MENU_END -do_tank_fill_press_menu: - MENU_BEGIN tTankFillPress, .6 - MENU_OPTION tGas1, oTankFillPres1, 0 - MENU_OPTION tGas2, oTankFillPres2, 0 - MENU_OPTION tGas3, oTankFillPres3, 0 - MENU_OPTION tGas4, oTankFillPres4, 0 - MENU_OPTION tGas5, oTankFillPres5, 0 - MENU_CALL tExit, do_return_2nd_deco_plan_menu - MENU_END - - -do_aGF_menu: - MENU_BEGIN taGFMenu, .4 +do_GF_menu: + MENU_BEGIN tGFMenu, .6 + MENU_OPTION tGF_low, oGF_low, 0 + MENU_OPTION tGF_high, oGF_high, 0 MENU_OPTION taGF_enable, oEnable_aGF, 0 MENU_OPTION taGF_low, oaGF_low, 0 MENU_OPTION taGF_high, oaGF_high, 0 - MENU_CALL tExit, do_return_decoparameters_menu + MENU_CALL tBack, do_return_decoparameters_menu MENU_END @@ -426,40 +465,143 @@ do_return_settings: call menu_processor_double_pop ; drop exit line and back to last line + IFDEF _rx_mode + bcf FLAG_tr_enabled ; clear TR functions flag by default + movff opt_TR_mode,WREG ; get TR functions mode + tstfsz WREG ; TR functions enabled? + bsf FLAG_tr_enabled ; YES + ENDIF do_settings_menu: btfsc ble_available ; ble available? bra do_settings_menu_ble ; YES - MENU_BEGIN tSystSets, .6 + MENU_BEGIN tSystSets, .5 MENU_CALL tInfoMenu, do_info_menu MENU_CALL tSetTimeDate, do_date_time_menu MENU_CALL tDispSets, do_dispsets_menu - MENU_OPTION tLanguage, oLanguage, 0 MENU_CALL tMore, do_settings_menu_more - MENU_CALL tExit, do_return_main_menu + MENU_CALL tBack, do_return_main_menu MENU_END do_settings_menu_ble: - MENU_BEGIN tSystSets, .7 + IFDEF _rx_functions + btfsc ostc_rx_present ; RX model? + bra do_settings_menu_rx ; YES + ENDIF + + MENU_BEGIN tSystSets, .6 MENU_CALL tInfoMenu, do_info_menu MENU_CALL tBleTitle, comm_mode0 MENU_CALL tSetTimeDate, do_date_time_menu MENU_CALL tDispSets, do_dispsets_menu - MENU_OPTION tLanguage, oLanguage, 0 MENU_CALL tMore, do_settings_menu_more - MENU_CALL tExit, do_return_main_menu + MENU_CALL tBack, do_return_main_menu MENU_END + IFDEF _rx_functions +do_settings_menu_rx: + MENU_BEGIN tSystSets, .7 + MENU_CALL tInfoMenu, do_info_menu + MENU_CALL tBleTitle, comm_mode0 + MENU_CALL tTrSettings, do_settings_menu_TR + MENU_CALL tSetTimeDate, do_date_time_menu + MENU_CALL tDispSets, do_dispsets_menu + MENU_CALL tMore, do_settings_menu_more + MENU_CALL tBack, do_return_main_menu + MENU_END + ENDIF + + do_info_menu: + IFDEF _rx_functions + btfsc ostc_rx_present ; TR model? + bra do_info_menu_TR ; YES + ENDIF + MENU_BEGIN tInfoMenu, .6 MENU_DYNAMIC info_menu_serial, 0 MENU_DYNAMIC info_menu_firmware, 0 MENU_DYNAMIC info_menu_battery_volts, 0 MENU_DYNAMIC info_menu_uptime, 0 MENU_DYNAMIC info_menu_total_dives, 0 - MENU_CALL tExit, do_return_settings + MENU_CALL tBack, do_return_settings + MENU_END + + IFDEF _rx_functions +do_info_menu_TR: + MENU_BEGIN tInfoMenu, .7 + MENU_DYNAMIC info_menu_serial, 0 + MENU_DYNAMIC info_menu_firmware, 0 + MENU_DYNAMIC info_menu_firmware_rx, 0 + MENU_DYNAMIC info_menu_total_dives, 0 + MENU_DYNAMIC info_menu_battery_volts, 0 + MENU_DYNAMIC info_menu_uptime, 0 + MENU_CALL tBack, do_return_settings MENU_END + ENDIF + + + IFDEF _rx_functions +do_settings_menu_TR: + movff opt_dive_mode,WREG ; get dive mode: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR + incf WREG,W ; add 1 + dcfsnz WREG,W ; subtract one, became zero? + bra do_settings_menu_TR_MaxDelta; YES - OC + dcfsnz WREG,W ; subtract one, became zero? + bra do_settings_menu_TR_BailPres; YES - CCR + dcfsnz WREG,W ; subtract one, became zero? + bra do_settings_menu_TR_MaxDelta; YES - Gauge + dcfsnz WREG,W ; subtract one, became zero? + bra do_settings_menu_TR_abort ; YES - Apnea, abort + dcfsnz WREG,W ; subtract one, became zero? + bra do_settings_menu_TR_both ; YES - pSCR +do_settings_menu_TR_abort: + call menu_processor_pop ; drop last menu selection + bra do_settings_menu ; back to last menu + +do_settings_menu_TR_MaxDelta: ; menu with oTrMaxDeltaPres + MENU_BEGIN tTrSettings, .5 + MENU_OPTION tTrMode, oTrMode, 0 + MENU_OPTION tTr1stPres, oTr1stPres, 0 + MENU_OPTION tTr2ndPres, oTr2ndPres, 0 + MENU_DYNAMIC do_toggle_max_pres_diff_label,do_toggle_max_pres_diff + MENU_CALL tBack, do_return_settings + MENU_END + +do_settings_menu_TR_BailPres: ; menu with oTrBailPres + MENU_BEGIN tTrSettings, .5 + MENU_OPTION tTrMode, oTrMode, 0 + MENU_OPTION tTr1stPres, oTr1stPres, 0 + MENU_OPTION tTr2ndPres, oTr2ndPres, 0 + MENU_OPTION tTrBailPres, oTrBailPres, 0 + MENU_CALL tBack, do_return_settings + MENU_END + +do_settings_menu_TR_both: ; menu with oTrBailPres and oTrMaxDeltaPres + MENU_BEGIN tTrSettings, .6 + MENU_OPTION tTrMode, oTrMode, 0 + MENU_OPTION tTr1stPres, oTr1stPres, 0 + MENU_OPTION tTr2ndPres, oTr2ndPres, 0 + MENU_OPTION tTrBailPres, oTrBailPres, 0 + MENU_DYNAMIC do_toggle_max_pres_diff_label,do_toggle_max_pres_diff + MENU_CALL tBack, do_return_settings + MENU_END + + +do_toggle_max_pres_diff: ; add 5 bar, with hard-coded max. + movff char_I_max_pres_diff,lo ; get current value + movlw .5 ; load increment + addwf lo,F ; add increment + movlw max_pres_diff_max ; load maximum value + cpfsgt lo ; above maximum value? + bra do_toggle_max_pres_diff_1 ; NO - store new value + movlw max_pres_diff_min ; YES - load minimum value + movwf lo ; - into lo +do_toggle_max_pres_diff_1: + movff lo,char_I_max_pres_diff ; write back new value + return ; done + ENDIF do_return_settings_more_deeper: ; entry point for returns from reset sub-menu @@ -477,46 +619,46 @@ MENU_BEGIN tSystSets, .6 ; in all of this 3 menus MENU_CALL tCompassMenu, do_compass_menu ; need to stay together MENU_CALL tLogOffset, do_log_offset_menu ; on this menu level in - MENU_OPTION tAltMode, oAltMode, 0 ; oder to not mass up the + MENU_OPTION tAltMode, oAltMode, 0 ; oder to not mess up the MENU_OPTION tDvSalinity, oDiveSalinity, 0 ; menu stack on doing the MENU_CALL tResetMenu, do_reset_menu ; do_return_settings ! - MENU_CALL tExit, do_return_settings + MENU_CALL tBack, do_return_settings MENU_END do_return_settings_menu_more_pz: call TFT_ClearScreen - call piezo_config ; Configure buttons + call piezo_config ; configure buttons call menu_processor_double_pop ; drop exit line and back to last line do_settings_menu_more_piezo: MENU_BEGIN tSystSets, .7 - MENU_CALL tCompassMenu, do_compass_menu - MENU_CALL tLogOffset, do_log_offset_menu + MENU_CALL tCompassMenu, do_compass_menu ; see above + MENU_CALL tLogOffset, do_log_offset_menu ; MENU_OPTION tAltMode, oAltMode, 0 MENU_OPTION tDvSalinity, oDiveSalinity, 0 - MENU_CALL tResetMenu, do_reset_menu - MENU_CALL tMore, do_settings_piezo_menu - MENU_CALL tExit, do_return_settings + MENU_CALL tResetMenu, do_reset_menu ; + MENU_CALL tMore, do_settings_piezo_menu ; + MENU_CALL tBack, do_return_settings MENU_END -do_settings_menu_more_ostc3p: ; Menu with BLE feature +do_settings_menu_more_ostc3p: ; menu with BLE feature MENU_BEGIN tSystSets, .6 - MENU_CALL tCompassMenu, do_compass_menu - MENU_CALL tLogOffset, do_log_offset_menu + MENU_CALL tCompassMenu, do_compass_menu ; see above + MENU_CALL tLogOffset, do_log_offset_menu ; MENU_OPTION tAltMode, oAltMode, 0 MENU_OPTION tDvSalinity, oDiveSalinity, 0 - MENU_CALL tResetMenu, do_reset_menu - MENU_CALL tExit, do_return_settings + MENU_CALL tResetMenu, do_reset_menu ; + MENU_CALL tBack, do_return_settings MENU_END do_settings_piezo_menu: ; Menu with features only available in piezo button hardware MENU_BEGIN tSystSets, .3 - MENU_OPTION tButtonleft, ocR_button_left, 0 ; left button sensitivity + MENU_OPTION tButtonleft, ocR_button_left, 0 ; left button sensitivity MENU_OPTION tButtonright, ocR_button_right, 0 ; right button sensitivity - MENU_CALL tExit, do_return_settings_menu_more_pz + MENU_CALL tBack, do_return_settings_menu_more_pz MENU_END @@ -527,64 +669,63 @@ MENU_DYNAMIC menu_cal_x, 0 MENU_DYNAMIC menu_cal_y, 0 MENU_DYNAMIC menu_cal_z, 0 - MENU_CALL tExit, do_return_settings_more + MENU_CALL tBack, do_return_settings_more MENU_END ;============================================================================= -; Reset and confirmation menu. +; Reset and confirmation menu do_reset_menu: MENU_BEGIN tResetMenu, .6 - MENU_CALL tExit, do_return_settings_more - MENU_CALL tReboot, do_reset_menu2 ; Confirm - MENU_CALL tResetDeco, do_reset_menu3 ; Confirm - MENU_CALL tResetSettings, do_reset_menu4 ; Confirm - MENU_CALL tResetLogbook, do_reset_menu5 ; Confirm - MENU_CALL tResetBattery, do_new_battery_menu ; Confirm + MENU_CALL tBack, do_return_settings_more + MENU_CALL tReboot, do_reset_menu2 ; confirm + MENU_CALL tResetDeco, do_reset_menu3 ; confirm + MENU_CALL tResetSettings, do_reset_menu4 ; confirm + MENU_CALL tResetLogbook, do_reset_menu5 ; confirm + MENU_CALL tResetBattery, do_new_battery_menu ; confirm MENU_END do_reset_menu2: MENU_BEGIN tResetMenu2, .2 MENU_CALL tAbort, do_return_settings_more_deeper - MENU_CALL tReboot, do_reboot ; Reboot + MENU_CALL tReboot, do_reboot ; reboot MENU_END do_reset_menu3: MENU_BEGIN tResetMenu2, .2 MENU_CALL tAbort, do_return_settings_more_deeper - MENU_CALL tResetDeco, do_reset_deco ; Reset Deco + MENU_CALL tResetDeco, do_reset_deco ; reset deco MENU_END do_reset_menu4: MENU_BEGIN tResetMenu2, .2 MENU_CALL tAbort, do_return_settings_more_deeper - MENU_CALL tResetSettings, do_reset_settings ; Reset all settings + MENU_CALL tResetSettings, do_reset_settings ; reset all settings MENU_END do_reset_menu5: MENU_BEGIN tResetMenu2, .2 MENU_CALL tAbort, do_return_settings_more_deeper - MENU_CALL tResetLogbook, do_reset_logbook ; Reset logbook + MENU_CALL tResetLogbook, do_reset_logbook ; reset logbook MENU_END do_reset_logbook: - clrf EEADRH ; Make sure to select EEPROM bank 0 + clrf EEADRH ; make sure to select EEPROM bank 0 clrf EEDATA read_int_eeprom .2 write_int_eeprom .16 read_int_eeprom .3 - write_int_eeprom .17 ; Copy number of dives + write_int_eeprom .17 ; copy number of dives clrf EEDATA write_int_eeprom .2 - write_int_eeprom .3 ; Clear total dives + write_int_eeprom .3 ; clear total dives write_int_eeprom .4 write_int_eeprom .5 - write_int_eeprom .6 ; Reset logbook pointers - call ext_flash_erase_logbook ; And complete logbook (!) - - goto do_return_settings_more_deeper + write_int_eeprom .6 ; reset logbook pointers + call ext_flash_erase_logbook ; and complete logbook + bra do_return_settings_more_deeper do_reset_deco: @@ -595,18 +736,16 @@ call deco_calc_dive_interval_1min; calculate deco in surface mode call deco_calc_desaturation_time ; calculate desaturation and no-fly time banksel common - - goto do_return_settings_more_deeper + bra do_return_settings_more_deeper do_reset_settings: - call TFT_ClearScreen ; Clear screen - banksel common ; (probably not needed) - call option_reset_all ; Reset all options to factory default. - goto restart ; Restart into surfacemode + call TFT_ClearScreen ; clear screen + call option_reset_all ; reset all options to factory default + goto restart ; restart into surfacemode do_reboot: - call ext_flash_enable_protection ; Enables write protection + call ext_flash_enable_protection ; enables write protection reset @@ -615,7 +754,7 @@ MENU_CALL tSetTime, do_time_menu MENU_CALL tSetDate, do_date_menu MENU_OPTION tDateFormat,oDateFormat, 0 - MENU_CALL tExit, do_return_settings + MENU_CALL tBack, do_return_settings MENU_END @@ -626,7 +765,7 @@ MENU_OPTION tSetDay, oSetDay, 0 MENU_OPTION tSetMonth, oSetMonth, 0 MENU_OPTION tSetYear, oSetYear, 0 - MENU_CALL tExit, do_return_settings_deeper + MENU_CALL tBack, do_return_settings_deeper MENU_END @@ -643,11 +782,11 @@ MENU_OPTION tSetHours, oSetHours, 0 MENU_OPTION tSetMinutes, oSetMinutes, 0 MENU_CALL tSetSeconds, do_reset_seconds - MENU_CALL tExit, do_return_settings_deeper + MENU_CALL tBack, do_return_settings_deeper MENU_END -do_toggle_ppo2_max: ; add 0.1bar, with hard-coded max. +do_toggle_ppo2_max: ; add 0.1 bar, with hard-coded max. movff char_I_ppO2_max,lo ; banksafe movlw .10 addwf lo,F @@ -660,7 +799,7 @@ movff lo,char_I_ppO2_max return -do_toggle_ppo2_max_deco: ; add 0.1bar, with hard-coded max. +do_toggle_ppo2_max_deco: ; add 0.1 bar, with hard-coded max. movff char_I_ppO2_max_deco,lo ; banksafe movlw .10 addwf lo,F @@ -673,7 +812,7 @@ movff lo,char_I_ppO2_max_deco return -do_toggle_ppo2_min: ; sub 0.1bar, with hard-coded min. +do_toggle_ppo2_min: ; sub 0.1 bar, with hard-coded min. movff char_I_ppO2_min,lo ; banksafe incf lo,F movlw ppo2_warning_low_highest @@ -685,7 +824,7 @@ movff lo,char_I_ppO2_min return -do_toggle_ppo2_min_cc: ; sub 0.1bar, with hard-coded min. +do_toggle_ppo2_min_cc: ; sub 0.1 bar, with hard-coded min. movff char_I_ppO2_min_loop,lo ; banksafe incf lo,F movlw ppo2_warning_loop_highest @@ -706,60 +845,75 @@ MENU_CALL tLogOffsetp10, do_logoffset_plus10 MENU_CALL tLogOffsetm1, do_logoffset_minus1 MENU_CALL tLogOffsetm10, do_logoffset_minus10 - MENU_CALL tExit, do_return_settings_more + MENU_CALL tBack, do_return_settings_more MENU_END do_logoffset_minus1: - call do_logoffset_common_read ; Read into lo:hi + call do_logoffset_common_read ; read into lo:hi movlw .1 subwf lo movlw .0 subwfb hi - btfss hi,7 ; <0? - goto do_logoffset_common_write ; Store and return + btfss hi,7 ; < 0 ? + bra do_logoffset_exit ; store and return clrf lo clrf hi - goto do_logoffset_common_write ; Store and return + bra do_logoffset_exit ; store and return do_logoffset_minus10: - call do_logoffset_common_read ; Read into lo:hi + call do_logoffset_common_read ; read into lo:hi movlw .10 subwf lo movlw .0 subwfb hi - btfss hi,7 ; <0? - goto do_logoffset_common_write ; Store and return + btfss hi,7 ; < 0 ? + bra do_logoffset_exit ; store and return clrf lo clrf hi - goto do_logoffset_common_write ; Store and return + bra do_logoffset_exit ; store and return do_logoffset_plus1: - call do_logoffset_common_read ; Read into lo:hi + call do_logoffset_common_read ; read into lo:hi infsnz lo,F incf hi,F - goto do_logoffset_common_write ; Store and return + bra do_logoffset_exit ; store and return do_logoffset_plus10: - call do_logoffset_common_read ; Read into lo:hi + call do_logoffset_common_read ; read into lo:hi movlw .10 addwf lo movlw .0 addwfc hi - goto do_logoffset_common_write ; Store and return +do_logoffset_exit: + goto do_logoffset_common_write ; store and return do_return_dispsets_menu: bcf in_color_menu call menu_processor_double_pop ; drop exit line and back to last line do_dispsets_menu: - MENU_BEGIN tDispSets, .5 + + IF _language_2!=none + MENU_BEGIN tDispSets, .7 MENU_OPTION tBright, oBrightness, 0 + MENU_OPTION tLanguage, oLanguage, 0 + MENU_OPTION tUnits, oUnits, 0 MENU_CALL tColorScheme, do_color_scheme MENU_OPTION tFlip, oFlipScreen, 0 MENU_CALL tMore, do_dispsets_menu_more - MENU_CALL tExit, do_return_settings + MENU_CALL tBack, do_return_settings MENU_END + ELSE + MENU_BEGIN tDispSets, .6 + MENU_OPTION tBright, oBrightness, 0 + MENU_OPTION tUnits, oUnits, 0 + MENU_CALL tColorScheme, do_color_scheme + MENU_OPTION tFlip, oFlipScreen, 0 + MENU_CALL tMore, do_dispsets_menu_more + MENU_CALL tBack, do_return_settings + MENU_END + ENDIF do_dispsets_menu_more: @@ -769,8 +923,8 @@ MENU_OPTION tVSItext2, oVSItextv2, 0 MENU_OPTION tVSIgraph, oVSIgraph, 0 MENU_OPTION tTimeoutDive, oDiveTimeout, 0 - MENU_OPTION tUnits, oUnits, 0 - MENU_CALL tExit, do_return_dispsets_menu + MENU_OPTION t2ndDepth, o2ndDepthDisp, 0 + MENU_CALL tBack, do_return_dispsets_menu MENU_END @@ -779,7 +933,7 @@ MENU_BEGIN tColorScheme, .2 MENU_OPTION tColorSetDive, oColorSetDive, 0 - MENU_CALL tExit, do_return_dispsets_menu + MENU_CALL tBack, do_return_dispsets_menu MENU_END @@ -793,13 +947,19 @@ global do_new_battery_select do_new_battery_select: - bsf enable_screen_dumps ; To prevent exiting into COMM mode immediately - call TFT_boot ; Initialize TFT (includes clear screen) - call TFT_Display_FadeIn ; Show splash + + IFDEF _screendump + bsf enable_screen_dumps ; to prevent exiting into COMM mode immediately + ELSE + bsf disable_comm_mode ; to prevent exiting into COMM mode immediately + ENDIF + + call TFT_boot ; initialize TFT (includes clear screen) + call TFT_Display_FadeIn ; show splash movlw .100 movwf batt_percent ; make sure to reset batt_percent - ; Default (In cases of timeout or USB): Use old battery + ; Default (in cases of timeout or USB): use old battery clrf EEADRH read_int_eeprom 0x07 movff EEDATA,battery_gauge+0 @@ -814,9 +974,9 @@ read_int_eeprom 0x0C movff EEDATA,battery_gauge+5 - call menu_processor_reset ; restart from first icon. + call menu_processor_reset ; restart from first item - ; hardware_flag: + ; hardware_flag1: ; 3: 0x0A or 0x13 (2016) ; cR: 0x05 ; 2 with BLE: 0x11 @@ -824,27 +984,27 @@ ; 3 with BLE: 0x1A movlw 0x0A - cpfseq hardware_flag + cpfseq hardware_flag1 bra $+4 bra menu_new_battery_AA movlw 0x13 - cpfseq hardware_flag + cpfseq hardware_flag1 bra $+4 bra menu_new_battery_AA_16650 movlw 0x12 - cpfseq hardware_flag + cpfseq hardware_flag1 bra $+4 bra menu_new_battery_AA movlw 0x1A - cpfseq hardware_flag + cpfseq hardware_flag1 bra $+4 bra menu_new_battery_AA movlw 0x11 - cpfseq hardware_flag + cpfseq hardware_flag1 bra $+4 bra menu_new_battery_18650 movlw 0x05 - cpfseq hardware_flag + cpfseq hardware_flag1 bra $+4 bra menu_new_battery_18650 bra use_old_batteries ; any unsupported value @@ -880,15 +1040,15 @@ use_old_prior_209: clrf EEADRH read_int_eeprom 0x0F ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah - incfsz EEDATA,F ; Was 0xFF? - return ; No, done. + incfsz EEDATA,F ; was 0xFF? + return ; NO - done - call lt2942_get_status ; Check for gauge IC + call lt2942_get_status ; check for gauge IC movlw .3 ; Assume a 18650 btfss battery_gauge_available ; cR/2 hardware? - movlw .1 ; Assume a Saft + movlw .1 ; assume a Saft movwf EEDATA - write_int_eeprom 0x0F ; Store the new battery type into EEPROM + write_int_eeprom 0x0F ; store the new battery type into EEPROM return @@ -910,28 +1070,33 @@ read_int_eeprom 0x0F movff EEDATA,battery_type ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah - rcall setup_new_saft ; Any other value - incf EEDATA,F ; 1 ... 5 + rcall setup_new_saft ; any other value + incf EEDATA,F ; 1...5 dcfsnz EEDATA,F - rcall setup_new_15v ;=0 + rcall setup_new_15v ; =0 dcfsnz EEDATA,F - rcall setup_new_saft ;=1 + rcall setup_new_saft ; =1 dcfsnz EEDATA,F - rcall setup_new_panasonic ;=2 + rcall setup_new_panasonic ; =2 dcfsnz EEDATA,F - rcall setup_new_18650 ;=3 + rcall setup_new_18650 ; =3 dcfsnz EEDATA,F - rcall setup_new_16650 ;=4 + rcall setup_new_16650 ; =4 bcf use_old_batt_flag ; clear flag - goto surfloop ; Jump to Surfaceloop! + + IFNDEF _screendump + bcf disable_comm_mode ; re-enable COMM mode again + ENDIF + + goto surfloop ; jump to surface loop setup_new_15v: bsf charge_disable bcf TRISE,2 movlw .100 - movwf batt_percent ; To have 1,5V batteries right after firmware update + movwf batt_percent ; to have 1.5V batteries right after firmware update movlw .0 movff WREG,battery_type return @@ -960,7 +1125,7 @@ setup_new_panasonic: - banksel battery_capacity + banksel battery_capacity movlw LOW internal_panasonic_capacity movwf internal_battery_capacity+0 movlw HIGH internal_panasonic_capacity @@ -1023,21 +1188,28 @@ use_16650_battery: rcall setup_new_16650 - bra use_new_36V_2 + bra use_batt_exit use_18650_battery: rcall setup_new_18650 - bra use_new_36V_2 + bra use_batt_exit use_new_36V_batteries: rcall setup_new_saft - bra use_new_36V_2 + bra use_batt_exit use_new_15V_batteries: rcall setup_new_15v -use_new_36V_2: - call reset_battery_pointer ; Resets battery pointer 0x07-0x0C and battery_gauge:5 - goto surfloop ; Jump to Surface loop! +use_batt_exit: + call reset_battery_pointer ; resets battery pointer 0x07-0x0C and battery_gauge:5 +use_batt_exit1: + + IFNDEF _screendump + bcf disable_comm_mode ; re-enable COMM mode again + ENDIF + + goto surfloop ; jump to surface loop + use_36V_rechargeable: rcall setup_new_panasonic call reset_battery_internal_only - goto surfloop ; Jump to Surface loop! + bra use_batt_exit1 ; jump to surface loop END \ No newline at end of file