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