Mercurial > public > hwos_code
annotate src/menu_tree.asm @ 656:8af5aefbcdaf default tip
Update to 3.31 beta
| author | heinrichsweikamp |
|---|---|
| date | Thu, 27 Nov 2025 18:32:58 +0100 |
| parents | 75e90cd0c2c3 |
| children |
| rev | line source |
|---|---|
| 0 | 1 ;============================================================================= |
| 2 ; | |
| 640 | 3 ; File menu_tree.asm * combined next generation V3.12.2 |
| 0 | 4 ; |
| 623 | 5 ; OSTC Surface Menus |
| 0 | 6 ; |
| 654 | 7 ; Copyright (c) 2011, JD Gascuel, heinrichs weikamp gmbh, all right reserved. |
| 0 | 8 ;============================================================================= |
| 9 ; HISTORY | |
| 10 ; 2011-07-11 : [jDG] Creation. | |
| 11 | |
| 634 | 12 |
| 13 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 14 ; | |
| 15 ; ATTENTION | |
| 16 ; | |
| 17 ; All Calls made via the Menu Macros need to go to Addresses within 0x0xxxx ! | |
| 18 ; | |
| 19 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 20 | |
| 21 | |
| 604 | 22 #include "hwos.inc" ; mandatory header |
| 634 | 23 #include "shared_definitions.h" ; mailbox from/to p2_deco.c |
| 582 | 24 #include "gaslist.inc" |
| 25 #include "menu_processor.inc" | |
| 26 #include "start.inc" | |
| 27 #include "comm.inc" | |
| 28 #include "tft.inc" | |
| 29 #include "eeprom_rs232.inc" | |
| 30 #include "external_flash.inc" | |
| 31 #include "adc_lightsensor.inc" | |
| 32 #include "wait.inc" | |
| 33 #include "i2c.inc" | |
| 623 | 34 #include "calibrate.inc" |
| 35 #include "math.inc" | |
| 36 #include "rtc.inc" | |
| 634 | 37 #include "strings.inc" |
| 38 #include "tft_outputs.inc" | |
| 39 #include "convert.inc" | |
| 40 #include "colorschemes.inc" | |
| 582 | 41 |
| 0 | 42 |
| 634 | 43 extern surfloop |
| 44 extern logbook | |
| 45 extern demo_divemode | |
| 46 extern demo_planner | |
| 47 extern piezo_config | |
| 48 extern comm_firmware_update_exec | |
| 49 | |
| 631 | 50 extern option_check_and_store_all |
| 582 | 51 extern option_reset |
| 52 extern option_reset_all | |
| 634 | 53 extern option_adjust_group_member |
| 54 extern option_inc | |
| 55 extern option_dec | |
| 56 extern option_draw | |
| 57 | |
| 58 extern get_cpu_version | |
| 631 | 59 extern eeprom_deco_data_write |
| 623 | 60 |
| 634 | 61 |
| 623 | 62 IFDEF _ccr_pscr |
| 604 | 63 extern option_cleanup_oCCRMode |
| 623 | 64 ENDIF |
| 65 | |
| 66 IFDEF _compass | |
| 634 | 67 extern compass_calibration |
| 623 | 68 ENDIF |
|
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
155
diff
changeset
|
69 |
| 634 | 70 IFDEF _rx_functions |
| 71 extern get_transmitter_id_by_slot | |
| 72 ENDIF | |
| 623 | 73 |
| 74 | |
| 0 | 75 ;============================================================================= |
| 634 | 76 surf_menu CODE 0x01000 ; needs to be at 0x0xxxx |
| 77 ;============================================================================= | |
| 78 | |
| 582 | 79 |
| 634 | 80 ;----------------------------------------------------------------------------- |
| 81 ; Returning from a Menu Item | |
| 82 ; | |
| 582 | 83 do_return_main_menu: |
| 604 | 84 call menu_processor_double_pop ; drop exit line and back to last line |
| 634 | 85 bra main_menu_common ; continue with menu |
| 86 | |
| 582 | 87 |
| 634 | 88 ;----------------------------------------------------------------------------- |
| 89 ; Entry Point for Main Menu | |
| 90 ; | |
| 91 global main_menu | |
| 92 main_menu: | |
| 623 | 93 movff active_customview,customview_surfmode ; save last custom view |
| 94 clrf MS_flags_imprint ; clear all flags for data imprinting | |
| 631 | 95 call TFT_boot ; initialize display |
| 96 call menu_processor_reset ; reset menu stack | |
| 0 | 97 |
| 650 | 98 ; reset planning parameters to default values - only when entering the menu, thus keeping the settings between multiple calculator runs |
| 99 lfsr FSR0,odiveInterval ; surface interval | |
| 100 call option_reset ; reset to default | |
| 101 lfsr FSR0,obottomTime ; bottom time | |
| 102 call option_reset ; reset to default | |
| 103 lfsr FSR0,obottomDepth ; bottom depth | |
| 104 call option_reset ; reset to default | |
| 105 lfsr FSR0,oSimAGF ; GF/aGF | |
| 106 call option_reset ; reset to default | |
| 107 | |
| 108 IFDEF _gas_contingency | |
| 109 lfsr FSR0,oGasContingencySim ; gas contingency | |
| 110 call option_reset ; reset to default (volatile option) | |
| 111 ENDIF ; _gas_contingency | |
| 112 | |
| 634 | 113 main_menu_common: |
| 623 | 114 IFDEF _ccr_pscr |
| 582 | 115 MENU_BEGIN tMainMenu, .7 |
| 634 | 116 MENU_CALL tLogbook, do_logbook |
| 117 MENU_CALL tGasSetup, do_menu_gas | |
| 118 MENU_CALL tCCRSetup, do_menu_ccr | |
| 119 MENU_CALL tDiveModeMenu, do_menu_dive | |
| 120 MENU_CALL tSimulator, do_menu_simulator | |
| 121 MENU_CALL tSystSets, do_menu_settings | |
| 623 | 122 MENU_CALL tExit, do_restart |
| 582 | 123 MENU_END |
| 623 | 124 ELSE |
| 125 MENU_BEGIN tMainMenu, .6 | |
| 634 | 126 MENU_CALL tLogbook, do_logbook |
| 127 MENU_CALL tGasSetup, do_menu_gas | |
| 128 MENU_CALL tDiveModeMenu, do_menu_dive | |
| 129 MENU_CALL tSimulator, do_menu_simulator | |
| 130 MENU_CALL tSystSets, do_menu_settings | |
| 623 | 131 MENU_CALL tExit, do_restart |
| 132 MENU_END | |
| 634 | 133 ENDIF ; _ccr_pscr |
| 582 | 134 |
| 0 | 135 |
| 634 | 136 ;----------------------------------------------------------------------------- |
| 137 ; Call Function - start Logbook | |
| 138 ; | |
| 139 do_logbook: | |
| 140 goto logbook ; code is hosted in logbook.asm | |
| 141 | |
| 142 | |
| 143 ;----------------------------------------------------------------------------- | |
| 144 ; Call Function - exit Menu | |
| 145 ; | |
| 623 | 146 do_restart: |
| 147 bsf restart_fast ; skip logos and waits an restart | |
| 148 goto restart ; restart into surface mode | |
| 149 | |
| 0 | 150 |
| 623 | 151 IFDEF _ccr_pscr |
| 152 | |
| 634 | 153 ;----------------------------------------------------------------------------- |
| 154 ; returning to CCR / pSCR Setup | |
| 155 ; | |
| 156 do_return_menu_ccr: | |
| 582 | 157 call menu_processor_double_pop ; drop exit line and back to last line |
| 634 | 158 ;bra do_menu_ccr |
| 0 | 159 |
| 634 | 160 |
| 161 ;----------------------------------------------------------------------------- | |
| 162 ; CCR / pSCR Setup - 1st Level | |
| 163 ; | |
| 164 do_menu_ccr: | |
| 604 | 165 call option_cleanup_oCCRMode ; in pSCR mode, revert AutoSP (2) to calculated SP (0) |
| 560 | 166 |
| 656 | 167 IFDEF _external_sensor_eccr |
| 634 | 168 |
| 623 | 169 bcf imprint_sensor_mv ; stop imprinting of live O2 sensor mV data |
| 634 | 170 btfss ext_input_s8_ana ; S8/analog sensor input available? |
| 171 bra do_menu_ccr_2 ; NO - do OSTC 2 menu | |
| 172 ;bra do_menu_ccr_cR ; YES - do OSTC cR menu | |
| 240 | 173 |
| 634 | 174 do_menu_ccr_cR: ; OSTC cR menu |
| 175 MENU_BEGIN tCCRSetup, .6 | |
| 176 MENU_OPT_INC tCCRMode, oCCRMode | |
| 177 MENU_CALL tCalibrateMenu, do_menu_calibrate | |
| 178 MENU_CALL tDiluentSetup, do_menu_diluent | |
| 179 MENU_CALL tFixedSetpoints, do_menu_setpoints | |
| 180 MENU_CALL tMore, do_menu_ccr_more | |
| 181 MENU_CALL tBack, do_return_main_menu | |
| 182 MENU_END | |
| 183 | |
| 656 | 184 ENDIF ; _external_sensor_eccr |
| 634 | 185 |
| 186 do_menu_ccr_2: | |
| 187 MENU_BEGIN tCCRSetup, .5 ; OSTC 2 menu | |
| 188 MENU_OPT_INC tCCRMode, oCCRMode | |
| 189 MENU_CALL tDiluentSetup, do_menu_diluent | |
| 190 MENU_CALL tFixedSetpoints, do_menu_setpoints | |
| 191 MENU_CALL tMore, do_menu_ccr_more | |
| 604 | 192 MENU_CALL tBack, do_return_main_menu |
| 582 | 193 MENU_END |
| 194 | |
|
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
155
diff
changeset
|
195 |
| 634 | 196 ;----------------------------------------------------------------------------- |
| 197 ; CCR / pSCR Setup - 2nd Level | |
| 198 ; | |
| 199 do_menu_ccr_more: | |
| 656 | 200 IFDEF _external_sensor_eccr |
| 634 | 201 MENU_BEGIN tCCRSetup, .7 ; CCR/pSCR more menu |
| 202 MENU_OPT_INC tS8Mode, oS8Mode | |
| 203 MENU_OPT_INC tCCmaxFracO2, oCCmaxFracO2 | |
| 204 MENU_OPT_INC tDilppO2Check, oDilppO2Check | |
| 205 MENU_OPT_INC tGasDensityCheck, oGasDensityCheck | |
| 206 MENU_OPT_INC tPSCR_O2_drop, oPSCR_drop | |
| 207 MENU_OPT_INC tPSCR_lungratio, oPSCR_lungratio | |
| 208 MENU_CALL tBack, do_return_menu_ccr | |
| 631 | 209 MENU_END |
| 210 ELSE | |
| 634 | 211 MENU_BEGIN tCCRSetup, .6 ; CCR/pSCR more menu |
| 212 MENU_OPT_INC tCCmaxFracO2, oCCmaxFracO2 | |
| 213 MENU_OPT_INC tDilppO2Check, oDilppO2Check | |
| 214 MENU_OPT_INC tGasDensityCheck, oGasDensityCheck | |
| 215 MENU_OPT_INC tPSCR_O2_drop, oPSCR_drop | |
| 216 MENU_OPT_INC tPSCR_lungratio, oPSCR_lungratio | |
| 217 MENU_CALL tBack, do_return_menu_ccr | |
| 582 | 218 MENU_END |
| 656 | 219 ENDIF ; _external_sensor_eccr |
| 0 | 220 |
| 623 | 221 ENDIF ; _ccr_pscr |
| 222 | |
| 634 | 223 |
| 656 | 224 IFDEF _external_sensor_eccr |
| 634 | 225 |
| 226 ;----------------------------------------------------------------------------- | |
| 227 ; Calibration Menu | |
| 228 ; | |
| 229 do_menu_calibrate: | |
| 230 call enable_ir_s8_analog ; enable IR/S8/analog interface | |
| 231 bsf imprint_sensor_mv ; start imprinting of live O2 sensor mV data | |
| 232 | |
| 233 MENU_BEGIN tCalibrateMenu, .6 | |
| 234 MENU_CALL tDiveHudMask1, 0 ; data will be superimposed by housekeeping | |
| 235 MENU_CALL tDiveHudMask2, 0 ; ... | |
| 236 MENU_CALL tDiveHudMask3, 0 ; ... | |
| 237 MENU_OPT_INC tCalibrationGas, oCalGasO2 | |
| 238 MENU_CALL tCalibrate, do_calibrate | |
| 239 MENU_CALL tBack, do_return_menu_ccr | |
| 240 MENU_END | |
| 241 | |
| 242 | |
| 243 ;----------------------------------------------------------------------------- | |
| 244 ; Call Function - start Calibration, returns to Surface Mode | |
| 245 ; | |
| 246 do_calibrate: | |
| 247 call calibrate_mix ; calibrate with opt_calibration_O2_ratio, also calibrate S8 HUD if connected | |
| 248 WAITMS d'250' ; wait for HUD v3 | |
| 249 movlw .9 ; load index of sensor mV custom view | |
| 250 movff WREG,customview_surfmode ; show this custom view when back in surface mode | |
| 251 bra do_restart ; exit menu | |
| 252 | |
| 656 | 253 ENDIF ; _external_sensor_eccr |
| 634 | 254 |
| 255 | |
| 256 IFDEF _ccr_pscr | |
| 257 | |
| 258 ;----------------------------------------------------------------------------- | |
| 259 ; Diluent Setup | |
| 260 ; | |
| 261 do_menu_diluent: | |
| 262 bsf is_diluent_menu ; setting up diluents | |
| 263 bcf short_gas_descriptions ; use long gas description format | |
| 264 bcf better_gas_hint ; do not mark the best gas/diluent (to be used in dive mode only) | |
| 265 call gaslist_cleanup_list ; make sure there is only one gas being first | |
| 266 | |
| 267 MENU_BEGIN tDiluentSetup, .6 | |
| 268 MENU_DYNAMIC dyn_strcat_gas_PRODL, do_menu_edit_gas | |
| 269 MENU_DYNAMIC dyn_strcat_gas_PRODL, do_menu_edit_gas | |
| 270 MENU_DYNAMIC dyn_strcat_gas_PRODL, do_menu_edit_gas | |
| 271 MENU_DYNAMIC dyn_strcat_gas_PRODL, do_menu_edit_gas | |
| 272 MENU_DYNAMIC dyn_strcat_gas_PRODL, do_menu_edit_gas | |
| 273 MENU_CALL tBack, do_return_menu_ccr | |
| 274 MENU_END | |
| 275 | |
| 276 | |
| 277 ;----------------------------------------------------------------------------- | |
| 278 ; dynamic Title - show full Gas Description (just for info, active code is in other place) | |
| 279 ; | |
| 280 ;dyn_strcat_gas_PRODL: | |
| 281 ; goto gaslist_strcat_gas_PRODL ; code is hosted in gaslist.asm | |
| 282 | |
| 0 | 283 |
| 634 | 284 ;----------------------------------------------------------------------------- |
| 285 ; returning to Setpoint Setup | |
| 286 ; | |
| 287 do_return_menu_setpoints: | |
| 288 call menu_processor_double_pop ; drop exit line and back to last line | |
| 289 bcf block_option_value ; resume displaying of option values | |
| 290 ;bra do_menu_setpoints ; continue | |
| 291 | |
| 292 | |
| 293 ;----------------------------------------------------------------------------- | |
| 294 ; Setpoint Setup - 1st Level | |
| 295 ; | |
| 296 do_menu_setpoints: | |
| 297 bcf short_gas_descriptions ; use long gas description format | |
| 298 bcf better_gas_hint ; do not mark the best gas/diluent (to be used in dive mode only) | |
| 299 | |
| 300 MENU_BEGIN tFixedSetpoints, .6 | |
| 301 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_menu_edit_sp | |
| 302 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_menu_edit_sp | |
| 303 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_menu_edit_sp | |
| 304 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_menu_edit_sp | |
| 305 MENU_DYNAMIC dyn_strcat_setpoint_prodl, do_menu_edit_sp | |
| 306 MENU_CALL tBack, do_return_menu_ccr | |
| 307 MENU_END | |
| 308 | |
| 309 | |
| 310 ;----------------------------------------------------------------------------- | |
| 311 ; dynamic Title - show Setpoint Data | |
| 312 ; | |
| 313 dyn_strcat_setpoint_prodl: | |
| 314 goto gaslist_strcat_setpoint_PRODL ; function is hosted in gaslist.asm | |
| 315 | |
| 316 | |
| 317 ;----------------------------------------------------------------------------- | |
| 318 ; Setpoint Setup - 2nd Level | |
| 319 ; | |
| 320 do_menu_edit_sp: | |
| 321 movff PRODL,gaslist_gas ; get menu item we came from (0-4) | |
| 322 bsf block_option_value ; suspend displaying of option values | |
| 323 | |
| 324 MENU_BEGIN tFixedSetpoints, .5 | |
| 325 MENU_DYNAMIC dyn_strcat_setpoint, 0 | |
| 326 MENU_GRP_INC tSPPlus, oSP1ppO2 | |
| 327 MENU_GRP_INCS tDepthPlus, oSP1Depth | |
| 328 MENU_GRP_DECS tDepthMinus, oSP1Depth | |
| 329 MENU_CALL tBack, do_return_menu_setpoints | |
| 330 MENU_END | |
| 331 | |
| 332 | |
| 333 ;----------------------------------------------------------------------------- | |
| 334 ; dynamic Title - show Setpoint Data | |
| 335 ; | |
| 336 dyn_strcat_setpoint: | |
| 337 goto gaslist_strcat_setpoint ; function is hosted in gaslist.asm | |
| 338 | |
| 339 ENDIF ; _ccr_pscr | |
| 340 | |
| 341 | |
| 342 ;----------------------------------------------------------------------------- | |
| 343 ; returning from Gas / Diluent Setup | |
| 344 ; | |
| 345 do_return_menu_gas: | |
| 582 | 346 call menu_processor_double_pop ; drop exit line and back to last line |
| 0 | 347 |
| 623 | 348 IFDEF _ccr_pscr |
| 349 btfsc is_diluent_menu ; return from setting up diluents? | |
| 634 | 350 bra do_menu_diluent ; YES - continue with diluent menu |
| 351 ;bra do_menu_gas ; NO - continue with OC gas menu | |
| 623 | 352 ENDIF |
| 582 | 353 |
| 634 | 354 |
| 355 ;----------------------------------------------------------------------------- | |
| 356 ; OC Gas Setup - 1st Level | |
| 357 ; | |
| 358 do_menu_gas: | |
| 623 | 359 bcf is_diluent_menu ; setting up OC gases |
| 634 | 360 bcf short_gas_descriptions ; use long gas description format |
| 604 | 361 bcf better_gas_hint ; do not mark the best gas/diluent (to be used in dive mode only) |
| 634 | 362 call gaslist_cleanup_list ; make sure there is only one gas being first |
| 0 | 363 |
| 582 | 364 MENU_BEGIN tGaslist, .6 |
| 634 | 365 MENU_DYNAMIC dyn_strcat_gas_PRODL, do_menu_edit_gas |
| 366 MENU_DYNAMIC dyn_strcat_gas_PRODL, do_menu_edit_gas | |
| 367 MENU_DYNAMIC dyn_strcat_gas_PRODL, do_menu_edit_gas | |
| 368 MENU_DYNAMIC dyn_strcat_gas_PRODL, do_menu_edit_gas | |
| 369 MENU_DYNAMIC dyn_strcat_gas_PRODL, do_menu_edit_gas | |
| 604 | 370 MENU_CALL tBack, do_return_main_menu |
| 582 | 371 MENU_END |
| 372 | |
| 373 | |
| 634 | 374 ;----------------------------------------------------------------------------- |
| 375 ; dynamic Title - show full Gas Description | |
| 376 ; | |
| 377 dyn_strcat_gas_PRODL: | |
| 378 goto gaslist_strcat_gas_PRODL ; code is hosted in gaslist.asm | |
| 379 | |
| 380 | |
| 381 ;----------------------------------------------------------------------------- | |
| 382 ; return to OC Gas Setup from Sub-Menu | |
| 383 ; | |
| 384 do_return_menu_edit_gas: | |
| 604 | 385 IFDEF _rx_functions |
| 623 | 386 bcf imprint_xmitter_pres ; stop imprinting of transmitter pressure data |
| 387 bcf imprint_xmitter_ID ; not in transmitter selection menu any more (back to normal timeout) | |
| 604 | 388 ENDIF |
| 634 | 389 call menu_processor_double_pop ; drop exit line and back to last line |
| 390 bcf block_option_value ; resume displaying of option values | |
| 391 bra do_menu_edit_gas_common ; continue with common part | |
| 392 | |
| 623 | 393 |
| 634 | 394 ;----------------------------------------------------------------------------- |
| 395 ; OC Gas Setup - 2nd Level | |
| 396 ; | |
| 397 do_menu_edit_gas: | |
| 604 | 398 movff PRODL,gaslist_gas ; get menu item we came from (0-4) |
| 399 movlw .5 ; offset between gases and diluents | |
| 623 | 400 btfsc is_diluent_menu ; setting up diluents? |
| 604 | 401 addwf gaslist_gas,F ; YES - add the offset |
| 0 | 402 |
| 634 | 403 do_menu_edit_gas_common: |
| 604 | 404 MENU_BEGIN tGasEdit, .7 |
| 634 | 405 MENU_DYNAMIC dyn_gastitle, 0 |
| 406 MENU_DYNAMIC dyn_MOD_END, 0 | |
| 407 MENU_GRP_INC tType, oGas1 | |
| 408 MENU_CALL tSetup_GasMix, do_menu_gas_mix | |
| 409 MENU_DYNAMIC dyn_show_depth, do_menu_gas_depth | |
| 410 MENU_CALL tSetup_Tank, do_menu_gas_tank | |
| 411 MENU_CALL tBack, do_return_menu_gas | |
| 582 | 412 MENU_END |
| 413 | |
| 0 | 414 |
| 634 | 415 ;----------------------------------------------------------------------------- |
| 416 ; dynamic Title - show full Gas Description | |
| 417 ; | |
| 418 dyn_gastitle: | |
| 419 goto gaslist_strcat_gas ; code is hosted in gaslist.asm | |
| 420 | |
| 421 | |
| 422 ;----------------------------------------------------------------------------- | |
| 423 ; dynamic Title - show MOD and END | |
| 424 ; | |
| 425 dyn_MOD_END: | |
| 426 goto gaslist_MOD_END ; code is hosted in gaslist.asm | |
| 427 | |
| 428 | |
| 429 ;----------------------------------------------------------------------------- | |
| 430 ; dynamic Title - show Change Depth | |
| 431 ; | |
| 432 dyn_show_depth: | |
| 433 movf gaslist_gas,W ; load gas/dil index into WREG (0-9) | |
| 434 lfsr FSR1,opt_gas_change ; load base address of change depths | |
| 435 tstfsz PLUSW1 ; change depth = 0 ? | |
| 436 bra dyn_show_depth_1 ; NO - print in normal color | |
| 437 lfsr FSR1,opt_gas_type ; YES - load base address of opt_gas_type | |
| 438 tstfsz PLUSW1 ; - type = disabled ? | |
| 439 FONT_COLOR_ATTENTION ; NO - print in attention color (yellow) | |
| 440 dyn_show_depth_1: | |
| 441 STRCAT_TEXT tSetup_GasDepth ; print text | |
| 442 return ; done | |
| 443 | |
| 444 | |
| 445 ;----------------------------------------------------------------------------- | |
| 446 ; OC Gas Setup - 3rd Level - Mix | |
| 447 ; | |
| 448 do_menu_gas_mix: | |
| 449 bsf block_option_value ; suspend displaying of option values | |
| 450 | |
| 623 | 451 IFDEF _helium |
| 582 | 452 MENU_BEGIN tGasEdit, .7 |
| 634 | 453 MENU_DYNAMIC dyn_gastitle, 0 |
| 454 MENU_DYNAMIC dyn_MOD_END, 0 | |
| 455 MENU_GRP_INCS tO2Plus, oGas1O2 | |
| 456 MENU_GRP_DECS tO2Minus, oGas1O2 | |
| 457 MENU_GRP_INCS tHePlus, oGas1He | |
| 458 MENU_GRP_DECS tHeMinus, oGas1He | |
| 459 MENU_CALL tBack, do_return_menu_edit_gas | |
| 604 | 460 MENU_END |
| 623 | 461 ELSE |
| 462 MENU_BEGIN tGasEdit, .5 | |
| 634 | 463 MENU_DYNAMIC dyn_gastitle, 0 |
| 464 MENU_DYNAMIC dyn_MOD_END, 0 | |
| 465 MENU_GRP_INCS tO2Plus, oGas1O2 | |
| 466 MENU_GRP_DECS tO2Minus, oGas1O2 | |
| 467 MENU_CALL tBack, do_return_menu_edit_gas | |
| 604 | 468 MENU_END |
| 469 ENDIF | |
| 470 | |
| 471 | |
| 634 | 472 ;----------------------------------------------------------------------------- |
| 473 ; OC Gas Setup - 3rd Level - Change Depth | |
| 474 ; | |
| 475 do_menu_gas_depth: | |
| 476 bsf block_option_value ; suspend displaying of option values | |
|
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
155
diff
changeset
|
477 |
| 582 | 478 MENU_BEGIN tGasEdit, .7 |
| 634 | 479 MENU_DYNAMIC dyn_gastitle, 0 |
| 480 MENU_DYNAMIC dyn_MOD_END, 0 | |
| 481 MENU_DYNAMIC dyn_ppo2, 0 | |
| 482 MENU_GRP_INCS tDepthPlus, oGas1Depth | |
| 483 MENU_GRP_DECS tDepthMinus, oGas1Depth | |
| 484 MENU_DYNAMIC dyn_reset_mod_title, do_gas_depth_reset | |
| 485 MENU_CALL tBack, do_return_menu_edit_gas | |
| 582 | 486 MENU_END |
| 0 | 487 |
| 582 | 488 |
| 634 | 489 ;----------------------------------------------------------------------------- |
| 490 ; dynamic Title - show Gas Description | |
| 491 ; | |
| 492 ;dyn_gastitle: | |
| 493 ; goto gaslist_strcat_gas ; code is hosted in gaslist.asm | |
| 494 | |
| 495 | |
| 496 ;----------------------------------------------------------------------------- | |
| 497 ; dynamic Title - show MOD and END | |
| 498 ; | |
| 499 ;dyn_MOD_END: | |
| 500 ; goto gaslist_MOD_END ; code is hosted in gaslist.asm | |
| 501 | |
| 502 | |
| 503 ;----------------------------------------------------------------------------- | |
| 504 ; dynamic Title - show ppO2 and Change Depth | |
| 505 ; | |
| 506 dyn_ppo2: | |
| 507 goto gaslist_ppo2 ; code is hosted in gaslist.asm | |
| 508 | |
| 509 | |
| 510 ;----------------------------------------------------------------------------- | |
| 511 ; dynamic Title - show 'Rest to MOD' Dialog | |
| 512 ; | |
| 513 dyn_reset_mod_title: | |
| 514 goto gaslist_reset_mod_title ; code is hosted in gaslist.asm | |
| 515 | |
| 516 | |
| 517 ;----------------------------------------------------------------------------- | |
| 518 ; Call Function - reset Change Depth to MOD | |
| 519 ; | |
| 520 do_gas_depth_reset: | |
| 521 call gaslist_calc_mod ; compute MOD, result in WREG | |
| 522 movwf lo ; copy result to lo | |
| 523 lfsr FSR1,opt_gas_change ; load base address of opt_gas_change | |
| 524 movf gaslist_gas,W ; load index | |
| 525 movff lo,PLUSW1 ; update change depth | |
| 526 bsf option_changed ; flag that EEPROM needs to be updated | |
| 527 return ; done | |
| 528 | |
| 529 | |
| 530 ;----------------------------------------------------------------------------- | |
| 531 ; OC Gas Setup - 3rd Level - Tank Setup | |
| 532 ; | |
| 533 do_menu_gas_tank: | |
| 534 IFDEF _rx_functions | |
| 650 | 535 btfss ostc_rx_present ; OSTC has RX module? |
| 536 bra do_menu_gas_tank2 ; NO, skip tank menu with RX | |
| 634 | 537 TSTOSC opt_TR_mode ; TR functions switched on? |
| 538 bra do_menu_gas_tank_rx ; YES | |
| 650 | 539 do_menu_gas_tank2: |
| 634 | 540 ENDIF |
| 541 | |
| 542 IFDEF _ccr_pscr | |
| 543 MENU_BEGIN tSetup_Tank, .5 | |
| 544 MENU_DYNAMIC dyn_gastitle, 0 | |
| 545 MENU_GRP_INC tTankSize, oTankSizeOC1 | |
| 546 MENU_GRP_INC tTankUsablePress, oTankPresOC1 | |
| 547 MENU_CALL tCopyDilToOC, do_copy_dil_to_oc | |
| 548 MENU_CALL tBack, do_return_menu_edit_gas | |
| 549 MENU_END | |
| 550 ELSE | |
| 551 MENU_BEGIN tSetup_Tank, .4 | |
| 552 MENU_DYNAMIC dyn_gastitle, 0 | |
| 553 MENU_GRP_INC tTankSize, oTankSizeOC1 | |
| 554 MENU_GRP_INC tTankUsablePress, oTankPresOC1 | |
| 555 MENU_CALL tBack, do_return_menu_edit_gas | |
| 556 MENU_END | |
| 557 ENDIF ; _ccr_pscr | |
| 558 | |
| 559 | |
| 560 IFDEF _rx_functions | |
| 561 do_menu_gas_tank_rx: | |
| 562 setf pairing_slot ; prime slot number with 255 aka -1, used in pairing function | |
| 563 bsf imprint_xmitter_ID ; in transmitter selection menu (longer timeout) | |
| 564 | |
| 565 IFDEF _ccr_pscr | |
| 566 MENU_BEGIN tSetup_Tank, .7 | |
| 567 MENU_DYNAMIC dyn_gastitle, 0 | |
| 568 MENU_DYNAMIC dyn_tank_id_pres, 0 ; pressure will be superimposed by housekeeping | |
| 569 MENU_CALL tTankPairing, do_tank_pairing | |
| 570 MENU_GRP_INC tTankSize, oTankSizeOC1 | |
| 571 MENU_GRP_INC tTankUsablePress, oTankPresOC1 | |
| 572 MENU_CALL tCopyDilToOC, do_copy_dil_to_oc | |
| 573 MENU_CALL tBack, do_return_menu_edit_gas | |
| 574 MENU_END | |
| 575 ELSE | |
| 576 MENU_BEGIN tSetup_Tank, .6 | |
| 577 MENU_DYNAMIC dyn_gastitle, 0 | |
| 578 MENU_DYNAMIC dyn_tank_id_pres, 0 ; pressure will be superimposed by housekeeping | |
| 579 MENU_CALL tTankPairing, do_tank_pairing | |
| 580 MENU_GRP_INC tTankSize, oTankSizeOC1 | |
| 581 MENU_GRP_INC tTankUsablePress, oTankPresOC1 | |
| 582 MENU_CALL tBack, do_return_menu_edit_gas | |
| 583 MENU_END | |
| 584 ENDIF ; _ccr_pscr | |
| 585 | |
| 0 | 586 |
| 634 | 587 ;----------------------------------------------------------------------------- |
| 588 ; dynamic Title - show Transmitter ID | |
| 589 ; | |
| 590 dyn_tank_id_pres: | |
| 591 STRCAT " ID: " ; print header | |
| 592 ; get ID | |
| 593 lfsr FSR1,opt_transmitter_id_1 ; load base address of opt_transmitter_id | |
| 594 movf gaslist_gas,W ; load index (0-9) | |
| 595 rlncf WREG,W ; multiply by 2 because IDs are 2 byte in size | |
| 596 movff PLUSW1,lo ; copy opt_transmitter_id+0[gaslist_gas] to lo | |
| 597 incf WREG,W ; increment index | |
| 598 movff PLUSW1,hi ; copy opt_transmitter_id+1[gaslist_gas] to hi | |
| 599 ; check if a transmitter is paired to this tank | |
| 600 tstfsz hi ; high byte of ID <> 0 ? | |
| 601 bra dyn_tank_id_pres_1 ; YES - a transmitter is paired to the tank | |
| 602 tstfsz lo ; low byte of ID <> 0 ? | |
| 603 bra dyn_tank_id_pres_1 ; YES - a transmitter is paired to the tank | |
| 604 STRCAT "----" ; NO - no transmitter paired | |
| 605 bcf imprint_xmitter_pres ; - stop imprinting of transmitter pressure data | |
| 606 return ; - done | |
| 607 dyn_tank_id_pres_1: ; show ID | |
| 608 movf hi,W ; copy high byte of ID to WREG | |
| 609 output_hex ; print it | |
| 610 movf lo,W ; copy low byte of ID to WREG | |
| 611 output_hex ; print it | |
| 612 bsf imprint_xmitter_pres ; start imprinting of transmitter pressure data | |
| 613 return ; done | |
| 614 | |
| 615 | |
| 616 ;----------------------------------------------------------------------------- | |
| 617 ; Call Function - pair a Transmitter to a Tank | |
| 618 ; | |
| 619 do_tank_pairing: | |
| 620 incf pairing_slot,F ; goto next RX data slot | |
| 621 btfsc pairing_slot,3 ; slot = 8? | |
| 622 bra do_tank_pairing_none ; YES - offer unpairing | |
| 623 movf pairing_slot,W ; NO - copy slot to WREG | |
| 624 call get_transmitter_id_by_slot ; WREG = slot (0-7) -> hi:lo = transmitter ID | |
| 625 tstfsz hi ; transmitter found (probe on high byte)? | |
| 626 bra do_tank_pairing_common ; YES - select this transmitter | |
| 627 tstfsz hi ; transmitter found (probe on low byte)? | |
| 628 bra do_tank_pairing_common ; YES - select this transmitter | |
| 629 bra do_tank_pairing ; NO - try next slot | |
| 630 do_tank_pairing_common: | |
| 631 lfsr FSR1,opt_transmitter_id_1 ; load base address of opt_transmitter_id | |
| 632 movf gaslist_gas,W ; load index into WREG (0-9) | |
| 633 rlncf WREG,W ; multiply by 2 because IDs are 2 byte in size | |
| 634 movff lo,PLUSW1 ; copy lo to opt_transmitter_id+0[gaslist_gas] | |
| 635 incf WREG,W ; increment index | |
| 636 movff hi,PLUSW1 ; copy hi to opt_transmitter_id+1[gaslist_gas] | |
| 637 bsf option_changed ; flag that EEPROM needs to be updated | |
| 638 return ; done | |
| 639 do_tank_pairing_none: | |
| 640 setf pairing_slot ; prime slot number with 255 aka -1 | |
| 641 clrf hi ; adjust "no transmitter" ID | |
| 642 clrf lo ; adjust "no transmitter" ID | |
| 643 bra do_tank_pairing_common ; continue with common part | |
| 644 | |
| 645 ENDIF ; _rx_functions | |
| 646 | |
| 647 | |
| 648 IFDEF _ccr_pscr | |
| 649 | |
| 650 ;----------------------------------------------------------------------------- | |
| 651 ; Call Function - copy Diluent Setup to OC Gases | |
| 652 ; | |
| 653 do_copy_dil_to_oc: | |
| 654 bcf copying_dil ; default to copying a gas | |
| 655 movf gaslist_gas,W ; copy current gas or diluent number to WREG | |
| 656 btfss is_diluent_menu ; setting up diluents? | |
| 657 bra do_copy_dil_to_oc_1 ; NO - gaslist_gas is already pointing to an OC gas | |
| 658 addlw -.5 ; YES - subtract offset between diluents and gases | |
| 659 movwf gaslist_gas ; - let gaslist_gas point to the corresponding OC gas | |
| 660 bsf copying_dil ; - we are copying a diluent | |
| 661 bcf is_diluent_menu ; - pretend we are setting up OC gases | |
| 662 do_copy_dil_to_oc_1: | |
| 663 lfsr FSR0,opt_dil_O2_ratio ; load base address of diluents settings, ASM variables | |
| 664 lfsr FSR1,opt_gas_O2_ratio ; load base address of gas settings, ASM variables | |
| 665 movff PLUSW0,PLUSW1 ; copy O2 ratio | |
| 666 addlw .10 ; add offset from O2 ratios to He ratios | |
| 667 movff PLUSW0,PLUSW1 ; copy He ratio | |
| 668 addlw .10 ; add offset from He ratios to types | |
| 669 movff PLUSW0,PLUSW1 ; copy type | |
| 670 addlw .10 ; add offset from type to change depth | |
| 671 movff PLUSW0,PLUSW1 ; copy change depth | |
| 672 addlw -.30 ; wind back to initial gas number | |
| 673 lfsr FSR0,char_I_gas_avail_size+5; load base address of diluents settings, shared variables | |
| 674 lfsr FSR1,char_I_gas_avail_size+0; load base address of gas settings, shared variables | |
| 675 movff PLUSW0,PLUSW1 ; copy tank size | |
| 676 addlw .10 ; add offset from tank sizes to pressure budget | |
| 677 movff PLUSW0,PLUSW1 ; copy pressure budget | |
| 678 call gaslist_cleanup_list ; make sure there is only one gas being first | |
| 679 bsf option_changed ; flag that EEPROM needs to be updated | |
| 680 btfss copying_dil ; are we copying a diluent? | |
| 681 return ; NO - done | |
| 682 bsf is_diluent_menu ; YES - restore to be setting up diluents | |
| 683 movlw .5 ; - offset between OC gases and diluents | |
| 684 addwf gaslist_gas,F ; - let gaslist_gas point to the diluent again | |
| 685 WIN_BOX_BLACK .30,.239,.0,.159 ; - create some visual effect to show activity | |
| 686 WAITMS .200 ; - pause for 200 ms | |
| 687 return ; - done | |
| 688 | |
| 689 ENDIF ; _ccr_pscr | |
| 690 | |
| 691 | |
| 692 ;----------------------------------------------------------------------------- | |
| 693 ; return to Simulator (Deco Calculator) Menu from Sub-Menu | |
| 694 ; | |
| 695 do_return_menu_simulator: | |
| 628 | 696 call menu_processor_double_pop ; drop exit line and back to last line |
| 634 | 697 bra do_menu_simulator_common_2 ; continue |
| 698 | |
| 0 | 699 |
| 634 | 700 ;----------------------------------------------------------------------------- |
| 701 ; return to Simulator (Deco Calculator) Menu from Deco Calculator | |
| 702 ; | |
| 703 global do_return_menu_simulator_planner | |
| 704 do_return_menu_simulator_planner: | |
| 582 | 705 call menu_processor_pop ; back to last line |
| 634 | 706 bra do_menu_simulator_common_1 ; continue |
| 707 | |
| 0 | 708 |
| 634 | 709 ;----------------------------------------------------------------------------- |
| 710 ; Simulator (Deco Calculator) Menu | |
| 711 ; | |
| 712 do_menu_simulator: | |
| 650 | 713 ; ; reset planning parameters to default values |
| 714 ; lfsr FSR0,odiveInterval ; surface interval | |
| 715 ; call option_reset ; reset to default | |
| 716 ; lfsr FSR0,obottomTime ; bottom time | |
| 717 ; call option_reset ; reset to default | |
| 718 ; lfsr FSR0,obottomDepth ; bottom depth | |
| 719 ; call option_reset ; reset to default | |
| 720 ; lfsr FSR0,oSimAGF ; GF/aGF | |
| 721 ; call option_reset ; reset to default | |
| 722 ; | |
| 723 ; IFDEF _gas_contingency | |
| 724 ; lfsr FSR0,oGasContingencySim ; gas contingency | |
| 725 ; call option_reset ; reset to default (volatile option) | |
| 726 ; ENDIF ; _gas_contingency | |
| 628 | 727 |
| 634 | 728 do_menu_simulator_common_1: |
| 623 | 729 call restart_set_modes_and_flags ; initialize dive mode settings |
| 634 | 730 |
| 731 do_menu_simulator_common_2: | |
| 732 | |
| 733 IFDEF _ccr_pscr | |
| 734 | |
| 604 | 735 movff opt_dive_mode,WREG ; get dive mode: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR |
| 634 | 736 decfsz WREG,W ; subtract one, became zero? |
| 737 bra do_menu_simulator_common_oc ; NO - use OC version | |
| 738 ;bra do_menu_simulator_common_ccr; YES - use CCR version | |
| 604 | 739 |
| 634 | 740 do_menu_simulator_common_ccr: |
| 631 | 741 MENU_BEGIN tSimulator, .7 |
| 634 | 742 MENU_OPT_INC tIntvl, odiveInterval |
| 743 MENU_OPT_INC tBtDep, obottomDepth | |
| 604 | 744 MENU_CALL tInter, do_demo_divemode |
| 634 | 745 MENU_OPT_INC tBtTm, obottomTime |
| 746 MENU_CALL tCalculatorSetup, do_menu_simulator_more | |
| 604 | 747 MENU_CALL tDeco, do_demo_planner |
| 748 MENU_CALL tBack, do_return_main_menu | |
| 749 MENU_END | |
| 750 | |
| 634 | 751 ENDIF ; _ccr_pscr |
| 752 | |
| 753 do_menu_simulator_common_oc: | |
| 631 | 754 MENU_BEGIN tSimulator, .7 |
| 634 | 755 MENU_OPT_INC tIntvl, odiveInterval |
| 756 MENU_OPT_INC tBtDep, obottomDepth | |
| 582 | 757 MENU_CALL tInter, do_demo_divemode |
| 634 | 758 MENU_OPT_INC tBtTm, obottomTime |
| 759 MENU_OPT_INC tuseAGF, oSimAGF | |
| 582 | 760 MENU_CALL tDeco, do_demo_planner |
| 604 | 761 MENU_CALL tBack, do_return_main_menu |
| 582 | 762 MENU_END |
| 0 | 763 |
| 634 | 764 |
| 765 ;----------------------------------------------------------------------------- | |
| 766 ; Call Function - start Simulator Mode | |
| 767 ; | |
| 768 do_demo_divemode: | |
| 769 goto demo_divemode ; code is hosted in divemode.asm | |
| 770 | |
| 771 | |
| 772 ;----------------------------------------------------------------------------- | |
| 773 ; Call Function - start Deco Calculator | |
| 774 ; | |
| 775 do_demo_planner: | |
| 776 goto demo_planner ; code is hosted in simulator.asm | |
| 777 | |
| 778 | |
| 779 ;----------------------------------------------------------------------------- | |
| 780 ; Simulator (Deco Calculator) Menu - 2nd Layer | |
| 781 ; | |
| 782 do_menu_simulator_more: | |
| 628 | 783 IFDEF _gas_contingency |
| 631 | 784 MENU_BEGIN tSimulator, .4 |
| 634 | 785 MENU_OPT_INC tSelectSetpoint, oSimSetpoint |
| 786 MENU_OPT_INC tuseAGF, oSimAGF | |
| 787 MENU_OPT_INC tGasContingencySim, oGasContingencySim | |
| 788 MENU_CALL tBack, do_return_menu_simulator | |
| 628 | 789 MENU_END |
| 790 ELSE | |
| 631 | 791 MENU_BEGIN tSimulator, .3 |
| 634 | 792 MENU_OPT_INC tSelectSetpoint, oSimSetpoint |
| 793 MENU_OPT_INC tuseAGF, oSimAGF | |
| 794 MENU_CALL tBack, do_return_menu_simulator | |
| 795 MENU_END | |
| 796 ENDIF ; _gas_contingency | |
| 797 | |
| 798 | |
| 799 ;----------------------------------------------------------------------------- | |
| 800 ; return to Dive Settings Menu from Sub-Menu | |
| 801 ; | |
| 802 do_return_menu_dive: | |
| 803 call menu_processor_double_pop ; drop exit line and back to last line | |
| 640 | 804 ;bra do_menu_dive ; continue |
| 634 | 805 |
| 806 ;----------------------------------------------------------------------------- | |
| 807 ; Dive Settings Menu - 1st Layer | |
| 808 ; | |
| 809 do_menu_dive: | |
| 656 | 810 btfsc dn_flag ; force menu all caps in dn hardware |
| 811 bsf force_all_caps | |
| 634 | 812 MENU_BEGIN tDiveModeMenu, .6 |
| 813 MENU_CALL tDiveSetup, do_menu_dive_dive ; dive setup | |
| 814 MENU_CALL tDecoSetup, do_menu_dive_deco ; deco setup | |
| 815 MENU_CALL tSACSetup, do_menu_dive_SAC ; SAC setup | |
| 816 MENU_CALL tppO2Setup, do_menu_dive_ppO2 ; ppO2 limits | |
| 817 MENU_CALL tStopsSetup, do_menu_dive_stops ; stops setup | |
| 818 MENU_CALL tBack, do_return_main_menu | |
| 819 MENU_END | |
| 820 | |
| 821 ;----------------------------------------------------------------------------- | |
| 822 ; Dive Settings Menu - 2nd Layer - Dive Mode | |
| 823 ; | |
| 824 do_menu_dive_dive: | |
| 825 IFDEF _cave_mode | |
| 650 | 826 MENU_BEGIN tDiveSetup, .7 |
| 827 MENU_OPT_INC tDvMode, oDiveMode ; dive mode | |
| 828 MENU_OPT_INC tCvMode, oCaveMode ; cave mode | |
| 829 MENU_OPT_INC tFTTSMenu, oExtraTime ; fTTS/delay | |
| 634 | 830 MENU_OPT_INC tTimeoutDive, oDiveTimeout ; dive timeout |
| 650 | 831 MENU_OPT_INC tStoreApnoeDive, oStoreApnoe ; store apnoe |
| 832 MENU_OPT_INC tWarningLevel, oWarningLevel ; Warning level | |
| 833 MENU_CALL tBack, do_return_menu_dive | |
| 634 | 834 MENU_END |
| 835 ELSE | |
| 650 | 836 MENU_BEGIN tDiveSetup, .6 |
| 837 MENU_OPT_INC tDvMode, oDiveMode ; dive mode | |
| 838 MENU_OPT_INC tFTTSMenu, oExtraTime ; fTTS/delay | |
| 634 | 839 MENU_OPT_INC tTimeoutDive, oDiveTimeout ; dive timeout |
| 650 | 840 MENU_OPT_INC tStoreApnoeDive, oStoreApnoe ; store apnoe |
| 841 MENU_OPT_INC tWarningLevel, oWarningLevel ; Warning level | |
| 842 MENU_CALL tBack, do_return_menu_dive | |
| 582 | 843 MENU_END |
| 628 | 844 ENDIF |
| 524 | 845 |
|
298
2fe34fc0e2ae
new submenu for gas consumption, show actual mix instead of GAS1-GAS5 in deco planner
heinrichsweikamp
parents:
275
diff
changeset
|
846 |
| 634 | 847 ;----------------------------------------------------------------------------- |
| 848 ; return to Dive Settings Menu from Sub-Menu | |
| 849 ; | |
| 850 do_return_menu_dive_deco: | |
| 851 call menu_processor_double_pop ; drop exit line and back to last line | |
| 640 | 852 ;bra do_menu_dive_deco ; continue |
| 0 | 853 |
| 854 | |
| 634 | 855 ;----------------------------------------------------------------------------- |
| 856 ; Dive Settings Menu - 2nd Layer - Deco Mode | |
| 857 ; | |
| 858 do_menu_dive_deco: | |
| 640 | 859 MENU_BEGIN tDecoSetup, .5 |
| 634 | 860 MENU_OPT_INC tDkMode, oDecoMode ; ZH-L16 /GF |
| 640 | 861 MENU_CALL tSDMenu, do_menu_dive_deco_SD ; SD settings |
| 862 MENU_CALL tGFMenu, do_menu_dive_deco_GF ; GF settings | |
| 634 | 863 MENU_OPT_INC tAltMode, oAltMode ; altitude mode |
| 864 MENU_CALL tBack, do_return_menu_dive | |
| 582 | 865 MENU_END |
| 866 | |
| 0 | 867 |
| 634 | 868 ;----------------------------------------------------------------------------- |
| 640 | 869 ; Dive Settings Menu - 3nd Layer - Deco Mode - SD Settings |
| 870 ; | |
| 871 do_menu_dive_deco_SD: | |
| 872 TSTOSS char_I_model ; in GF mode? | |
| 873 bra do_menu_dive_deco_SD_noGF ; NO | |
| 874 ;bra do_menu_dive_deco_SD_GF ; YES | |
| 875 | |
| 876 do_menu_dive_deco_SD_GF: | |
| 877 MENU_BEGIN tSDMenu, .3 | |
| 878 MENU_OPT_INC tSaturationMult, osatmultgf ; saturation GF mode | |
| 879 MENU_OPT_INC tDesaturationMult, odesatmultgf ; desaturation GF mode | |
| 880 MENU_CALL tBack, do_return_menu_dive_deco | |
| 881 MENU_END | |
| 882 | |
| 883 do_menu_dive_deco_SD_noGF: | |
| 884 MENU_BEGIN tSDMenu, .3 | |
| 885 MENU_OPT_INC tSaturationMult, osatmult ; saturation non-GF mode | |
| 886 MENU_OPT_INC tDesaturationMult, odesatmult ; desaturation non-GF mode | |
| 887 MENU_CALL tBack, do_return_menu_dive_deco | |
| 888 MENU_END | |
| 889 | |
| 890 | |
| 891 ;----------------------------------------------------------------------------- | |
| 634 | 892 ; Dive Settings Menu - 3nd Layer - Deco Mode - GF Settings |
| 893 ; | |
| 894 do_menu_dive_deco_GF: | |
| 895 MENU_BEGIN tGFMenu, .6 | |
| 896 MENU_OPT_INC tGF_low, oGF_low ; GF low | |
| 897 MENU_OPT_INC tGF_high, oGF_high ; GF high | |
| 898 MENU_OPT_INC taGFenable, oEnable_aGF ; aGF selectable | |
| 899 MENU_OPT_INC taGF_low, oaGF_low ; aGF low | |
| 900 MENU_OPT_INC taGF_high, oaGF_high ; aGF high | |
| 901 MENU_CALL tBack, do_return_menu_dive_deco | |
| 902 MENU_END | |
| 903 | |
| 904 | |
| 905 ;----------------------------------------------------------------------------- | |
| 906 ; Dive Settings Menu - 2nd Layer - SAC Setup | |
| 907 ; | |
| 908 do_menu_dive_SAC: | |
| 909 IFDEF _gas_contingency | |
| 910 MENU_BEGIN tSACSetup, .6 | |
| 911 MENU_OPT_INC tCalcGasNeeds, oCalcAscGas ; calc.gas | |
| 912 MENU_OPT_INC tGasContingencyDive, oGasContingencyDive ; switch tank if used up | |
| 913 MENU_OPT_INC tGasChangeTime, oGasChangeTime ; gas change time | |
| 914 MENU_OPT_INC tSetWorkSAC, oWork_SAC ; work SAC | |
| 915 MENU_OPT_INC tSetDecoSAC, oDeco_SAC ; deco SAC | |
| 916 MENU_CALL tBack, do_return_menu_dive | |
| 582 | 917 MENU_END |
| 623 | 918 ELSE |
| 634 | 919 MENU_BEGIN tSACSetup, .5 |
| 920 MENU_OPT_INC tCalcGasNeeds, oCalcAscGas ; calc.gas | |
| 921 MENU_OPT_INC tGasChangeTime, oGasChangeTime ; gas change time | |
| 922 MENU_OPT_INC tSetWorkSAC, oWork_SAC ; work SAC | |
| 923 MENU_OPT_INC tSetDecoSAC, oDeco_SAC ; deco SAC | |
| 924 MENU_CALL tBack, do_return_menu_dive | |
| 623 | 925 MENU_END |
| 926 ENDIF | |
| 582 | 927 |
|
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
90
diff
changeset
|
928 |
| 634 | 929 ;----------------------------------------------------------------------------- |
| 930 ; Dive Settings Menu - 2nd Layer - ppO2 Setup | |
| 931 ; | |
| 932 do_menu_dive_ppO2: | |
| 631 | 933 IFDEF _ccr_pscr |
| 934 IFDEF _helium | |
| 935 MENU_BEGIN tppO2Setup, .6 | |
| 634 | 936 MENU_DYNAMIC dyn_ppo2_max, do_toggle_ppO2_max_work ; max work |
| 937 MENU_DYNAMIC dyn_ppo2_max_deco, do_toggle_ppO2_max_deco ; max deco | |
| 938 MENU_DYNAMIC dyn_ppo2_min, do_toggle_ppO2_min ; min OC | |
| 939 MENU_DYNAMIC dyn_ppo2_min_cc, do_toggle_ppO2_min_cc ; min loop | |
| 940 MENU_OPT_INC tIBCDwarning, oEnable_IBCD ; IBCD warning | |
| 941 MENU_CALL tBack, do_return_menu_dive | |
| 631 | 942 MENU_END |
| 943 ELSE | |
| 944 MENU_BEGIN tppO2Setup, .5 | |
| 634 | 945 MENU_DYNAMIC dyn_ppo2_max, do_toggle_ppO2_max_work ; max work |
| 946 MENU_DYNAMIC dyn_ppo2_max_deco, do_toggle_ppO2_max_deco ; max deco | |
| 947 MENU_DYNAMIC dyn_ppo2_min, do_toggle_ppO2_min ; min OC | |
| 948 MENU_DYNAMIC dyn_ppo2_min_cc, do_toggle_ppO2_min_cc ; min loop | |
| 949 MENU_CALL tBack, do_return_menu_dive | |
| 631 | 950 MENU_END |
| 951 ENDIF ; _helium | |
| 952 ELSE | |
| 953 IFDEF _helium | |
| 954 MENU_BEGIN tppO2Setup, .5 | |
| 634 | 955 MENU_DYNAMIC dyn_ppo2_max, do_toggle_ppO2_max_work ; max work |
| 956 MENU_DYNAMIC dyn_ppo2_max_deco, do_toggle_ppO2_max_deco ; max deco | |
| 957 MENU_DYNAMIC dyn_ppo2_min, do_toggle_ppO2_min ; min OC | |
| 958 MENU_OPT_INC tIBCDwarning, oEnable_IBCD ; IBCD warning | |
| 959 MENU_CALL tBack, do_return_menu_dive | |
| 631 | 960 ELSE |
| 656 | 961 btfsc dn_flag ; force menu all caps in dn hardware |
| 962 bsf force_all_caps | |
| 631 | 963 MENU_BEGIN tppO2Setup, .4 |
| 634 | 964 MENU_DYNAMIC dyn_ppo2_max, do_toggle_ppO2_max_work ; max work |
| 965 MENU_DYNAMIC dyn_ppo2_max_deco, do_toggle_ppO2_max_deco ; max deco | |
| 966 MENU_DYNAMIC dyn_ppo2_min, do_toggle_ppO2_min ; min OC | |
| 967 MENU_CALL tBack, do_return_menu_dive | |
| 631 | 968 MENU_END |
| 969 ENDIF ; _helium | |
| 970 ENDIF ; _ccr_pscr | |
| 971 | |
| 972 | |
| 634 | 973 ;----------------------------------------------------------------------------- |
| 974 ; dynamic Title - show maximum ppO2 - Work | |
| 975 ; | |
| 976 dyn_ppo2_max: | |
| 977 STRCAT_TEXT tPPO2Max ; print text | |
| 978 movff char_I_ppO2_max_work,lo ; get value | |
| 979 movlw ppo2_warning_high_default ; load default | |
| 980 bra dyn_ppo2_common ; continue with common part | |
| 981 | |
| 982 | |
| 983 ;----------------------------------------------------------------------------- | |
| 984 ; dynamic Title - show maximum ppO2 - Deco | |
| 985 ; | |
| 986 dyn_ppo2_max_deco: | |
| 987 STRCAT_TEXT tPPO2DECO ; print text | |
| 988 movff char_I_ppO2_max_deco,lo ; get value | |
| 989 movlw ppo2_warning_deco_default ; load default | |
| 990 bra dyn_ppo2_common ; continue with common part | |
| 991 | |
| 992 | |
| 993 ;----------------------------------------------------------------------------- | |
| 994 ; dynamic Title - show minimum ppO2 | |
| 995 ; | |
| 996 dyn_ppo2_min: | |
| 997 STRCAT_TEXT tPPO2MIN ; print text | |
| 998 movff char_I_ppO2_min,lo ; get value | |
| 999 movlw ppo2_warning_low_default ; load default | |
| 1000 bra dyn_ppo2_common ; continue with common part | |
| 1001 | |
| 1002 | |
| 1003 IFDEF _ccr_pscr | |
| 1004 | |
| 1005 ;----------------------------------------------------------------------------- | |
| 1006 ; dynamic Title - show minimum ppO2 - Loop Modes | |
| 1007 ; | |
| 1008 dyn_ppo2_min_cc: | |
| 1009 STRCAT_TEXT tPPO2MINCC ; print text | |
| 1010 movff char_I_ppO2_min_loop,lo ; get value | |
| 1011 movlw ppo2_warning_loop_default ; load default | |
| 1012 ;bra dyn_ppo2_common ; continue with common part | |
| 1013 | |
| 1014 ENDIF | |
| 1015 | |
| 1016 | |
| 1017 ;----------------------------------------------------------------------------- | |
| 1018 ; Helper Function to all show ppO2 dynamic Titles | |
| 1019 ; | |
| 1020 dyn_ppo2_common: | |
| 1021 movwf up ; copy default to up | |
| 1022 clrf hi ; clear hi | |
| 1023 bsf leftbind ; print left-aligned | |
| 1024 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
| 1025 output_256 ; print ppO2 as x.xx | |
| 1026 STRCAT_TEXT tbar ; append unit | |
| 1027 movf up,W ; get default value into WREG | |
| 1028 cpfseq lo ; current value = default value ? | |
| 1029 bra divesets_ppo2_common2 ; NO - add an "*" | |
| 1030 return ; YES - done | |
| 1031 divesets_ppo2_common2: | |
| 1032 PUTC "*" ; append a star | |
| 1033 return ; done | |
| 1034 | |
| 1035 | |
| 1036 ;----------------------------------------------------------------------------- | |
| 1037 ; Call Function - increment maximum ppO2 - Work | |
| 1038 ; | |
| 1039 do_toggle_ppO2_max_work: ; add 0.1 bar | |
| 1040 movff char_I_ppO2_max_work,lo ; bank-safe copy | |
| 1041 movlw .10 | |
| 1042 addwf lo,F | |
| 1043 movlw ppo2_warning_high_highest | |
| 1044 cpfsgt lo | |
| 1045 bra do_toggle_ppo2_max2 | |
| 1046 movlw ppo2_warning_high_lowest | |
| 1047 movwf lo | |
| 1048 do_toggle_ppo2_max2: | |
| 1049 movff lo,char_I_ppO2_max_work | |
| 1050 return | |
| 1051 | |
| 1052 | |
| 1053 ;----------------------------------------------------------------------------- | |
| 1054 ; Call Function - increment maximum ppO2 - Deco | |
| 1055 ; | |
| 1056 do_toggle_ppO2_max_deco: ; add 0.1 bar | |
| 1057 movff char_I_ppO2_max_deco,lo ; bank-safe copy | |
| 1058 movlw .10 | |
| 1059 addwf lo,F | |
| 1060 movlw ppo2_warning_deco_highest | |
| 1061 cpfsgt lo | |
| 1062 bra do_toggle_ppO2_max_deco2 | |
| 1063 movlw ppo2_warning_deco_lowest | |
| 1064 movwf lo | |
| 1065 do_toggle_ppO2_max_deco2: | |
| 1066 movff lo,char_I_ppO2_max_deco | |
| 1067 return | |
| 1068 | |
| 1069 | |
| 1070 ;----------------------------------------------------------------------------- | |
| 1071 ; Call Function - increment minimum ppO2 | |
| 1072 ; | |
| 1073 do_toggle_ppO2_min: ; sub 0.1 bar | |
| 1074 movff char_I_ppO2_min,lo ; bank-safe copy | |
| 1075 incf lo,F | |
| 1076 movlw ppo2_warning_low_highest | |
| 1077 cpfsgt lo | |
| 1078 bra do_toggle_ppO2_min2 | |
| 1079 movlw ppo2_warning_low_lowest | |
| 1080 movwf lo | |
| 1081 do_toggle_ppO2_min2: | |
| 1082 movff lo,char_I_ppO2_min | |
| 1083 return | |
| 1084 | |
| 1085 | |
| 1086 ;----------------------------------------------------------------------------- | |
| 1087 ; Call Function - increment minimum ppO2 - Loop Modes | |
| 1088 ; | |
| 1089 do_toggle_ppO2_min_cc: ; sub 0.1 bar | |
| 1090 movff char_I_ppO2_min_loop,lo ; bank-safe copy | |
| 1091 incf lo,F | |
| 1092 movlw ppo2_warning_loop_highest | |
| 1093 cpfsgt lo | |
| 1094 bra do_toggle_ppO2_min_cc2 | |
| 1095 movlw ppo2_warning_loop_lowest | |
| 1096 movwf lo | |
| 1097 do_toggle_ppO2_min_cc2: | |
| 1098 movff lo,char_I_ppO2_min_loop | |
| 1099 return | |
| 1100 | |
| 1101 | |
| 1102 ;----------------------------------------------------------------------------- | |
| 1103 ; Dive Settings Menu - 2nd Layer - Stops & Depth | |
| 1104 ; | |
| 1105 do_menu_dive_stops: | |
| 631 | 1106 MENU_BEGIN tStopsSetup, .6 |
| 634 | 1107 MENU_OPT_INC tSafetyStop, oSafetyStop ; safety stop |
| 1108 MENU_OPT_INC tExtendedStops, oExtendedStops ; extended stops | |
| 1109 MENU_OPT_INC tLastDecostop, oLastDeco ; last deco stop | |
| 1110 MENU_OPT_INC tDvSalinity, oDiveSalinity ; salinity | |
| 1111 MENU_OPT_INC tDepthWarn, oMaxDepth ; depth limit | |
| 1112 MENU_CALL tBack, do_return_menu_dive | |
| 582 | 1113 MENU_END |
| 560 | 1114 |
| 1115 | |
| 634 | 1116 ;----------------------------------------------------------------------------- |
| 1117 ; return to Settings Menu from Sub-Sub-Menu | |
| 1118 ; | |
| 1119 do_return_menu_settings_deeper: ; entry point for return from info menu 2 | |
| 1120 call menu_processor_pop ; drop one more stack entry | |
| 1121 ;bra do_return_menu_settings ; continue | |
| 560 | 1122 |
| 1123 | |
| 634 | 1124 ;----------------------------------------------------------------------------- |
| 1125 ; return to Settings Menu from Sub-Menu | |
| 1126 ; | |
| 1127 do_return_menu_settings: | |
| 623 | 1128 bcf imprint_time_date ; stop imprinting of current time & date |
| 582 | 1129 call menu_processor_double_pop ; drop exit line and back to last line |
| 631 | 1130 |
| 604 | 1131 IFDEF _rx_mode |
| 623 | 1132 bcf tr_functions_activated ; set TR functions as deactivated by default |
| 1133 btfss ostc_rx_present ; TR model / TR module up & running? | |
| 634 | 1134 bra do_menu_settings ; NO - keep deactivated |
| 623 | 1135 movff opt_TR_mode,WREG ; YES - get TR mode |
| 1136 tstfsz WREG ; - TR mode <> off ? | |
| 1137 bsf tr_functions_activated ; YES - set TR functions as activated | |
| 604 | 1138 ENDIF |
| 582 | 1139 |
| 634 | 1140 |
| 1141 ;----------------------------------------------------------------------------- | |
| 1142 ; Settings Menu - 1st Layer | |
| 1143 ; | |
| 1144 do_menu_settings: | |
| 656 | 1145 btfsc dual_comm ; Dual comm hardware (USB and BLE-only)? |
| 1146 bra do_menu_settings_dual_comm ; Use this menu here on the first layer | |
| 1147 | |
| 631 | 1148 IFDEF _hwos_sport |
| 634 | 1149 bsf ble_available ; required for very old OSTC sport |
| 631 | 1150 ENDIF |
| 634 | 1151 btfsc ble_available ; BT available? |
| 1152 bra do_menu_settings_bt ; YES - do BT menu | |
| 631 | 1153 |
| 651 | 1154 MENU_BEGIN tSystSets, .6 |
| 634 | 1155 MENU_CALL tInfoMenu, do_menu_info |
| 651 | 1156 MENU_CALL tUsbTitle, do_comm_mode_usb |
| 634 | 1157 MENU_CALL tSetTimeDate, do_menu_date_time |
| 1158 MENU_CALL tDispSets, do_menu_dispsets | |
| 1159 MENU_CALL tSysSets, do_menu_syssets | |
| 604 | 1160 MENU_CALL tBack, do_return_main_menu |
| 582 | 1161 MENU_END |
|
155
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
1162 |
| 634 | 1163 do_menu_settings_bt: |
| 604 | 1164 IFDEF _rx_functions |
| 631 | 1165 btfss ostc_rx_present ; TR model and TR activated? |
| 634 | 1166 bra do_menu_settings_noRX ; NO |
| 604 | 1167 |
| 1168 MENU_BEGIN tSystSets, .7 | |
| 634 | 1169 MENU_CALL tInfoMenu, do_menu_info |
| 1170 MENU_CALL tBleTitle, do_comm_mode_bt | |
| 1171 MENU_CALL tTrSettings, do_menu_settings_TR | |
| 1172 MENU_CALL tSetTimeDate, do_menu_date_time | |
| 1173 MENU_CALL tDispSets, do_menu_dispsets | |
| 1174 MENU_CALL tSysSets, do_menu_syssets | |
| 604 | 1175 MENU_CALL tBack, do_return_main_menu |
| 1176 MENU_END | |
| 1177 ENDIF | |
| 1178 | |
| 634 | 1179 do_menu_settings_noRX: |
| 631 | 1180 MENU_BEGIN tSystSets, .6 |
| 634 | 1181 MENU_CALL tInfoMenu, do_menu_info |
| 1182 MENU_CALL tBleTitle, do_comm_mode_bt | |
| 1183 MENU_CALL tSetTimeDate, do_menu_date_time | |
| 1184 MENU_CALL tDispSets, do_menu_dispsets | |
| 1185 MENU_CALL tSysSets, do_menu_syssets | |
| 631 | 1186 MENU_CALL tBack, do_return_main_menu |
| 1187 MENU_END | |
| 1188 | |
| 656 | 1189 do_menu_settings_dual_comm: |
| 1190 MENU_BEGIN tSystSets, .7 | |
| 1191 MENU_CALL tInfoMenu, do_menu_info | |
| 1192 MENU_CALL tBleTitle, do_comm_mode_bt | |
| 1193 MENU_CALL tUsbTitle, do_comm_mode_usb | |
| 1194 MENU_CALL tSetTimeDate, do_menu_date_time | |
| 1195 MENU_CALL tDispSets, do_menu_dispsets | |
| 1196 MENU_CALL tSysSets, do_menu_syssets | |
| 1197 MENU_CALL tBack, do_return_main_menu | |
| 1198 MENU_END | |
| 1199 | |
| 604 | 1200 |
| 634 | 1201 ;----------------------------------------------------------------------------- |
| 651 | 1202 ; Call Functions - start Communication Mode (BT and USB) |
| 634 | 1203 ; |
| 1204 do_comm_mode_bt: | |
| 1205 goto comm_mode_bt ; code hosted in comm.asm | |
| 651 | 1206 do_comm_mode_usb: |
| 1207 goto comm_mode_usb ; code hosted in comm.asm | |
| 634 | 1208 |
| 1209 | |
| 1210 ;----------------------------------------------------------------------------- | |
| 1211 ; Settings Menu - 2nd Layer - System Infos - Page 1 | |
| 1212 ; | |
| 1213 do_menu_info: | |
| 604 | 1214 IFDEF _rx_functions |
| 631 | 1215 btfss ostc_rx_present ; TR model? |
| 634 | 1216 bra do_menu_info_noRX ; NO |
| 604 | 1217 |
| 631 | 1218 MENU_BEGIN tInfoMenu, .7 |
| 634 | 1219 MENU_DYNAMIC dyn_show_uptime, 0 |
| 1220 MENU_DYNAMIC dyn_show_serial, 0 | |
| 1221 MENU_DYNAMIC dyn_show_firmware_ostc, 0 | |
| 1222 MENU_DYNAMIC dyn_show_fw_creation_date, 0 | |
| 1223 MENU_DYNAMIC dyn_show_firmware_rx, 0 | |
| 1224 MENU_DYNAMIC dyn_show_total_dives, 0 | |
| 1225 MENU_CALL tMore, do_menu_info2 | |
| 582 | 1226 MENU_END |
| 604 | 1227 ENDIF |
| 1228 | |
| 634 | 1229 do_menu_info_noRX: |
| 631 | 1230 MENU_BEGIN tInfoMenu, .6 |
| 634 | 1231 MENU_DYNAMIC dyn_show_uptime, 0 |
| 1232 MENU_DYNAMIC dyn_show_serial, 0 | |
| 1233 MENU_DYNAMIC dyn_show_firmware_ostc, 0 | |
| 1234 MENU_DYNAMIC dyn_show_fw_creation_date, 0 | |
| 1235 MENU_DYNAMIC dyn_show_total_dives, 0 | |
| 1236 MENU_CALL tMore, do_menu_info2 | |
| 631 | 1237 MENU_END |
| 1238 | |
| 634 | 1239 |
| 1240 ;----------------------------------------------------------------------------- | |
| 1241 ; dynamic Title - show Uptime | |
| 1242 ; | |
| 1243 dyn_show_uptime: | |
| 1244 STRCAT_TEXT tUptime ; print title | |
| 1245 SMOVQQ uptime,xC ; ISR-safe copy of uptime:4 to xC:4 | |
| 1246 goto output_secs_as_days_hours ; print seconds as days and hours and return | |
| 1247 | |
| 1248 | |
| 1249 ;----------------------------------------------------------------------------- | |
| 1250 ; dynamic Title - show Uptime | |
| 1251 ; | |
| 1252 dyn_show_serial: | |
| 1253 STRCAT_TEXT tSerial ; print title | |
| 1254 goto TFT_cat_serial ; print serial number and return | |
| 1255 | |
| 1256 ;----------------------------------------------------------------------------- | |
| 1257 ; dynamic Title - show Firmware Version | |
| 1258 ; | |
| 1259 dyn_show_firmware_ostc: | |
| 1260 STRCAT_TEXT tFirmware ; print title | |
| 1261 call TFT_cat_firmware ; print firmware version | |
| 1262 PUTC " " ; print a dot | |
| 1263 goto TFT_cat_beta_short ; print beta/release state and return | |
| 1264 | |
| 1265 | |
| 1266 ;----------------------------------------------------------------------------- | |
| 1267 ; dynamic Title - show Firmware creation Date | |
| 1268 ; | |
| 1269 dyn_show_fw_creation_date: | |
| 1270 STRCAT_TEXT tFirmwareDate ; print title | |
| 1271 movlw firmware_creation_year ; get firmware creation year | |
| 1272 movwf lo ; copy to lo | |
| 1273 movlw firmware_creation_month ; get firmware creation month | |
| 1274 movwf hi ; copy to hi | |
| 1275 movlw firmware_creation_day ; get firmware creation day | |
| 1276 movwf up ; copy to up | |
| 1277 goto output_date ; print date and return | |
| 631 | 1278 |
| 604 | 1279 |
| 1280 IFDEF _rx_functions | |
| 623 | 1281 |
| 634 | 1282 ;----------------------------------------------------------------------------- |
| 1283 ; dynamic Title - show RX Firmware Version (also used by start.asm) | |
| 1284 ; | |
| 1285 global dyn_show_firmware_rx | |
| 1286 dyn_show_firmware_rx: | |
| 1287 STRCAT_TEXT tFirmware_rx ; print title | |
| 1288 movff rx_firmware_cur_major,lo ; get major version | |
| 1289 bsf leftbind ; print left-aligned | |
| 1290 output_99 ; print major (0-99) | |
| 1291 PUTC '.' ; print a dot | |
| 1292 movff rx_firmware_cur_minor,lo ; get minor | |
| 1293 output_99x ; print minor (00-99) | |
| 1294 return ; done | |
| 1295 | |
| 1296 ENDIF ; _rx_functions | |
| 1297 | |
| 1298 | |
| 1299 ;----------------------------------------------------------------------------- | |
| 1300 ; dynamic Title - show total Number of Dives | |
| 1301 ; | |
| 1302 dyn_show_total_dives: | |
| 1303 STRCAT_TEXT tTotalDives ; print title | |
| 1304 call eeprom_total_dives_read ; read total number of dives | |
| 1305 bsf leftbind ; print left-aligned | |
| 1306 output_65535 ; print number of total dives (0-65535) | |
| 1307 return ; done | |
| 1308 | |
| 1309 | |
| 1310 ;----------------------------------------------------------------------------- | |
| 1311 ; Settings Menu - 2nd Layer - System Infos - Page 2 | |
| 1312 ; | |
| 1313 do_menu_info2: | |
| 1314 IFNDEF _comm_debug | |
| 656 | 1315 MENU_BEGIN tInfoMenu, .7 |
| 634 | 1316 MENU_DYNAMIC dyn_show_battery_volts, 0 |
| 654 | 1317 MENU_DYNAMIC dyn_show_battery_cycles, 0 |
| 634 | 1318 MENU_DYNAMIC dyn_show_config, 0 |
| 656 | 1319 MENU_DYNAMIC dyn_show_config2, 0 |
| 634 | 1320 MENU_DYNAMIC dyn_show_sensor_calib, 0 |
| 1321 MENU_DYNAMIC dyn_show_sensor_offset, 0 | |
| 1322 MENU_CALL tBack, do_return_menu_settings_deeper | |
| 1323 MENU_END | |
| 1324 ELSE | |
| 654 | 1325 MENU_BEGIN tInfoMenu, .7 |
| 634 | 1326 MENU_DYNAMIC dyn_show_battery_volts, 0 |
| 654 | 1327 MENU_DYNAMIC dyn_show_battery_cycles, 0 |
| 634 | 1328 MENU_DYNAMIC dyn_show_config, 0 |
| 1329 MENU_DYNAMIC dyn_show_sensor_calib, 0 | |
| 1330 MENU_DYNAMIC dyn_show_sensor_offset, 0 | |
| 1331 MENU_OPT_INC tCommTimeout, oCommTimeout | |
| 1332 MENU_CALL tBack, do_return_menu_settings_deeper | |
| 1333 MENU_END | |
| 1334 ENDIF | |
| 1335 | |
| 1336 | |
| 1337 ;----------------------------------------------------------------------------- | |
| 1338 ; dynamic Title - show Battery Volts and Type | |
| 1339 ; | |
| 1340 dyn_show_battery_volts: | |
| 1341 STRCAT_TEXT tBatteryV ; print text | |
| 1342 MOVII batt_voltage,mpr ; get battery voltage | |
| 1343 bsf decimal_digit3 ; place a decimal point in front of digit 3 | |
| 1344 bsf omit_digit_1 ; do not print 1st digit | |
| 1345 output_9999 ; print as x.yy- | |
| 1346 STRCAT " V(T" ; append fix legend | |
| 1347 movff battery_type,lo ; =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 | |
| 1348 output_9 ; print battery type code (0-9) | |
| 1349 PUTC ")" ; append fix legend | |
| 1350 return ; done | |
| 1351 | |
| 654 | 1352 ;----------------------------------------------------------------------------- |
| 1353 ; dynamic Title - show Battery charge cycles | |
| 1354 ; | |
| 1355 dyn_show_battery_cycles: | |
| 1356 STRCAT_TEXT tBatteryCycles ; print text | |
| 1357 MOVII charge_cycles,mpr ; get battery cycles | |
| 1358 bsf leftbind ; print left-aligned | |
| 1359 output_65535 ; print # cycles | |
| 1360 return ; done | |
| 1361 | |
| 634 | 1362 ;----------------------------------------------------------------------------- |
| 1363 ; dynamic Title - show Hardware / Software Configuration | |
| 1364 ; | |
| 1365 dyn_show_config: | |
| 1366 STRCAT_TEXT tHardware ; print text | |
| 1367 call I2C_init_compass ; start compass to get compass configuration | |
| 1368 movf HW_descriptor,W ; copy hardware descriptor to WREG | |
| 648 | 1369 output_hex ; print as hex |
| 634 | 1370 movf HW_variants,W ; copy hardware variants to WREG |
| 648 | 1371 output_hex ; print as hex |
| 1372 PUTC "-" ; print a separator | |
| 1373 movlw FW_CONF ; get firmware configuration | |
| 1374 output_hex ; print as hex | |
| 634 | 1375 call get_cpu_version ; get CPU version |
| 648 | 1376 output_hex ; print as hex |
| 1377 return ; Done. | |
| 656 | 1378 |
| 1379 dyn_show_config2: | |
| 1380 STRCAT_TEXT tHardware ; print text | |
| 1381 movf HW_variants2,W ; copy hardware variants2 to WREG | |
| 1382 output_hex ; print as hex | |
| 1383 movf HW_variants3,W ; copy hardware variants3 to WREG | |
| 1384 output_hex ; print as hex | |
| 1385 PUTC "/" ; print a separator | |
| 1386 movff i2c_error_counter+1,WREG | |
| 1387 output_hex ; print as hex | |
| 1388 movff i2c_error_counter+0,WREG | |
| 1389 output_hex ; print as hex | |
| 648 | 1390 return ; Less I/O CPU done. |
| 634 | 1391 |
| 1392 ;----------------------------------------------------------------------------- | |
| 1393 ; dynamic Title - show Pressure Sensor Calibration Data C1 and C5 | |
| 1394 ; | |
| 1395 dyn_show_sensor_calib: | |
| 1396 STRCAT_TEXT tSensorC ; print label | |
| 1397 movff C1+1,WREG ; get C1, high byte | |
| 1398 output_hex ; print C1, high byte | |
| 1399 movff C1+0,WREG ; get C1, low byte | |
| 1400 output_hex ; print C1, low byte | |
| 1401 PUTC "-" ; print a separator | |
| 1402 movff C5+1,WREG ; get C5, high byte | |
| 1403 output_hex ; print C5, high byte | |
| 1404 movff C5+0,WREG ; get C5, low byte | |
| 1405 output_hex ; print C5, low byte | |
| 643 | 1406 btfss press_sensor_type ; =1: pressure sensor MS5837, =0: Pressure sensor MS5541 |
| 1407 return ; MS5541, done | |
| 1408 PUTC "*" | |
| 1409 return ; MS5837, done | |
| 1410 | |
| 634 | 1411 |
| 1412 | |
| 1413 ;----------------------------------------------------------------------------- | |
| 1414 ; dynamic Title - show Pressure Sensor Offset Setting | |
| 1415 ; | |
| 1416 dyn_show_sensor_offset: | |
| 1417 STRCAT_TEXT tSensorD ; print label | |
| 1418 movff opt_pressure_adjust,lo ; get pressure sensor offset | |
| 1419 movf lo,F ; excite flags | |
| 1420 bz dyn_show_sensor_offset_zero ; sensor offset = 0 | |
| 1421 bn dyn_show_sensor_offset_neg ; sensor offset < 0 | |
| 1422 ;bnn dyn_show_sensor_offset_pos ; sensor offset > 0 | |
| 1423 dyn_show_sensor_offset_pos: | |
| 1424 PUTC "+" ; print plus sign | |
| 1425 bra dyn_show_sensor_offset_com ; continue with common part | |
| 1426 dyn_show_sensor_offset_zero: | |
| 1427 PUTC " " ; print a space | |
| 1428 bra dyn_show_sensor_offset_com ; continue with common part | |
| 1429 dyn_show_sensor_offset_neg: | |
| 1430 PUTC "-" ; print a minus sign | |
| 1431 negf lo ; negate lo | |
| 1432 ;bra dyn_show_sensor_offset_com ; continue with common part | |
| 1433 dyn_show_sensor_offset_com: | |
| 1434 PUTC " " ; print a space | |
| 1435 bsf leftbind ; print left-aligned | |
| 1436 output_99 ; print value (0-99) | |
| 1437 PUTC " " ; print a space | |
| 1438 STRCAT_TEXT tMBAR ; print unit | |
| 1439 return ; done | |
| 1440 | |
| 1441 | |
| 1442 IFDEF _rx_functions | |
| 1443 | |
| 1444 ;----------------------------------------------------------------------------- | |
| 1445 ; Settings Menu - 2nd Layer - TR Settings | |
| 1446 ; | |
| 1447 do_menu_settings_TR: | |
| 604 | 1448 movff opt_dive_mode,WREG ; get dive mode: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR |
| 1449 incf WREG,W ; add 1 | |
| 1450 dcfsnz WREG,W ; subtract one, became zero? | |
| 634 | 1451 bra do_menu_settings_TR_MaxDelta; YES - OC |
| 1452 dcfsnz WREG,W ; subtract one, became zero? | |
| 1453 bra do_menu_settings_TR_BailPres; YES - CCR | |
| 604 | 1454 dcfsnz WREG,W ; subtract one, became zero? |
| 634 | 1455 bra do_menu_settings_TR_MaxDelta; YES - Gauge |
| 604 | 1456 dcfsnz WREG,W ; subtract one, became zero? |
| 634 | 1457 bra do_menu_settings_TR_abort ; YES - Apnea, abort |
| 604 | 1458 dcfsnz WREG,W ; subtract one, became zero? |
| 634 | 1459 bra do_menu_settings_TR_both ; YES - pSCR |
| 1460 | |
| 1461 do_menu_settings_TR_abort: | |
| 1462 call menu_processor_pop ; drop button press | |
| 1463 bra do_menu_settings ; back to same menu | |
| 604 | 1464 |
| 634 | 1465 |
| 1466 ;----------------------------------------------------------------------------- | |
| 1467 ; Settings Menu - 3rd Layer - TR Settings - Sidemount Mode | |
| 1468 ; | |
| 1469 do_menu_settings_TR_MaxDelta: ; menu with oTrMaxDeltaPres | |
| 604 | 1470 MENU_BEGIN tTrSettings, .5 |
| 634 | 1471 MENU_OPT_INC tTrMode, oTrMode |
| 1472 MENU_OPT_INC tTr1stPres, oTr1stPres | |
| 1473 MENU_OPT_INC tTr2ndPres, oTr2ndPres | |
| 1474 MENU_DYNAMIC dyn_toggle_max_pres_diff, do_toggle_max_pres_diff | |
| 1475 MENU_CALL tBack, do_return_menu_settings | |
| 604 | 1476 MENU_END |
| 1477 | |
| 1478 | |
| 634 | 1479 ;----------------------------------------------------------------------------- |
| 1480 ; Settings Menu - 3rd Layer - TR Settings - CCR Mode | |
| 1481 ; | |
| 1482 do_menu_settings_TR_BailPres: ; menu with oTrBailPres | |
| 1483 MENU_BEGIN tTrSettings, .5 | |
| 1484 MENU_OPT_INC tTrMode, oTrMode | |
| 1485 MENU_OPT_INC tTr1stPres, oTr1stPres | |
| 1486 MENU_OPT_INC tTr2ndPres, oTr2ndPres | |
| 1487 MENU_OPT_INC tTrBailPres, oTrBailPres | |
| 1488 MENU_CALL tBack, do_return_menu_settings | |
| 1489 MENU_END | |
| 1490 | |
| 1491 | |
| 1492 ;----------------------------------------------------------------------------- | |
| 1493 ; Settings Menu - 3rd Layer - TR Settings - pSCR Mode | |
| 1494 ; | |
| 1495 do_menu_settings_TR_both: ; menu with oTrBailPres and oTrMaxDeltaPres | |
| 1496 MENU_BEGIN tTrSettings, .6 | |
| 1497 MENU_OPT_INC tTrMode, oTrMode | |
| 1498 MENU_OPT_INC tTr1stPres, oTr1stPres | |
| 1499 MENU_OPT_INC tTr2ndPres, oTr2ndPres | |
| 1500 MENU_OPT_INC tTrBailPres, oTrBailPres | |
| 1501 MENU_DYNAMIC dyn_toggle_max_pres_diff, do_toggle_max_pres_diff | |
| 1502 MENU_CALL tBack, do_return_menu_settings | |
| 1503 MENU_END | |
| 1504 | |
| 1505 | |
| 1506 ;----------------------------------------------------------------------------- | |
| 1507 ; dynamic Title - max. Delta Pressure for Swap Tanks Advice | |
| 1508 ; | |
| 1509 dyn_toggle_max_pres_diff: | |
| 1510 movff opt_TR_mode,WREG ; get TR mode | |
| 1511 xorlw .2 ; compare with 2 (ind.double) | |
| 1512 tstfsz WREG ; equal? | |
| 1513 FONT_COLOR_DISABLED ; NO - print in disabled color | |
| 1514 STRCAT_TEXT tTrMaxDeltaP ; output label | |
| 1515 movff char_I_max_pres_diff,lo ; get configured deltaP | |
| 1516 output_99 ; print deltaP (0-99) | |
| 1517 STRCAT_TEXT tbar ; append " bar" | |
| 1518 return ; done | |
| 1519 | |
| 1520 | |
| 1521 ;----------------------------------------------------------------------------- | |
| 1522 ; Call Function - adjust max. Delta Pressure for Swap Tanks Advice | |
| 1523 ; | |
| 604 | 1524 do_toggle_max_pres_diff: ; add 5 bar, with hard-coded max. |
| 1525 movff char_I_max_pres_diff,lo ; get current value | |
| 1526 movlw .5 ; load increment | |
| 1527 addwf lo,F ; add increment | |
| 1528 movlw max_pres_diff_max ; load maximum value | |
| 1529 cpfsgt lo ; above maximum value? | |
| 1530 bra do_toggle_max_pres_diff_1 ; NO - store new value | |
| 1531 movlw max_pres_diff_min ; YES - load minimum value | |
| 1532 movwf lo ; - into lo | |
| 1533 do_toggle_max_pres_diff_1: | |
| 1534 movff lo,char_I_max_pres_diff ; write back new value | |
| 1535 return ; done | |
| 623 | 1536 |
| 1537 ENDIF ; _rx_functions | |
| 582 | 1538 |
| 1539 | |
| 634 | 1540 ;----------------------------------------------------------------------------- |
| 1541 ; return to Settings Menu from Sub-Menu | |
| 1542 ; | |
| 1543 do_return_menu_date_time: | |
| 582 | 1544 call menu_processor_double_pop ; drop exit line and back to last line |
| 1545 | |
| 634 | 1546 |
| 1547 ;----------------------------------------------------------------------------- | |
| 1548 ; Settings Menu - 2nd Layer - set Time & Date | |
| 1549 ; | |
| 1550 do_menu_date_time: | |
| 1551 bsf imprint_time_date ; start imprinting current time & date | |
| 1552 bcf block_option_value ; resume displaying of option values | |
| 1553 | |
| 654 | 1554 MENU_BEGIN tSetTimeDate, .5 |
| 634 | 1555 MENU_CALL tSetTime, do_menu_set_time |
| 1556 MENU_CALL tSetDate, do_menu_set_date | |
| 654 | 1557 MENU_OPT_INC tDateFormat, oDateFormat |
| 1558 MENU_OPT_INC tTimeFormat, oTimeFormat | |
| 634 | 1559 MENU_CALL tBack, do_return_menu_settings |
| 1560 MENU_END | |
| 1561 | |
| 1562 | |
| 1563 ;----------------------------------------------------------------------------- | |
| 1564 ; Settings Menu - 3rd Layer - set Time & Date - set Time | |
| 1565 ; | |
| 1566 do_menu_set_time: | |
| 1567 bsf block_option_value ; suspend displaying of option values | |
| 1568 | |
| 1569 MENU_BEGIN tSetTime, .4 | |
| 1570 MENU_OPT_INC tSetHours, oSetHours | |
| 1571 MENU_OPT_INC tSetMinutes, oSetMinutes | |
| 1572 MENU_OPT_INC tSetSeconds, oClearSeconds | |
| 1573 MENU_CALL tBack, do_return_menu_date_time | |
| 1574 MENU_END | |
| 1575 | |
| 623 | 1576 |
| 634 | 1577 ;----------------------------------------------------------------------------- |
| 1578 ; Settings Menu - 3rd Layer - set Time & Date - set Date | |
| 1579 ; | |
| 1580 do_menu_set_date: | |
| 1581 bsf block_option_value ; suspend displaying of option values | |
| 1582 | |
| 1583 MENU_BEGIN tSetDate, .4 | |
| 1584 MENU_OPT_INC tSetDay, oSetDay | |
| 1585 MENU_OPT_INC tSetMonth, oSetMonth | |
| 1586 MENU_OPT_INC tSetYear, oSetYear | |
| 1587 MENU_CALL tBack, do_return_menu_date_time | |
| 1588 MENU_END | |
| 1589 | |
| 1590 | |
| 1591 ;----------------------------------------------------------------------------- | |
| 1592 ; return to Display Settings from Sub-Menu | |
| 1593 ; | |
| 1594 do_return_dispsets_menu: | |
| 1595 bcf imprint_color_schemes ; deactivate color schemes demonstration | |
| 1596 call menu_processor_double_pop ; drop exit line and back to last line | |
| 1597 ;bra do_menu_dispsets ; continue | |
| 1598 | |
| 1599 | |
| 1600 ;----------------------------------------------------------------------------- | |
| 1601 ; Settings Menu - 2nd Layer - Display Settings - Page 1 | |
| 1602 ; | |
| 1603 do_menu_dispsets: | |
| 1604 IF _language_2!=none | |
| 1605 MENU_BEGIN tDispSets, .7 | |
| 645 | 1606 MENU_CALL tBright, do_menu_Brightness |
| 634 | 1607 MENU_OPT_INC tLayout, oLayout |
| 1608 MENU_OPT_INC tUnits, oUnits | |
| 1609 MENU_OPT_INC tLanguage, oLanguage | |
| 1610 MENU_OPT_INC tFlip, oFlipScreen | |
| 1611 MENU_CALL tColorScheme, do_menu_color_scheme | |
| 1612 MENU_CALL tMore, do_menu_dispsets_more | |
| 582 | 1613 MENU_END |
| 623 | 1614 ELSE |
| 634 | 1615 MENU_BEGIN tDispSets, .6 |
| 645 | 1616 MENU_CALL tBright, do_menu_Brightness |
| 634 | 1617 MENU_OPT_INC tLayout, oLayout |
| 1618 MENU_OPT_INC tUnits, oUnits | |
| 1619 MENU_OPT_INC tFlip, oFlipScreen | |
| 1620 MENU_CALL tColorScheme, do_menu_color_scheme | |
| 1621 MENU_CALL tMore, do_menu_dispsets_more | |
| 623 | 1622 MENU_END |
| 634 | 1623 ENDIF |
|
220
effd7259f5a5
make button sensitivity configurable (cR hardware)
heinrichsweikamp
parents:
218
diff
changeset
|
1624 |
| 645 | 1625 ;----------------------------------------------------------------------------- |
| 1626 ; Settings Menu - 3rd Layer - Display Settings - Brightness | |
| 1627 ; | |
| 1628 do_menu_Brightness: | |
| 656 | 1629 btfss ambient_sensor |
| 1630 bra do_menu_Brightness2 | |
| 1631 | |
| 650 | 1632 MENU_BEGIN tBright, .4 |
| 1633 MENU_OPT_INC tBrightDive, oBrightness_dive | |
| 1634 MENU_OPT_INC tBrightSurface, oBrightness_surface | |
| 1635 MENU_OPT_INC tUseAmbientSensor, oUseAmbientSensor | |
| 645 | 1636 MENU_CALL tBack, do_return_dispsets_menu |
| 1637 MENU_END | |
| 582 | 1638 |
| 656 | 1639 do_menu_Brightness2: |
| 1640 MENU_BEGIN tBright, .3 | |
| 1641 MENU_OPT_INC tBrightDive, oBrightness_dive | |
| 1642 MENU_OPT_INC tBrightSurface, oBrightness_surface | |
| 1643 MENU_CALL tBack, do_return_dispsets_menu | |
| 1644 MENU_END | |
| 645 | 1645 |
| 634 | 1646 ;----------------------------------------------------------------------------- |
| 1647 ; Settings Menu - 3rd Layer - Display Settings - Color Schemes | |
| 1648 ; | |
| 1649 do_menu_color_scheme: | |
| 1650 bsf imprint_color_schemes ; activate color schemes demonstration | |
| 1651 | |
| 1652 ; menu with 4 leading empty menu lines to give space for the color scheme imprinting | |
| 1653 MENU_BEGIN_OFFSET tColorScheme, .2, .4 | |
| 1654 MENU_OPT_INC tColorSetDive, oColorSetDive | |
| 1655 MENU_CALL tBack, do_return_dispsets_menu | |
| 1656 MENU_END | |
| 1657 | |
| 524 | 1658 |
| 634 | 1659 ;----------------------------------------------------------------------------- |
| 1660 ; Settings Menu - 2nd Layer - Display Settings - Page 2 | |
| 1661 ; | |
| 1662 do_menu_dispsets_more: | |
| 1663 IFDEF _helium | |
| 1664 MENU_BEGIN tDispSets, .7 | |
| 1665 MENU_OPT_INC tVSIgraph, oVSIgraph | |
| 1666 MENU_OPT_INC tVSItext2, oVSItext | |
| 1667 MENU_OPT_INC tShowppO2, oShowppO2 | |
| 1668 MENU_OPT_INC tDepthWarning, oDepthWarn | |
| 1669 MENU_OPT_INC t2ndDepth, o2ndDepthDisp | |
| 1670 MENU_OPT_INC tTissueGraphics, oTissueGraphics | |
| 1671 MENU_CALL tBack, do_return_menu_settings_deeper | |
| 582 | 1672 MENU_END |
| 623 | 1673 ELSE |
| 656 | 1674 btfsc dn_flag ; force menu all caps in dn hardware |
| 1675 bsf force_all_caps | |
| 634 | 1676 MENU_BEGIN tDispSets, .6 |
| 1677 MENU_OPT_INC tVSIgraph, oVSIgraph | |
| 1678 MENU_OPT_INC tVSItext2, oVSItext | |
| 1679 MENU_OPT_INC tShowppO2, oShowppO2 | |
| 1680 MENU_OPT_INC tDepthWarning, oDepthWarn | |
| 1681 MENU_OPT_INC t2ndDepth, o2ndDepthDisp | |
| 1682 MENU_CALL tBack, do_return_menu_settings_deeper | |
| 582 | 1683 MENU_END |
| 623 | 1684 ENDIF |
| 582 | 1685 |
| 243 | 1686 |
| 634 | 1687 ;----------------------------------------------------------------------------- |
| 1688 ; return to System Settings Menu from Sub-Sub-Menu | |
| 1689 ; | |
| 1690 do_return_menu_syssets_more_more: ; entry point for returns from reset sub-menu | |
| 1691 call menu_processor_pop ; drop one more stack entry | |
| 1692 ;bra do_return_menu_syssets_more ; continue | |
| 1693 | |
| 1694 | |
| 1695 ;----------------------------------------------------------------------------- | |
| 1696 ; return to System Settings Menu from Sub-Menu | |
| 1697 ; | |
| 1698 do_return_menu_syssets_more: | |
| 1699 call menu_processor_double_pop ; drop exit line and back to last line | |
| 1700 bra do_menu_syssets ; continue | |
| 1701 | |
| 1702 | |
| 1703 ;----------------------------------------------------------------------------- | |
| 1704 ; return to System Settings Menu from Piezo-Sub-Menu | |
| 1705 ; | |
| 1706 do_return_menu_syssets_piezo: | |
| 1707 call menu_processor_double_pop ; drop exit line and back to last line | |
| 1708 call TFT_ClearScreen ; clear the screen | |
| 1709 call piezo_config ; configure buttons | |
| 1710 ;bra do_menu_syssets ; continue | |
| 1711 | |
| 1712 | |
| 1713 ;----------------------------------------------------------------------------- | |
| 1714 ; Settings Menu - 2nd Layer - System Settings | |
| 1715 ; | |
| 1716 do_menu_syssets: | |
| 656 | 1717 btfsc dn_flag ; dn hardware? |
| 1718 bra do_menu_syssets_dn ; YES | |
| 1719 btfsc dual_comm ; Dual comm hardware? | |
| 1720 bra do_menu_syssets_dual_comm ; YES | |
| 634 | 1721 btfsc battery_gauge_available ; piezo buttons available? |
| 656 | 1722 bra do_menu_syssets_piezo ; YES |
| 634 | 1723 |
| 656 | 1724 do_menu_syssets_dual_comm: |
| 1725 do_menu_syssets_mechanical: | |
| 634 | 1726 IFDEF _compass |
| 1727 MENU_BEGIN tSystSets, .4 ; All MENU_CALLs in this menu | |
| 1728 MENU_CALL tCompassMenu, do_menu_compass ; need to stay together on this | |
| 1729 MENU_CALL tLogOffset, do_menu_log_offset ; menu level in order to not | |
| 1730 MENU_CALL tResetMenu, do_menu_reset ; mess up the menu stack on doing | |
| 1731 MENU_CALL tBack, do_return_menu_settings ; the do_return_menu_settings ! | |
| 582 | 1732 MENU_END |
| 634 | 1733 ELSE |
| 1734 MENU_BEGIN tSystSets, .3 ; see above | |
| 1735 MENU_CALL tLogOffset, do_menu_log_offset ; | |
| 1736 MENU_CALL tResetMenu, do_menu_reset ; | |
| 1737 MENU_CALL tBack, do_return_menu_settings ; | |
| 1738 MENU_END | |
| 1739 ENDIF ; _compass | |
| 1740 | |
| 656 | 1741 |
| 1742 do_menu_syssets_dn: | |
| 1743 IFDEF _compass | |
| 1744 MENU_BEGIN tSystSets, .5 ; All MENU_CALLs in this menu | |
| 1745 MENU_CALL tCompassMenu, do_menu_compass ; need to stay together on this | |
| 1746 MENU_CALL tLogOffset, do_menu_log_offset ; menu level in order to not | |
| 1747 MENU_CALL tResetMenu, do_menu_reset ; mess up the menu stack on doing | |
| 1748 MENU_OPT_INC tBLE_Compatibility, oBLE_Compatibility ; BLE Compatibility mode | |
| 1749 MENU_CALL tBack, do_return_menu_settings ; the do_return_menu_settings ! | |
| 1750 MENU_END | |
| 1751 ELSE | |
| 1752 MENU_BEGIN tSystSets, .4 ; see above | |
| 1753 MENU_CALL tLogOffset, do_menu_log_offset ; | |
| 1754 MENU_CALL tResetMenu, do_menu_reset ; | |
| 1755 MENU_OPT_INC tBLE_Compatibility, oBLE_Compatibility ; BLE Compatibility mode | |
| 1756 MENU_CALL tBack, do_return_menu_settings ; | |
| 1757 MENU_END | |
| 1758 ENDIF ; _compass | |
| 1759 | |
| 1760 | |
| 634 | 1761 do_menu_syssets_piezo: |
| 1762 IFDEF _compass | |
| 1763 MENU_BEGIN tSystSets, .5 | |
| 1764 MENU_CALL tCompassMenu, do_menu_compass ; see above | |
| 1765 MENU_CALL tLogOffset, do_menu_log_offset ; | |
| 1766 MENU_CALL tResetMenu, do_menu_reset ; | |
| 1767 MENU_CALL tPiezo, do_menu_piezo ; | |
| 1768 MENU_CALL tBack, do_return_menu_settings ; | |
| 1769 MENU_END | |
| 1770 ELSE | |
| 1771 MENU_BEGIN tSystSets, .4 | |
| 1772 MENU_CALL tLogOffset, do_menu_log_offset ; see above | |
| 1773 MENU_CALL tResetMenu, do_menu_reset ; | |
| 1774 MENU_CALL tPiezo, do_menu_piezo ; | |
| 1775 MENU_CALL tBack, do_return_menu_settings ; | |
| 1776 MENU_END | |
| 1777 ENDIF | |
|
220
effd7259f5a5
make button sensitivity configurable (cR hardware)
heinrichsweikamp
parents:
218
diff
changeset
|
1778 |
|
effd7259f5a5
make button sensitivity configurable (cR hardware)
heinrichsweikamp
parents:
218
diff
changeset
|
1779 |
| 623 | 1780 IFDEF _compass |
| 1781 | |
| 634 | 1782 ;----------------------------------------------------------------------------- |
| 1783 ; Settings Menu - 3rd Layer - System Settings - Compass | |
| 1784 ; | |
| 1785 do_menu_compass: | |
| 631 | 1786 MENU_BEGIN tCompassMenu, .5 |
| 634 | 1787 MENU_CALL tCompassCalibration, do_compass_calibration |
| 1788 ; MENU_OPT_INC tCompassGain, oCompassGain | |
| 1789 MENU_DYNAMIC dyn_compass_cal_x, 0 | |
| 1790 MENU_DYNAMIC dyn_compass_cal_y, 0 | |
| 1791 MENU_DYNAMIC dyn_compass_cal_z, 0 | |
| 1792 MENU_CALL tBack, do_return_menu_syssets_more | |
| 582 | 1793 MENU_END |
| 1794 | |
| 634 | 1795 |
| 1796 ;----------------------------------------------------------------------------- | |
| 1797 ; Call Function - start Compass Calibration | |
| 1798 ; | |
| 1799 do_compass_calibration: | |
| 1800 goto compass_calibration ; code hosted in compass_ops.asm | |
| 1801 | |
| 1802 | |
| 1803 ;----------------------------------------------------------------------------- | |
| 1804 ; dynamic Title - Calibration Value X | |
| 1805 ; | |
| 1806 dyn_compass_cal_x: | |
| 1807 STRCAT_TEXT tCalX ; print label | |
| 1808 lfsr FSR0,compass_CX_f ; address calibration value X | |
| 1809 bra dyn_compass_cal_common ; continue with common part | |
| 1810 | |
| 1811 | |
| 1812 ;----------------------------------------------------------------------------- | |
| 1813 ; dynamic Title - Calibration Value Y | |
| 1814 ; | |
| 1815 dyn_compass_cal_y: | |
| 1816 STRCAT_TEXT tCalY ; print label | |
| 1817 lfsr FSR0,compass_CY_f ; address calibration value Y | |
| 1818 bra dyn_compass_cal_common ; continue with common part | |
| 1819 | |
| 1820 | |
| 1821 ;----------------------------------------------------------------------------- | |
| 1822 ; dynamic Title - Calibration Value Z | |
| 1823 ; | |
| 1824 dyn_compass_cal_z: | |
| 1825 STRCAT_TEXT tCalZ ; print label | |
| 1826 lfsr FSR0,compass_CZ_f ; address calibration value Z | |
| 1827 ;bra dyn_compass_cal_common ; continue with common part | |
| 1828 | |
| 1829 | |
| 1830 ;----------------------------------------------------------------------------- | |
| 1831 ; Helper Function to dynamic Titles - Calibration Value | |
| 1832 ; | |
| 1833 dyn_compass_cal_common: | |
| 1834 movff POSTINC0,lo ; read calibration value, low byte | |
| 1835 movff POSTINC0,hi ; read calibration value, high byte | |
| 1836 PUTC ':' ; print ":" | |
| 1837 PUTC ' ' ; print a space | |
| 1838 call convert_signed_16bit ; convert lo:hi into signed-short and adds '-' to POSTINC2 if required | |
| 1839 btfsc neg_flag ; value negative? | |
| 1840 bra dyn_compass_cal_common_1 ; YES - print value | |
| 1841 PUTC '+' ; NO - add a plus sign | |
| 1842 dyn_compass_cal_common_1: | |
| 1843 output_65535 ; print value | |
| 1844 return ; done | |
| 1845 | |
| 623 | 1846 ENDIF ; _compass |
| 1847 | |
|
18
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
1848 |
| 634 | 1849 ;----------------------------------------------------------------------------- |
| 1850 ; Settings Menu - 3rd Layer - System Settings - Logbook Offset | |
| 1851 ; | |
| 1852 do_menu_log_offset: | |
| 63 | 1853 |
| 634 | 1854 clrf WREG ; select an initial step size of 1 |
| 1855 movff WREG,opt_logoffset_step ; bank-safe write to option variable (volatile option) | |
| 0 | 1856 |
| 634 | 1857 MENU_BEGIN tLogOffset, .5 |
| 1858 MENU_DYNAMIC dyn_logoffset_show_value, 0 | |
| 1859 MENU_OPT_INC tLogOffStepSize, oLogOffsetStep | |
| 1860 MENU_CALL tLogOffsetplus, do_log_offset_plus | |
| 1861 MENU_CALL tLogOffsetminus, do_log_offset_minus | |
| 1862 MENU_CALL tBack, do_return_menu_syssets_more | |
| 582 | 1863 MENU_END |
| 1864 | |
| 0 | 1865 |
| 634 | 1866 ;----------------------------------------------------------------------------- |
| 1867 ; dynamic Title - show Logbook Offset | |
| 1868 ; | |
| 1869 dyn_logoffset_show_value: | |
| 1870 STRCPY_TEXT tLogOffsetValue ; print "Offset" in selected language | |
| 1871 call eeprom_log_offset_read ; read offset into lo:hi | |
| 1872 output_9999 ; print offset (0-9999) | |
| 1873 return ; no "_PRINT" here... | |
| 0 | 1874 |
| 1875 | |
| 634 | 1876 ;----------------------------------------------------------------------------- |
| 1877 ; Call Function - increment Logbook Offset | |
| 1878 ; | |
| 1879 do_log_offset_plus: | |
| 1880 rcall do_logoffset_common ; load current offset and step size | |
| 1881 ; add step size to current offset | |
| 1882 movf mpr+2,W ; get step size, low byte | |
| 1883 addwf mpr+0,F ; add to offset, low byte | |
| 1884 movf mpr+3,W ; get step size, high byte | |
| 1885 addwfc mpr+1,F ; add to offset, high byte, considering carry flag | |
| 1886 ; check if new offset is within limit | |
| 1887 MOVLI .9999,sub_a ; load max limit into sub_a | |
| 1888 MOVII mpr, sub_b ; copy new offset into sub_b | |
| 1889 call cmpU16 ; compute sub_a - sub_b, setting neg_flag if result becomes negative | |
| 1890 btfss neg_flag ; neg_flag set, i.e. new offset > 9999 ? | |
| 1891 bra do_logoffset_exit ; NO - store offset and return | |
| 1892 MOVLI .9999,mpr ; YES - limit offset to 9999 | |
| 1893 bra do_logoffset_exit ; - store offset and return | |
| 582 | 1894 |
| 0 | 1895 |
| 634 | 1896 ;----------------------------------------------------------------------------- |
| 1897 ; Call Function - decrement Logbook Offset | |
| 1898 ; | |
| 1899 do_log_offset_minus: | |
| 1900 rcall do_logoffset_common ; load current offset and step size | |
| 1901 ; subtract step size from current offset | |
| 1902 movf mpr+2,W ; get step size, low byte | |
| 1903 subwf mpr+0,F ; subtract from offset, low byte | |
| 1904 movf mpr+3,W ; get step size, high byte | |
| 1905 subwfb mpr+1,F ; subtract from offset, high byte, considering borrow flag | |
| 1906 ; check if new offset is within limit | |
| 1907 btfsc STATUS,C ; borrow to propagate (B == /CARRY) ? | |
| 1908 bra do_logoffset_exit ; NO - result >= 0, store and return | |
| 1909 ;bra do_logoffset_reset ; YES - revert offset to 0 | |
| 0 | 1910 |
| 1911 | |
| 634 | 1912 ;----------------------------------------------------------------------------- |
| 1913 ; Helper Functions - Logbook Offset Reset & Write-Back | |
| 1914 ; | |
| 1915 do_logoffset_reset: | |
| 1916 CLRI mpr ; set offset to 0 | |
| 1917 do_logoffset_exit: | |
| 1918 goto eeprom_log_offset_write ; store offset and return | |
| 1919 | |
| 1920 | |
| 1921 ;----------------------------------------------------------------------------- | |
| 1922 ; Helper Function - compute Step Size | |
| 1923 ; | |
| 623 | 1924 do_logoffset_common: |
| 631 | 1925 call eeprom_log_offset_read ; read current offset into mpr+1:mpr+0 |
| 623 | 1926 movff opt_logoffset_step,ul ; get step size: 0=1, 1=10, 2=100, 3=1000 |
| 1927 incf ul,F ; 0...3 -> 1...4 | |
| 1928 clrf mpr+3 ; clear step size, high byte | |
| 1929 movlw .1 ; set a step size of 1 | |
| 1930 movwf mpr+2 ; copy to step size, low byte | |
| 1931 dcfsnz ul,F ; ul--, did ul became 0, i.e. step size = 1 ? | |
| 1932 return ; YES - done | |
| 1933 movlw .10 ; NO - set a step size of 10 | |
| 1934 movwf mpr+2 ; - copy to step size, low byte | |
| 1935 dcfsnz ul,F ; ul--, did ul became 0, i.e. step size = 10 ? | |
| 1936 return ; YES - done | |
| 1937 movlw .100 ; NO - set a step size of 100 | |
| 1938 movwf mpr+2 ; - copy to step size, low byte | |
| 1939 dcfsnz ul,F ; ul--, did ul became 0, i.e. step size = 100 ? | |
| 1940 return ; YES - done | |
| 634 | 1941 movlw LOW .1000 ; NO - set a step size of 1000, low byte |
| 1942 movwf mpr+2 ; - copy to step size, low byte | |
| 623 | 1943 movlw HIGH .1000 ; - set a step size of 1000, high byte |
| 1944 movwf mpr+3 ; - copy to step size, high byte | |
| 1945 return ; - done | |
| 0 | 1946 |
| 1947 | |
| 634 | 1948 ;----------------------------------------------------------------------------- |
| 1949 ; Settings Menu - 3rd Layer - System Settings - adjust Piezo Buttons | |
| 1950 ; | |
| 1951 do_menu_piezo: | |
| 640 | 1952 MENU_BEGIN tPiezo, .5 |
| 1953 MENU_CALL tButtonExplain1, 0 | |
| 1954 MENU_CALL tButtonExplain2, 0 | |
| 634 | 1955 MENU_OPT_INC tButtonleft, ocR_button_left ; left button sensitivity |
| 1956 MENU_OPT_INC tButtonright, ocR_button_right ; right button sensitivity | |
| 1957 MENU_CALL tBack, do_return_menu_syssets_piezo | |
| 1958 MENU_END | |
| 623 | 1959 |
| 0 | 1960 |
| 634 | 1961 ;----------------------------------------------------------------------------- |
| 1962 ; Settings Menu - 3rd Layer - System Settings - Reset Menus | |
| 1963 ; | |
| 1964 do_menu_reset: | |
| 656 | 1965 btfsc dn_flag |
| 1966 bra do_menu_reset_dn | |
| 648 | 1967 MENU_BEGIN tResetMenu, .7 |
| 634 | 1968 MENU_CALL tBack, do_return_menu_syssets_more |
| 1969 MENU_CALL tReboot, do_menu_reset_reboot ; confirm | |
| 1970 MENU_CALL tResetDeco, do_menu_reset_deco ; confirm | |
| 1971 MENU_CALL tResetSettings, do_menu_reset_settings ; confirm | |
| 1972 MENU_CALL tResetLogbook, do_menu_reset_logbook ; confirm | |
| 1973 MENU_CALL tResetBattery, do_menu_reset_battery ; confirm | |
| 656 | 1974 MENU_CALL tResetBLE2, do_menu_reset_ble2 ; (Re-) Configure the new BLE module |
| 1975 MENU_END | |
| 1976 | |
| 1977 do_menu_reset_dn: ; no reset battery for dn | |
| 1978 MENU_BEGIN tResetMenu, .6 | |
| 1979 MENU_CALL tBack, do_return_menu_syssets_more | |
| 1980 MENU_CALL tReboot, do_menu_reset_reboot ; confirm | |
| 1981 MENU_CALL tResetDeco, do_menu_reset_deco ; confirm | |
| 1982 MENU_CALL tResetSettings, do_menu_reset_settings ; confirm | |
| 1983 MENU_CALL tResetLogbook, do_menu_reset_logbook ; confirm | |
| 1984 MENU_CALL tResetBLE2, do_menu_reset_ble2 ; (Re-) Configure the new BLE module | |
| 634 | 1985 MENU_END |
| 0 | 1986 |
| 634 | 1987 |
| 1988 ;----------------------------------------------------------------------------- | |
| 1989 ; Settings Menu - 4th Layer - System Settings - Reset - Reboot / FW Recovery | |
| 1990 ; | |
| 1991 do_menu_reset_reboot: | |
| 1992 IFDEF _firmware_recovery | |
| 1993 MENU_BEGIN tResetMenu2, .4 | |
| 1994 MENU_CALL tAbort, do_return_menu_syssets_more_more | |
| 1995 MENU_CALL tRebootCurFirmware, do_reboot ; reboot current firmware | |
| 1996 MENU_DYNAMIC dyn_menu_fw_backup, do_firmware_backup ; backup current firmware | |
| 1997 MENU_DYNAMIC dyn_menu_fw_restore, do_firmware_restore ; restore backup firmware | |
| 582 | 1998 MENU_END |
| 604 | 1999 ELSE |
| 634 | 2000 MENU_BEGIN tResetMenu2, .2 |
| 2001 MENU_CALL tAbort, do_return_menu_syssets_more_more | |
| 2002 MENU_CALL tReboot, do_reboot ; reboot (cold start) | |
| 604 | 2003 MENU_END |
| 2004 ENDIF | |
| 582 | 2005 |
|
335
3d43da7acfe1
Always show ppO2 (warning position, standard color) option
janos_kovacs <kovjanos@gmail.com>
parents:
333
diff
changeset
|
2006 |
| 634 | 2007 ;----------------------------------------------------------------------------- |
| 2008 ; Call Function - Reboot | |
| 2009 ; | |
| 2010 do_reboot: | |
| 2011 call ext_flash_enable_protection ; set write protection on external flash | |
| 2012 call eeprom_deco_data_write ; update deco data in EEPROM | |
| 2013 call eeprom_battery_gauge_write ; update battery gauge in EEPROM | |
| 2014 btfsc option_changed ; do the options need to be stored to EEPROM ? | |
| 2015 call option_check_and_store_all ; YES - check and store all option values in EEPROM | |
| 2016 reset ; cold-start the processor | |
| 2017 | |
| 2018 | |
| 2019 IFDEF _firmware_recovery | |
| 2020 | |
| 2021 ;----------------------------------------------------------------------------- | |
| 2022 ; dynamic Title - Firmware Backup Option | |
| 2023 ; | |
| 2024 dyn_menu_fw_backup: | |
| 2025 EEPROM_CC_READ eeprom_fw_chksum_current+.5,WREG ; read stored FW ID | |
| 2026 xorlw FW_ID ; XOR with current FW ID, equal? | |
| 2027 bnz dyn_menu_fw_backup_unable ; NO - unable to make a backup | |
| 2028 STRCPY_TEXT tBackupFirmware ; YES - print "Backup current Firmware" | |
| 2029 return ; - done | |
| 2030 dyn_menu_fw_backup_unable: | |
| 2031 STRCPY "-------" ; print dashes | |
| 2032 return ; done | |
| 2033 | |
| 2034 | |
| 2035 ;----------------------------------------------------------------------------- | |
| 2036 ; dynamic Title - Firmware Restore Option | |
| 2037 ; | |
| 2038 dyn_menu_fw_restore: | |
| 2039 STRCPY_TEXT tRecoverFirmware ; print "Recover" | |
| 2040 PUTC " " ; add a space | |
| 2041 PUTC "V" ; add a V for Version | |
| 2042 movlw 0x3C ; address firmware version in backup storage at 0x3C000A | |
| 2043 movwf ext_flash_address+2 ; ... | |
| 2044 clrf ext_flash_address+1 ; ... | |
| 2045 movlw 0x0A ; ... | |
| 2046 movwf ext_flash_address+0 ; ... | |
| 2047 FLASH_RR_READ mpr,.3 ; read backup firmware version (lo: major, hi: minor, up: beta) | |
| 2048 infsnz lo,W ; major = 0xFF ? | |
| 2049 bra dyn_menu_fw_restore_inop ; YES - no version to show | |
| 2050 bsf leftbind ; NO - print left-aligned | |
| 2051 output_99 ; - print major (0-99) | |
| 2052 PUTC '.' ; - add a dot | |
| 2053 movff hi,lo ; - get minor | |
| 2054 output_99x ; - print minor (00-99) | |
| 2055 PUTC ' ' ; - add a space | |
| 2056 movff up,lo ; - get beta/release | |
| 2057 tstfsz lo ; - release version? | |
| 2058 bra dyn_menu_fw_restore_beta ; - NO - beta | |
| 2059 STRCAT "Rel." ; - YES - append "Rel(ease)" | |
| 2060 return ; - done | |
| 2061 dyn_menu_fw_restore_beta: | |
| 2062 PUTC 'B' ; append "B(eta)" | |
| 2063 bsf leftbind ; print left-aligned | |
| 2064 output_256 ; print beta version (0-255) | |
| 2065 return ; done | |
| 2066 dyn_menu_fw_restore_inop: | |
| 2067 STRCAT "--.--" ; no recovery firmware available | |
| 2068 return ; done | |
| 2069 | |
| 2070 | |
| 2071 ;----------------------------------------------------------------------------- | |
| 2072 ; Call Function - backup Firmware | |
| 2073 ; | |
| 2074 do_firmware_backup: | |
| 2075 EEPROM_CC_READ eeprom_fw_chksum_current+.5,WREG ; read stored FW ID | |
| 2076 xorlw FW_ID ; XOR with current FW ID, equal? | |
| 2077 bnz do_firmware_abort ; NO - abort | |
| 2078 call TFT_ClearScreen ; YES - clear the screen | |
| 2079 WIN_SMALL .0, .100 ; - set position | |
| 2080 STRCPY_TEXT_PRINT tBackingUp ; - print "backing up..." | |
| 2081 call copy_fw_active_to_backup ; - copy 0x3Exxxx -> 0x3Cxxxx | |
| 2082 EEPROM_RR_READ eeprom_fw_chksum_current,buffer,.6 ; - retrieve checksum of current firmware | |
| 2083 EEPROM_RR_WRITE buffer,eeprom_fw_chksum_recovry,.6 ; - store as checksum of recovery firmware | |
| 2084 bra do_return_menu_syssets_more_more ; - done | |
| 2085 | |
| 2086 | |
| 2087 ;----------------------------------------------------------------------------- | |
| 2088 ; Call Function - restore Firmware | |
| 2089 ; | |
| 2090 do_firmware_restore: | |
| 2091 EXT_FLASH_ADDR 0x3C000A ; address firmware version in backup storage at 0x3C000A | |
| 2092 FLASH_CW_READ_0x40 ; read backup firmware major version into WREG | |
| 2093 infsnz WREG ; major = 0xFF ? | |
| 2094 bra do_firmware_abort ; YES - abort, no firmware available for restoration | |
| 2095 call TFT_ClearScreen ; NO - clear the screen | |
| 2096 WIN_SMALL .0, .100 ; - set position | |
| 2097 STRCPY_TEXT_PRINT tRestoring ; - print "restoring..." | |
| 2098 call copy_fw_backup_to_active ; - copy 0x3Cxxxx -> 0x3Exxxx | |
| 2099 EEPROM_RR_READ eeprom_fw_chksum_recovry,buffer,.6 ; - retrieve checksum of recovery firmware | |
| 2100 EEPROM_RR_WRITE buffer,eeprom_fw_chksum_current,.6 ; - store as checksum of current firmware (to be) | |
| 2101 goto comm_firmware_update_exec ; - initiate firmware update | |
| 2102 | |
| 2103 | |
| 2104 ;----------------------------------------------------------------------------- | |
| 2105 ; Helper Function - back to same menu | |
| 2106 ; | |
| 2107 do_firmware_abort: | |
| 2108 call menu_processor_pop ; back to last line | |
| 2109 bra do_menu_reset_reboot ; back to same menu | |
| 2110 | |
| 623 | 2111 ENDIF |
| 0 | 2112 |
| 582 | 2113 |
| 634 | 2114 ;----------------------------------------------------------------------------- |
| 2115 ; Settings Menu - 4th Layer - System Settings - Reset - Reset Deco | |
| 2116 ; | |
| 2117 do_menu_reset_deco: | |
| 2118 MENU_BEGIN tResetMenu2, .2 | |
| 2119 MENU_CALL tAbort, do_return_menu_syssets_more_more | |
| 2120 MENU_CALL tResetDeco, do_reset_deco ; reset deco and return to main reset menu | |
| 2121 MENU_END | |
| 2122 | |
| 582 | 2123 |
| 634 | 2124 ;----------------------------------------------------------------------------- |
| 2125 ; Call Function - Reset Deco | |
| 2126 ; | |
| 2127 do_reset_deco: | |
| 2128 call deco_clear_tissue ; set all tissues to absolute pressure * N2_ratio (C-code) | |
| 2129 call deco_calc_dive_interval_1min; update tissues by 1 minute to calculate current GF factor (C-code) | |
| 2130 call deco_calc_desaturation_time ; calculate desaturation and no-fly/no-altitude time (C-code) | |
| 2131 banksel common | |
| 2132 call eeprom_deco_data_write ; store updated deco data into EEPROM | |
| 2133 bra do_return_menu_syssets_more_more | |
| 2134 | |
| 2135 | |
| 2136 ;----------------------------------------------------------------------------- | |
| 2137 ; Settings Menu - 4th Layer - System Settings - Reset - Reset Settings | |
| 2138 ; | |
| 2139 do_menu_reset_settings: | |
| 2140 MENU_BEGIN tResetMenu2, .2 | |
| 2141 MENU_CALL tAbort, do_return_menu_syssets_more_more | |
| 2142 MENU_CALL tResetSettings, do_reset_settings ; reset all settings and go to surface mode | |
| 582 | 2143 MENU_END |
| 50 | 2144 |
| 2145 | |
| 634 | 2146 ;----------------------------------------------------------------------------- |
| 2147 ; Call Function - Reset Settings | |
| 2148 ; | |
| 2149 do_reset_settings: | |
| 2150 call TFT_ClearScreen ; clear screen to show start of activity | |
| 2151 call option_reset_all ; reset all options to factory default | |
| 2152 call do_logoffset_reset ; reset log offset | |
| 2153 goto restart ; restart into surface mode | |
| 0 | 2154 |
| 634 | 2155 |
| 2156 ;----------------------------------------------------------------------------- | |
| 2157 ; Settings Menu - 4th Layer - System Settings - Reset - Reset Logbook | |
| 2158 ; | |
| 2159 do_menu_reset_logbook: | |
| 2160 MENU_BEGIN tResetMenu2, .2 | |
| 2161 MENU_CALL tAbort, do_return_menu_syssets_more_more | |
| 2162 MENU_CALL tResetLogbook, do_reset_logbook ; reset logbook and return to main reset menu | |
| 582 | 2163 MENU_END |
| 2164 | |
| 623 | 2165 |
| 634 | 2166 ;----------------------------------------------------------------------------- |
| 2167 ; Call Function - Reset Logbook | |
| 2168 ; | |
| 2169 do_reset_logbook: | |
| 2170 call erase_complete_logbook ; erase complete logbook | |
| 2171 bra do_return_menu_syssets_more_more | |
| 2172 | |
| 2173 | |
| 2174 ;----------------------------------------------------------------------------- | |
| 2175 ; Settings Menu - 4th Layer - System Settings - Reset - Reset Battery | |
| 2176 ; | |
| 2177 do_menu_reset_battery: | |
| 2178 MENU_BEGIN tNewBattTitle, .2 | |
| 2179 MENU_CALL tAbort, do_return_menu_syssets_more_more | |
| 2180 MENU_CALL tYes, do_new_battery_select | |
| 2181 MENU_END | |
| 648 | 2182 |
| 2183 ;----------------------------------------------------------------------------- | |
| 2184 ; Settings Menu - 4th Layer - System Settings - Reset - Reset BLE2 | |
| 2185 ; | |
| 2186 do_menu_reset_ble2: | |
| 2187 call TFT_ClearScreen ; clear screen to show start of activity | |
| 2188 call ble2_configure | |
| 2189 goto surfloop ; restart into surface mode | |
| 634 | 2190 |
| 2191 | |
| 2192 ;----------------------------------------------------------------------------- | |
| 2193 ; Entry Point for Battery Selection after Power-Outage | |
| 2194 ; | |
| 2195 global new_battery_select | |
| 2196 new_battery_select: | |
| 623 | 2197 call TFT_boot ; initialize TFT (includes clear screen) |
| 640 | 2198 call TFT_load_std_color_pallet ; load standard color pallet |
| 623 | 2199 call TFT_Display_FadeIn ; dim up the display |
| 2200 call menu_processor_reset ; reset menu stack | |
| 634 | 2201 ;bra do_new_battery_select ; enter menu system |
| 623 | 2202 |
| 2203 | |
| 634 | 2204 ;----------------------------------------------------------------------------- |
| 2205 ; Settings Menu - 5th Layer - System Settings - Reset - Reset - Battery Selection | |
| 2206 ; | |
| 2207 do_new_battery_select: | |
| 2208 movlw .100 ; set battery level to full | |
| 2209 movwf batt_percent ; ... | |
| 2210 ; default (in cases of timeout or USB) to use old battery: | |
| 631 | 2211 call eeprom_battery_gauge_read ; retrieve stored battery gauge value from EEPROM |
| 604 | 2212 |
| 2213 IFDEF _screendump | |
| 623 | 2214 bsf screen_dump_avail ; enable screen dump function to prevent exiting into COMM mode immediately |
| 604 | 2215 ELSE |
| 623 | 2216 bsf comm_mode_disabled ; disable COMM mode to prevent exiting into COMM mode immediately |
| 604 | 2217 ENDIF |
| 2218 | |
| 623 | 2219 ; hardware descriptor: user changeable battery charger supported battery types |
| 614 | 2220 ; ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 623 | 2221 ; 0x11: BLE and battery gauge ---> OSTC 2 (old model) NO YES internal 18650 |
| 2222 ; 0x05: analog input and battery gauge ---> OSTC 2 cR NO YES internal 18650 | |
| 640 | 2223 ; 0x15: BLE and analog input and battery gauge ---> OSTC 2 cR (2020 model) NO YES internal 18650 |
| 623 | 2224 ; 0x33: BLE and RX module and ambient sensor and battery gauge ---> OSTC 2 TR NO YES internal 16650 |
| 2225 ; 0x13: BLE and ambient sensor and battery gauge -+-> OSTC 2 (new model) NO YES internal 16650 | |
| 2226 ; +-> OSTC Plus YES YES 1.5V ----- NO! ----- 3.6V rechargeable | |
| 2227 ; 0x0A: optical input and ambient sensor ---> OSTC 3 (USB model) YES NO 1.5V 3.6V disposable 3.6V rechargeable | |
| 2228 ; 0x1A: BLE and optical input and ambient sensor ---> OSTC 3 (BLE model) YES NO 1.5V 3.6V disposable 3.6V rechargeable | |
| 2229 ; 0x02: ambient sensor ---> OSTC Sport (USB model) YES NO 1.5V 3.6V disposable 3.6V rechargeable | |
| 2230 ; 0x52: BLE and ambient sensor and low volt core ---> OSTC Sport (BLE model) YES NO 1.5V 3.6V disposable 3.6V rechargeable | |
| 614 | 2231 |
| 654 | 2232 btfsc dn_flag |
| 2233 bra use_404050_battery | |
| 2234 | |
| 656 | 2235 btfsc dual_comm |
| 2236 bra use_404050_battery | |
| 2237 | |
|
635
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2238 movlw 0x11 ; OSTC 2 (2015 model) |
|
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2239 cpfseq HW_descriptor |
|
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2240 bra $+4 |
|
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2241 bra use_18650_battery |
|
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2242 |
|
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2243 movlw 0x91 ; OSTC 2 (2015 model) with block write |
| 623 | 2244 cpfseq HW_descriptor |
| 614 | 2245 bra $+4 |
| 623 | 2246 bra use_18650_battery |
| 614 | 2247 |
| 623 | 2248 movlw 0x05 ; OSTC 2 cR |
| 2249 cpfseq HW_descriptor | |
| 614 | 2250 bra $+4 |
| 623 | 2251 bra use_18650_battery |
| 76 | 2252 |
| 640 | 2253 movlw 0x15 ; OSTC 2 cR (2020 model) |
| 2254 cpfseq HW_descriptor | |
| 2255 bra $+4 | |
| 2256 bra use_18650_battery | |
| 2257 | |
| 2258 | |
|
635
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2259 movlw 0x85 ; OSTC 2 cR with block write |
|
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2260 cpfseq HW_descriptor |
|
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2261 bra $+4 |
|
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2262 bra use_18650_battery |
|
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2263 |
|
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2264 movlw 0xB3 ; OSTC 2 TR |
| 623 | 2265 cpfseq HW_descriptor |
| 614 | 2266 bra $+4 |
| 634 | 2267 bra do_use_16650_battery |
| 614 | 2268 |
| 637 | 2269 movlw 0x93 ; OSTC Plus and OSTC 2 (2017 model) |
| 623 | 2270 cpfseq HW_descriptor |
| 614 | 2271 bra $+4 |
| 634 | 2272 bra do_menu_new_battery_AA_charger |
| 614 | 2273 |
| 640 | 2274 movlw 0x13 ; OSTC Plus and OSTC 2 (2017 model), w/o block write |
| 623 | 2275 cpfseq HW_descriptor |
| 614 | 2276 bra $+4 |
| 634 | 2277 bra do_menu_new_battery_AA_charger |
| 614 | 2278 |
| 623 | 2279 |
| 640 | 2280 movlw 0x0A ; OSTC 3 (USB model) |
| 2281 cpfseq HW_descriptor | |
| 2282 bra $+4 | |
| 2283 bra do_menu_new_battery_AA_no_charge | |
| 2284 | |
| 2285 movlw 0x1A ; OSTC 3 (BLE model) | |
| 2286 cpfseq HW_descriptor | |
| 2287 bra $+4 | |
| 2288 bra do_menu_new_battery_AA_no_charge | |
| 614 | 2289 |
| 640 | 2290 movlw 0x02 ; OSTC Sport (USB model) |
| 2291 cpfseq HW_descriptor | |
| 2292 bra $+4 | |
| 2293 bra do_menu_new_battery_AA_no_charge | |
| 614 | 2294 |
| 640 | 2295 movlw 0x52 ; OSTC Sport (BLE model) |
| 2296 cpfseq HW_descriptor | |
| 2297 bra $+4 | |
| 2298 bra do_menu_new_battery_AA_no_charge | |
| 623 | 2299 |
| 640 | 2300 bra do_menu_new_battery_other_model ; any other model |
| 582 | 2301 |
| 614 | 2302 |
| 634 | 2303 ;----------------------------------------------------------------------------- |
| 2304 ; return from confirm 3.6 V rechargeable | |
| 2305 ; | |
| 623 | 2306 do_return_menu_new_bat_AA_chrg: |
| 634 | 2307 call menu_processor_double_pop ; drop exit line and back to last line |
| 2308 ;bra do_menu_new_battery_AA_charger ; continue | |
| 614 | 2309 |
| 634 | 2310 ;----------------------------------------------------------------------------- |
| 640 | 2311 ; Battery Selection for OSTC (Full selection) |
| 2312 | |
| 2313 do_menu_new_battery_other_model: | |
| 2314 MENU_BEGIN tNewBattTitle, .6 | |
| 2315 MENU_CALL tNewBattOld, do_use_old_battery ; load data of old battery | |
| 2316 MENU_CALL tNewBattNew15, do_use_15V_disposable ; not rechargeable | |
| 2317 MENU_CALL tNewBattNew36, do_use_36V_disposable ; not rechargeable | |
| 2318 MENU_CALL tNewBattAccu, do_menu_new_battery_36V_charge ; rechargeable -> goto safety question | |
| 2319 MENU_CALL tNew16650, do_use_16650_battery ; OSTC 2 new model | |
| 2320 MENU_CALL tNew18650, use_18650_battery ; OSTC 2 (2015 model) | |
| 2321 MENU_END | |
| 2322 | |
| 2323 ;----------------------------------------------------------------------------- | |
| 634 | 2324 ; Battery Selection for OSTC Plus (charging function) TODO: and OSTC 2 new model as of now |
| 2325 ; | |
| 2326 do_menu_new_battery_AA_charger: | |
| 614 | 2327 MENU_BEGIN tNewBattTitle, .4 |
| 634 | 2328 MENU_CALL tNewBattOld, do_use_old_battery ; load data of old battery |
| 2329 MENU_CALL tNewBattNew15, do_use_15V_disposable ; not rechargeable | |
| 2330 ; MENU_CALL tNewBattNew36, do_use_36V_disposable ; not rechargeable -> not allowed any more !!! | |
| 2331 MENU_CALL tNewBattAccu, do_menu_new_battery_36V_charge ; rechargeable -> goto safety question | |
| 2332 MENU_CALL tNew16650, do_use_16650_battery ; OSTC 2 new model TODO: remove when OSTC 2 new model can be separated from Plus | |
| 614 | 2333 MENU_END |
| 2334 | |
| 634 | 2335 |
| 2336 ;----------------------------------------------------------------------------- | |
| 2337 ; Safety Question for 3.6 V rechargeable Battery | |
| 2338 ; | |
| 2339 do_menu_new_battery_36V_charge: | |
| 614 | 2340 MENU_BEGIN tNewBattTitle, .5 |
| 2341 MENU_CALL tConfirmChargeable1, 0 ; safety question, line 1 | |
| 2342 MENU_CALL tConfirmChargeable2, 0 ; safety question, line 2 | |
| 2343 MENU_CALL tConfirmChargeable3, 0 ; safety question, line 3 | |
| 623 | 2344 MENU_CALL tNo, do_return_menu_new_bat_AA_chrg ; NO - go back |
| 634 | 2345 MENU_CALL tYes, do_use_36V_chargeable ; YES - confirmed rechargeable |
| 623 | 2346 MENU_END |
| 2347 | |
| 634 | 2348 |
| 2349 ;----------------------------------------------------------------------------- | |
| 2350 ; Battery Selection for OSTC 3 and Sport (no charging function) | |
| 2351 ; | |
| 2352 do_menu_new_battery_AA_no_charge: | |
| 623 | 2353 MENU_BEGIN tNewBattTitle, .4 |
| 634 | 2354 MENU_CALL tNewBattOld, do_use_old_battery ; load data of old battery |
| 2355 MENU_CALL tNewBattNew15, do_use_15V_disposable ; not rechargeable | |
| 2356 MENU_CALL tNewBattNew36, do_use_36V_disposable ; not rechargeable | |
| 2357 MENU_CALL tNewBattAccu, do_use_36V_chargeable ; rechargeable | |
| 582 | 2358 MENU_END |
| 0 | 2359 |
| 582 | 2360 |
| 634 | 2361 ;----------------------------------------------------------------------------- |
| 2362 ; Call Function - keep old Battery | |
| 2363 ; | |
| 2364 do_use_old_battery: | |
| 2365 rcall get_battery_data ; load data of old battery | |
| 2366 goto surfloop ; proceed to surface mode | |
| 2367 | |
| 2368 | |
| 2369 ;----------------------------------------------------------------------------- | |
| 2370 ; Call Function - new 1.5 V disposable | |
| 2371 ; | |
| 2372 do_use_15V_disposable: | |
| 2373 rcall setup_new_15v | |
| 2374 bra use_batt_exit | |
| 2375 | |
| 2376 | |
| 2377 ;----------------------------------------------------------------------------- | |
| 2378 ; Call Function - new 3.6 V disposable | |
| 2379 ; | |
| 2380 do_use_36V_disposable: | |
| 2381 rcall setup_new_saft | |
| 2382 bra use_batt_exit | |
| 2383 | |
| 2384 | |
| 2385 ;----------------------------------------------------------------------------- | |
| 2386 ; Call Function - new 3.6 V rechargeable | |
| 2387 ; | |
| 2388 do_use_36V_chargeable: | |
| 2389 rcall setup_new_panasonic | |
| 2390 call reset_battery_gauge | |
| 2391 bra use_batt_exit_1 | |
| 2392 | |
| 2393 | |
| 2394 ;----------------------------------------------------------------------------- | |
| 2395 ; Call Function - build-in 16650 | |
| 2396 ; | |
| 2397 do_use_16650_battery: | |
| 2398 rcall setup_new_16650 | |
| 2399 bra use_batt_exit | |
| 2400 | |
| 2401 | |
| 2402 ;----------------------------------------------------------------------------- | |
| 2403 ; Call Function - build-in 18650 | |
| 2404 ; | |
| 2405 use_18650_battery: | |
| 2406 rcall setup_new_18650 | |
| 654 | 2407 bra use_batt_exit |
| 2408 | |
| 2409 ;----------------------------------------------------------------------------- | |
| 2410 ; Call Function - build-in 404050 | |
| 2411 ; | |
| 2412 use_404050_battery: | |
| 2413 rcall setup_new_404050 | |
| 634 | 2414 ;bra use_batt_exit |
| 654 | 2415 |
| 634 | 2416 |
| 2417 ;----------------------------------------------------------------------------- | |
| 2418 ; Helper Function - finish Battery Selection | |
| 2419 ; | |
| 2420 use_batt_exit: | |
| 656 | 2421 call reset_battery_gauge_and_lt2942 ; reset battery hard- and software gauge |
| 634 | 2422 |
| 2423 use_batt_exit_1: | |
| 2424 IFNDEF _screendump | |
| 2425 bcf comm_mode_disabled ; re-enable COMM mode again | |
| 2426 ENDIF | |
| 2427 goto surfloop ; exit to surface mode | |
| 2428 | |
| 2429 | |
| 2430 ;----------------------------------------------------------------------------- | |
| 2431 ; Retrieve Battery Selection from EEPROM | |
| 2432 ; | |
| 623 | 2433 global get_battery_data |
| 2434 get_battery_data: | |
| 631 | 2435 call eeprom_battery_gauge_read ; retrieve stored battery gauge value from EEPROM |
| 623 | 2436 movff battery_type,lo ; copy retrieved battery type to lo |
| 2437 rcall setup_new_saft ; default battery configuration | |
| 2438 incf lo,F ; (0-4) -> (1-5) | |
| 2439 dcfsnz lo,F | |
| 2440 rcall setup_new_15v ; =0 | |
| 2441 dcfsnz lo,F | |
| 2442 rcall setup_new_saft ; =1 | |
| 2443 dcfsnz lo,F | |
| 2444 rcall setup_new_panasonic ; =2 | |
| 2445 dcfsnz lo,F | |
| 2446 rcall setup_new_18650 ; =3 | |
| 2447 dcfsnz lo,F | |
| 2448 rcall setup_new_16650 ; =4 | |
| 654 | 2449 dcfsnz lo,F |
| 2450 rcall setup_new_404050 ; =5 | |
| 623 | 2451 bcf use_old_batt_flag ; clear flag |
| 2452 IFNDEF _screendump | |
| 2453 bcf comm_mode_disabled ; re-enable COMM mode again | |
| 2454 ENDIF | |
| 2455 return ; done | |
| 2456 | |
| 2457 | |
| 634 | 2458 ;----------------------------------------------------------------------------- |
| 2459 ; Helper Functions - configure Battery Types | |
| 2460 | |
| 623 | 2461 ; disposable 1.5 Volt Alkaline |
|
472
4fdf6886004b
CHANGE: Show warnings either in Customview (If active) _or_ next to warning sign
heinrichsweikamp
parents:
470
diff
changeset
|
2462 setup_new_15v: |
| 623 | 2463 bsf charge_disable ; set charging-inhibit signal |
| 2464 bcf charge_enable ; activate charging-inhibit signal | |
| 582 | 2465 movlw .100 |
| 604 | 2466 movwf batt_percent ; to have 1.5V batteries right after firmware update |
| 582 | 2467 movlw .0 |
| 623 | 2468 movwf battery_type |
| 2469 return | |
| 2470 | |
| 2471 ; disposable 3.6 Volt Lithium | |
| 2472 setup_new_saft: | |
| 2473 bsf charge_disable ; set charging-inhibit signal | |
| 2474 bcf charge_enable ; activate charging-inhibit signal | |
| 2475 MOVLI capacity_saft_internal, battery_capacity_internal | |
| 2476 MOVLI capacity_saft, battery_capacity | |
| 2477 MOVLI offset_saft, battery_offset | |
| 2478 movlw .1 | |
| 2479 movwf battery_type | |
| 2480 return | |
| 2481 | |
| 2482 ; rechargeable user-changeable 3.7 Volt Lithium-ion | |
| 2483 setup_new_panasonic: | |
| 2484 bcf charge_disable ; release charging-inhibit signal | |
| 2485 bsf charge_enable ; tristate charging-inhibit signal | |
| 656 | 2486 MOVLI capacity_14500_internal, battery_capacity_internal |
| 2487 MOVLI capacity_14500, battery_capacity | |
| 2488 MOVLI offset_14500, battery_offset | |
| 623 | 2489 movlw .2 |
| 2490 movwf battery_type | |
| 2491 return | |
| 2492 | |
| 2493 ; rechargeable internal Lithium-ion | |
| 2494 setup_new_18650: | |
| 2495 bcf charge_disable ; release charging-inhibit signal | |
| 2496 bsf charge_enable ; tristate charging-inhibit signal | |
| 2497 CLRI battery_capacity_internal | |
| 2498 MOVLI capacity_ncr18650, battery_capacity | |
| 2499 MOVLI offset_ncr18650, battery_offset | |
| 2500 movlw .3 | |
| 2501 movwf battery_type | |
| 654 | 2502 btfss use_old_batt_flag ; In a power-on-reset run? |
| 2503 clrf batt_percent ; YES: Start with 0% | |
| 623 | 2504 return |
| 2505 | |
| 2506 ; rechargeable internal Lithium-ion | |
| 2507 setup_new_16650: | |
| 2508 bcf charge_disable ; release charging-inhibit signal | |
| 2509 bsf charge_enable ; tristate charging-inhibit signal | |
| 2510 CLRI battery_capacity_internal | |
| 2511 MOVLI capacity_ur16650, battery_capacity | |
| 2512 MOVLI offset_ur16650, battery_offset | |
| 2513 movlw .4 | |
| 2514 movwf battery_type | |
| 654 | 2515 btfss use_old_batt_flag ; In a power-on-reset run? |
| 2516 clrf batt_percent ; YES: Start with 0% | |
| 2517 return | |
| 2518 | |
| 2519 ; rechargeable internal Lithium-ion 404050 | |
| 2520 setup_new_404050: | |
| 2521 bcf charge_disable ; release charging-inhibit signal | |
| 2522 bsf charge_enable ; tristate charging-inhibit signal | |
| 656 | 2523 |
| 654 | 2524 CLRI battery_capacity_internal |
| 2525 MOVLI capacity_404050, battery_capacity | |
| 2526 MOVLI offset_404050, battery_offset | |
| 2527 movlw .5 | |
| 2528 movwf battery_type | |
| 2529 btfss use_old_batt_flag ; In a power-on-reset run? | |
| 2530 clrf batt_percent ; YES: Start with 0% | |
| 582 | 2531 return |
| 2532 | |
| 623 | 2533 ;----------------------------------------------------------------------------- |
| 0 | 2534 |
| 623 | 2535 END |
