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