Mercurial > public > hwos_code
annotate src/menu_tree.asm @ 628:cd58f7fc86db
3.05 stable work
author | heinrichsweikamp |
---|---|
date | Thu, 19 Sep 2019 12:01:29 +0200 |
parents | c40025d8e750 |
children | 237931377539 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
628 | 3 ; File menu_tree.asm next combined generation V3.04.3 |
0 | 4 ; |
623 | 5 ; OSTC Surface Menus |
0 | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
10 ; 2011-07-11 : [jDG] Creation. | |
11 | |
604 | 12 #include "hwos.inc" ; mandatory header |
582 | 13 #include "gaslist.inc" |
14 #include "menu_processor.inc" | |
15 #include "start.inc" | |
16 #include "comm.inc" | |
17 #include "logbook.inc" | |
18 #include "tft.inc" | |
19 #include "eeprom_rs232.inc" | |
20 #include "external_flash.inc" | |
604 | 21 #include "shared_definitions.h" ; mailbox from/to p2_deco.c |
582 | 22 #include "ghostwriter.inc" |
23 #include "adc_lightsensor.inc" | |
24 #include "wait.inc" | |
25 #include "i2c.inc" | |
623 | 26 #include "calibrate.inc" |
27 #include "math.inc" | |
28 #include "rtc.inc" | |
582 | 29 |
0 | 30 |
582 | 31 extern do_demo_divemode |
32 extern restart | |
33 extern option_save_all | |
34 extern option_reset | |
35 extern do_demo_planner | |
623 | 36 extern comm_mode_ble ; will also set CPU speed to normal |
582 | 37 extern piezo_config |
38 extern option_reset_all | |
39 extern rtc_set_rtc | |
40 extern surfloop | |
41 extern oColorSetDive | |
623 | 42 extern vault_decodata_into_eeprom |
43 | |
44 IFDEF _ccr_pscr | |
604 | 45 extern option_cleanup_oCCRMode |
623 | 46 ENDIF |
47 | |
48 IFDEF _compass | |
49 extern compass_calibration_loop | |
50 ENDIF | |
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
155
diff
changeset
|
51 |
582 | 52 |
604 | 53 menu_tree CODE |
582 | 54 |
623 | 55 ;----------------------------------------------------------------------------- |
56 | |
57 | |
0 | 58 ;============================================================================= |
59 ; Main Menu | |
582 | 60 |
61 do_return_main_menu: | |
604 | 62 call menu_processor_double_pop ; drop exit line and back to last line |
582 | 63 bra do_main_menu_common |
64 | |
65 global do_main_menu | |
0 | 66 do_main_menu: |
623 | 67 movff active_customview,customview_surfmode ; save last custom view |
68 clrf MS_flags_imprint ; clear all flags for data imprinting | |
0 | 69 |
582 | 70 global do_main_menu2 |
71 do_main_menu2: ; entry point used by logbook.asm | |
623 | 72 call TFT_boot ; initialize display |
73 call menu_processor_reset ; reset menu stack | |
0 | 74 |
582 | 75 do_main_menu_common: |
623 | 76 IFDEF _ccr_pscr |
582 | 77 MENU_BEGIN tMainMenu, .7 |
78 MENU_CALL tLogbook, logbook | |
79 MENU_CALL tGasSetup, do_gas_menu | |
80 MENU_CALL tCCRSetup, do_ccr_menu | |
81 MENU_CALL tPlan, do_planner_menu | |
82 MENU_CALL tDiveModeMenu, do_divemode_menu | |
83 MENU_CALL tSystSets, do_settings_menu | |
623 | 84 MENU_CALL tExit, do_restart |
582 | 85 MENU_END |
623 | 86 ELSE |
87 MENU_BEGIN tMainMenu, .6 | |
88 MENU_CALL tLogbook, logbook | |
89 MENU_CALL tGasSetup, do_gas_menu | |
90 MENU_CALL tPlan, do_planner_menu | |
91 MENU_CALL tDiveModeMenu, do_divemode_menu | |
92 MENU_CALL tSystSets, do_settings_menu | |
93 MENU_CALL tExit, do_restart | |
94 MENU_END | |
95 ENDIF | |
582 | 96 |
0 | 97 |
623 | 98 do_restart: |
99 bsf restart_fast ; skip logos and waits an restart | |
100 goto restart ; restart into surface mode | |
101 | |
0 | 102 ;============================================================================= |
103 ; CCR Setup | |
104 | |
623 | 105 IFDEF _ccr_pscr |
106 | |
582 | 107 do_return_ccr_menu: |
108 call menu_processor_double_pop ; drop exit line and back to last line | |
0 | 109 |
110 do_ccr_menu: | |
604 | 111 call option_cleanup_oCCRMode ; in pSCR mode, revert AutoSP (2) to calculated SP (0) |
560 | 112 |
623 | 113 IFDEF _external_sensor |
114 bcf imprint_sensor_mv ; stop imprinting of live O2 sensor mV data | |
582 | 115 btfsc analog_o2_input |
116 bra do_ccr_menu_cR | |
623 | 117 ENDIF |
240 | 118 |
628 | 119 MENU_BEGIN tCCRSetup, .5 ; OSTC3 menu (and currently also the OSTC2 menu) |
582 | 120 MENU_OPTION tCCRMode, oCCRMode, 0 |
121 MENU_CALL tDiluentSetup, do_diluent_setup | |
122 MENU_CALL tFixedSetpoints, do_fixed_setpoints | |
628 | 123 MENU_CALL tMore, do_ccr_menu_more |
604 | 124 MENU_CALL tBack, do_return_main_menu |
582 | 125 MENU_END |
126 | |
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
155
diff
changeset
|
127 |
623 | 128 IFDEF _external_sensor |
129 | |
582 | 130 do_ccr_menu_cR: ; cR menu |
628 | 131 MENU_BEGIN tCCRSetup, .6 |
582 | 132 MENU_OPTION tCCRMode, oCCRMode, 0 |
133 MENU_CALL tCalibrateMenu, do_calibrate_menu | |
134 MENU_CALL tDiluentSetup, do_diluent_setup | |
135 MENU_CALL tFixedSetpoints, do_fixed_setpoints | |
628 | 136 MENU_CALL tMore, do_ccr_menu_more |
604 | 137 MENU_CALL tBack, do_return_main_menu |
582 | 138 MENU_END |
0 | 139 |
240 | 140 |
113 | 141 do_calibrate_menu: |
604 | 142 call enable_ir_s8 ; enable IR/S8-Port |
623 | 143 bsf imprint_sensor_mv ; start imprinting of live O2 sensor mV data |
582 | 144 |
113 | 145 do_calibrate_menu2: |
582 | 146 MENU_BEGIN tCalibrateMenu, .6 |
147 MENU_CALL tDiveHudMask1, 0 | |
148 MENU_CALL tDiveHudMask2, 0 | |
149 MENU_CALL tDiveHudMask3, 0 | |
623 | 150 MENU_OPTION tCalibrationGas, oCalGasO2, 0 |
582 | 151 MENU_CALL tCalibrate, do_calibrate_mix |
604 | 152 MENU_CALL tBack, do_return_ccr_menu |
582 | 153 MENU_END |
154 | |
113 | 155 |
156 do_calibrate_mix: | |
604 | 157 call calibrate_mix ; calibrate with opt_calibration_O2_ratio, also calibrate S8 HUD if connected |
158 WAITMS d'250' ; wait for HUD v3 | |
582 | 159 movlw .9 |
160 movff WREG,customview_surfmode ; show sensor mV custom view after restart | |
623 | 161 bsf restart_fast ; skip logos and waits an restart |
604 | 162 goto restart ; restart into surface mode |
113 | 163 |
623 | 164 ENDIF ; _external_sensor |
165 | |
0 | 166 |
167 do_diluent_setup: | |
623 | 168 bsf is_diluent_menu ; setting up diluents |
169 bcf short_gas_descriptions ; do not use short versions of gaslist_strcat_gas_cd and gaslist_strcat_setpoint | |
604 | 170 bcf better_gas_hint ; do not mark the best gas/diluent (to be used in dive mode only) |
171 call gaslist_cleanup_list ; take care that only one gas can be first | |
582 | 172 |
173 MENU_BEGIN tDiluentSetup, .6 | |
604 | 174 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu |
175 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu | |
176 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu | |
177 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu | |
178 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu | |
179 MENU_CALL tBack, do_return_ccr_menu | |
582 | 180 MENU_END |
181 | |
0 | 182 |
183 do_return_fixed_setpoints: | |
582 | 184 call menu_processor_double_pop ; drop exit line and back to last line |
0 | 185 |
186 do_fixed_setpoints: | |
623 | 187 bcf short_gas_descriptions ; =1: use short versions of gaslist_strcat_gas_cd and gaslist_strcat_setpoint |
604 | 188 bcf better_gas_hint ; do not mark the best gas/diluent (to be used in dive mode only) |
582 | 189 |
190 MENU_BEGIN tFixedSetpoints, .6 | |
191 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
192 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
193 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
194 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
195 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
604 | 196 MENU_CALL tBack, do_return_ccr_menu |
582 | 197 MENU_END |
198 | |
0 | 199 |
200 do_edit_sp_menu: | |
604 | 201 movff PRODL,gaslist_gas ; get menu item we came from (0-4) |
582 | 202 |
203 MENU_BEGIN tFixedSetpoints, .5 | |
204 MENU_DYNAMIC gaslist_strcat_setpoint_0, 0 | |
205 MENU_CALL tSPPlus, gaslist_spplus | |
206 MENU_CALL tDepthPlus, gaslist_spdepthplus | |
207 MENU_CALL tDepthMinus, gaslist_spdepthminus | |
604 | 208 MENU_CALL tBack, do_return_fixed_setpoints |
582 | 209 MENU_END |
210 | |
211 | |
628 | 212 do_ccr_menu_more: |
213 MENU_BEGIN tCCRSetup, .5 ; CCR/pSCR more menu | |
214 MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 | |
215 MENU_OPTION tDilppO2Check, oDilppO2Check, 0 | |
582 | 216 MENU_OPTION tPSCR_O2_drop, oPSCR_drop, 0 |
217 MENU_OPTION tPSCR_lungratio, oPSCR_lungratio, 0 | |
604 | 218 MENU_CALL tBack, do_return_ccr_menu |
582 | 219 MENU_END |
0 | 220 |
623 | 221 ENDIF ; _ccr_pscr |
222 | |
0 | 223 ;============================================================================= |
224 ; OC Gas Setup | |
225 | |
582 | 226 do_return_gas_menu: |
227 call menu_processor_double_pop ; drop exit line and back to last line | |
0 | 228 |
623 | 229 IFDEF _ccr_pscr |
230 btfsc is_diluent_menu ; return from setting up diluents? | |
604 | 231 bra do_diluent_setup ; YES |
623 | 232 ENDIF |
582 | 233 |
0 | 234 do_gas_menu: |
623 | 235 bcf is_diluent_menu ; setting up OC gases |
236 bcf short_gas_descriptions ; do not use short versions of gaslist_strcat_gas_cd and gaslist_strcat_setpoint | |
604 | 237 bcf better_gas_hint ; do not mark the best gas/diluent (to be used in dive mode only) |
238 call gaslist_cleanup_list ; takes care that only one gas can be first | |
0 | 239 |
582 | 240 MENU_BEGIN tGaslist, .6 |
604 | 241 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu |
242 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu | |
243 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu | |
244 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu | |
245 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu | |
246 MENU_CALL tBack, do_return_main_menu | |
582 | 247 MENU_END |
248 | |
249 | |
250 do_return_edit_gas_menu: | |
604 | 251 IFDEF _rx_functions |
623 | 252 bcf imprint_xmitter_pres ; stop imprinting of transmitter pressure data |
253 bcf imprint_xmitter_ID ; not in transmitter selection menu any more (back to normal timeout) | |
604 | 254 ENDIF |
623 | 255 call menu_processor_double_pop ; drop exit line and back to last line |
582 | 256 bra do_edit_gas_menu_common |
623 | 257 |
604 | 258 do_edit_gas_menu: |
259 movff PRODL,gaslist_gas ; get menu item we came from (0-4) | |
260 movlw .5 ; offset between gases and diluents | |
623 | 261 btfsc is_diluent_menu ; setting up diluents? |
604 | 262 addwf gaslist_gas,F ; YES - add the offset |
0 | 263 |
604 | 264 do_edit_gas_menu_common: |
265 MENU_BEGIN tGasEdit, .7 | |
582 | 266 MENU_DYNAMIC gaslist_gastitle, 0 |
267 MENU_DYNAMIC gaslist_MOD_END, 0 | |
268 MENU_DYNAMIC gaslist_show_type, gaslist_toggle_type | |
604 | 269 MENU_CALL tSetup_GasMix, do_setup_mix_menu |
270 MENU_DYNAMIC gaslist_GasDepth, do_setup_depth_menu | |
271 MENU_CALL tSetup_Tank, do_setup_tank_menu | |
272 MENU_CALL tBack, do_return_gas_menu | |
582 | 273 MENU_END |
274 | |
0 | 275 |
604 | 276 do_setup_mix_menu: |
623 | 277 IFDEF _helium |
582 | 278 MENU_BEGIN tGasEdit, .7 |
279 MENU_DYNAMIC gaslist_gastitle, 0 | |
280 MENU_DYNAMIC gaslist_MOD_END, 0 | |
281 MENU_CALL tO2Plus, gaslist_pO2 | |
282 MENU_CALL tO2Minus, gaslist_mO2 | |
283 MENU_CALL tHePlus, gaslist_pHe | |
284 MENU_CALL tHeMinus, gaslist_mHe | |
604 | 285 MENU_CALL tBack, do_return_edit_gas_menu |
286 MENU_END | |
623 | 287 ELSE |
288 MENU_BEGIN tGasEdit, .5 | |
289 MENU_DYNAMIC gaslist_gastitle, 0 | |
290 MENU_DYNAMIC gaslist_MOD_END, 0 | |
291 MENU_CALL tO2Plus, gaslist_pO2 | |
292 MENU_CALL tO2Minus, gaslist_mO2 | |
293 MENU_CALL tBack, do_return_edit_gas_menu | |
294 MENU_END | |
295 ENDIF | |
604 | 296 |
297 | |
298 do_setup_tank_menu: | |
299 IFDEF _rx_functions | |
623 | 300 TSTOSC opt_TR_mode ; TR functions switched on? |
604 | 301 bra do_setup_tank_menu_rx ; YES |
302 ENDIF | |
303 | |
623 | 304 IFDEF _ccr_pscr |
604 | 305 MENU_BEGIN tSetup_Tank, .6 |
306 MENU_DYNAMIC gaslist_gastitle, 0 | |
307 MENU_DYNAMIC gaslist_tank_size_pres, 0 | |
308 MENU_CALL tTankSize, gaslist_tank_size | |
309 MENU_CALL tTankUsablePress, gaslist_tank_pres | |
310 MENU_CALL tCopyDilToOC, gaslist_copy_dil_to_oc | |
311 MENU_CALL tBack, do_return_edit_gas_menu | |
582 | 312 MENU_END |
623 | 313 ELSE |
314 MENU_BEGIN tSetup_Tank, .5 | |
315 MENU_DYNAMIC gaslist_gastitle, 0 | |
316 MENU_DYNAMIC gaslist_tank_size_pres, 0 | |
317 MENU_CALL tTankSize, gaslist_tank_size | |
318 MENU_CALL tTankUsablePress, gaslist_tank_pres | |
319 MENU_CALL tBack, do_return_edit_gas_menu | |
320 MENU_END | |
321 ENDIF | |
428 | 322 |
560 | 323 |
604 | 324 IFDEF _rx_functions |
325 do_setup_tank_menu_rx: | |
326 setf pairing_slot ; prime slot number with 255 aka -1, used in pairing function | |
623 | 327 bsf imprint_xmitter_ID ; in transmitter selection menu (longer timeout) |
604 | 328 |
329 MENU_BEGIN tSetup_Tank, .7 | |
330 MENU_DYNAMIC gaslist_gastitle, 0 | |
331 MENU_DYNAMIC gaslist_tank_id_pres, 0 ; when changing position, adopt TFT_menu_tank_pres! | |
332 MENU_DYNAMIC gaslist_tank_size_pres, 0 | |
333 MENU_CALL tTankPairing, gaslist_tank_pairing | |
334 MENU_CALL tTankSize, gaslist_tank_size | |
335 MENU_CALL tTankUsablePress, gaslist_tank_pres | |
336 MENU_CALL tBack, do_return_edit_gas_menu | |
337 MENU_END | |
338 ENDIF | |
339 | |
340 | |
341 do_setup_depth_menu: | |
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
155
diff
changeset
|
342 |
582 | 343 MENU_BEGIN tGasEdit, .7 |
344 MENU_DYNAMIC gaslist_gastitle, 0 | |
345 MENU_DYNAMIC gaslist_MOD_END, 0 | |
346 MENU_DYNAMIC gaslist_ppo2, 0 ; ppO2 at change depth | |
347 MENU_CALL tDepthPlus, gaslist_pDepth | |
348 MENU_CALL tDepthMinus, gaslist_mDepth | |
349 MENU_DYNAMIC gaslist_reset_mod_title, gaslist_reset_mod | |
604 | 350 MENU_CALL tBack, do_return_edit_gas_menu |
582 | 351 MENU_END |
0 | 352 |
582 | 353 |
0 | 354 ;============================================================================= |
604 | 355 ; Simulator Menus |
0 | 356 |
582 | 357 do_return_planner_menu: |
628 | 358 call menu_processor_double_pop ; drop exit line and back to last line |
359 bra do_planner_common_1 | |
0 | 360 |
582 | 361 global do_return_demo_planner |
362 do_return_demo_planner: | |
363 call menu_processor_pop ; back to last line | |
364 bra do_planner_common | |
0 | 365 |
366 do_planner_menu: | |
623 | 367 ; ensure correct simulator results after mode changes without prior excursion to surface mode |
582 | 368 call option_save_all |
623 | 369 |
628 | 370 ; reset planning parameters to default values |
582 | 371 lfsr FSR0,odiveInterval |
372 call option_reset | |
373 lfsr FSR0,obottomTime | |
374 call option_reset | |
375 lfsr FSR0,obottomDepth | |
376 call option_reset | |
604 | 377 lfsr FSR0,oSimAGF |
378 call option_reset | |
582 | 379 |
628 | 380 IFDEF _gas_contingency |
381 ; switch off gas contingency mode by default | |
382 clrf WREG | |
383 movff WREG,char_I_gas_contingency | |
384 ENDIF | |
385 | |
582 | 386 do_planner_common: |
623 | 387 call restart_set_modes_and_flags ; initialize dive mode settings |
628 | 388 do_planner_common_1: |
604 | 389 movff opt_dive_mode,WREG ; get dive mode: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR |
390 dcfsnz WREG,W ; subtract one, became zero? | |
391 bra do_planner_common_ccr ; YES - use CCR version | |
392 | |
393 MENU_BEGIN tPlan, .7 | |
394 MENU_OPTION tIntvl, odiveInterval, 0 | |
395 MENU_OPTION tBtDep, obottomDepth, 0 | |
396 MENU_CALL tInter, do_demo_divemode | |
397 MENU_OPTION tBtTm, obottomTime, 0 | |
398 MENU_OPTION tuseAGF, oSimAGF, 0 | |
399 MENU_CALL tDeco, do_demo_planner | |
400 MENU_CALL tBack, do_return_main_menu | |
401 MENU_END | |
402 | |
403 do_planner_common_ccr: | |
582 | 404 MENU_BEGIN tPlan, .7 |
405 MENU_OPTION tIntvl, odiveInterval, 0 | |
406 MENU_OPTION tBtDep, obottomDepth, 0 | |
407 MENU_CALL tInter, do_demo_divemode | |
408 MENU_OPTION tBtTm, obottomTime, 0 | |
409 MENU_CALL tDecoSetup, do_planner_config | |
410 MENU_CALL tDeco, do_demo_planner | |
604 | 411 MENU_CALL tBack, do_return_main_menu |
582 | 412 MENU_END |
0 | 413 |
298
2fe34fc0e2ae
new submenu for gas consumption, show actual mix instead of GAS1-GAS5 in deco planner
heinrichsweikamp
parents:
275
diff
changeset
|
414 do_planner_config: |
628 | 415 IFDEF _gas_contingency |
416 MENU_BEGIN tPlan, .4 | |
417 MENU_OPTION tSelectSetpoint, oSimSetpoint, 0 | |
418 MENU_OPTION tuseAGF, oSimAGF, 0 | |
419 MENU_OPTION tGasContingency, oGasContingency, 0 | |
420 MENU_CALL tBack, do_return_planner_menu | |
421 MENU_END | |
422 ELSE | |
582 | 423 MENU_BEGIN tPlan, .3 |
424 MENU_OPTION tSelectSetpoint, oSimSetpoint, 0 | |
425 MENU_OPTION tuseAGF, oSimAGF, 0 | |
604 | 426 MENU_CALL tBack, do_return_planner_menu |
582 | 427 MENU_END |
628 | 428 ENDIF |
524 | 429 |
298
2fe34fc0e2ae
new submenu for gas consumption, show actual mix instead of GAS1-GAS5 in deco planner
heinrichsweikamp
parents:
275
diff
changeset
|
430 |
0 | 431 ;============================================================================= |
604 | 432 ; Divemode Menu |
0 | 433 |
434 do_return_divemode_menu: | |
582 | 435 call menu_processor_double_pop ; drop exit line and back to last line |
0 | 436 |
437 do_divemode_menu: | |
582 | 438 MENU_BEGIN tDiveModeMenu, .7 |
439 MENU_OPTION tDvMode, oDiveMode, 0 | |
440 MENU_OPTION tDkMode, oDecoMode, 0 | |
441 MENU_CALL tppO2settings, do_ppo2_menu | |
442 MENU_OPTION tsafetystopmenu, oSafetyStop, 0 | |
604 | 443 MENU_CALL tDecoparameters, do_decoparameters_menu |
582 | 444 MENU_CALL t2ndDecoPlanMenu, do_2nd_deco_plan_menu |
604 | 445 MENU_CALL tBack, do_return_main_menu |
582 | 446 MENU_END |
447 | |
0 | 448 |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
90
diff
changeset
|
449 do_ppo2_menu: |
623 | 450 IFDEF _ccr_pscr |
582 | 451 MENU_BEGIN tppO2settings, .6 |
623 | 452 MENU_DYNAMIC divesets_ppo2_max, do_toggle_ppo2_max_work |
582 | 453 MENU_DYNAMIC divesets_ppo2_max_deco, do_toggle_ppo2_max_deco |
454 MENU_DYNAMIC divesets_ppo2_min, do_toggle_ppo2_min | |
455 MENU_DYNAMIC divesets_ppo2_min_cc, do_toggle_ppo2_min_cc | |
456 MENU_OPTION tShowppO2, oShowppO2, 0 | |
604 | 457 MENU_CALL tBack, do_return_divemode_menu |
582 | 458 MENU_END |
623 | 459 ELSE |
460 MENU_BEGIN tppO2settings, .5 | |
461 MENU_DYNAMIC divesets_ppo2_max, do_toggle_ppo2_max_work | |
462 MENU_DYNAMIC divesets_ppo2_max_deco, do_toggle_ppo2_max_deco | |
463 MENU_DYNAMIC divesets_ppo2_min, do_toggle_ppo2_min | |
464 MENU_OPTION tShowppO2, oShowppO2, 0 | |
465 MENU_CALL tBack, do_return_divemode_menu | |
466 MENU_END | |
467 ENDIF | |
582 | 468 |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
90
diff
changeset
|
469 |
0 | 470 do_return_decoparameters_menu: |
582 | 471 call menu_processor_double_pop ; drop exit line and back to last line |
472 | |
473 do_decoparameters_menu: | |
474 movff char_I_deco_model,lo ; 0 = ZH-L16, 1 = ZH-L16-GF | |
475 tstfsz lo | |
604 | 476 bra do_decoparameters_menu_gf ; <> 0 -> GF menu! |
582 | 477 ; NON-GF menu |
604 | 478 MENU_BEGIN tDecoparameters, .6 |
479 MENU_OPTION tSetBotUse, obottom_usage, 0 | |
480 MENU_OPTION tSetDecoUse, odeco_usage, 0 | |
582 | 481 MENU_OPTION tSaturationMult, osatmult, 0 |
482 MENU_OPTION tDesaturationMult, odesatmult, 0 | |
604 | 483 MENU_CALL tMore, do_decoparameters_menu_more |
484 MENU_CALL tBack, do_return_divemode_menu | |
582 | 485 MENU_END |
486 | |
604 | 487 do_decoparameters_menu_gf: |
582 | 488 ; GF menu |
489 MENU_BEGIN tDecoparameters, .7 | |
604 | 490 MENU_OPTION tSetBotUse, obottom_usage, 0 |
491 MENU_OPTION tSetDecoUse, odeco_usage, 0 | |
492 MENU_CALL tGFMenu, do_GF_menu | |
582 | 493 MENU_OPTION tSaturationMult, osatmultgf, 0 |
494 MENU_OPTION tDesaturationMult, odesatmultgf, 0 | |
604 | 495 MENU_CALL tMore, do_decoparameters_menu_more |
496 MENU_CALL tBack, do_return_divemode_menu | |
582 | 497 MENU_END |
0 | 498 |
560 | 499 |
604 | 500 do_decoparameters_menu_more: |
623 | 501 MENU_BEGIN tDecoparameters, .7 |
604 | 502 MENU_OPTION tLastDecostop, oLastDeco, 0 |
503 MENU_OPTION tAscentSpeed, oAscentSpeed, 0 | |
504 MENU_OPTION tGasChangeTime, oGasChangeTime, 0 | |
623 | 505 MENU_OPTION tExtendedStops, oExtendedStops, 0 |
506 MENU_OPTION tTimeoutDive, oDiveTimeout, 0 | |
507 MENU_OPTION tStoreApnoeDive, oStoreApnoeDive, 0 | |
604 | 508 MENU_CALL tBack, do_return_decoparameters_menu |
582 | 509 MENU_END |
560 | 510 |
511 | |
604 | 512 do_2nd_deco_plan_menu: |
513 MENU_BEGIN t2ndDecoPlanMenu, .3 | |
514 MENU_OPTION tFTTSMenu, oExtraTime, 0 | |
515 MENU_OPTION tCalcAscGas, oCalcAscGas, 0 | |
516 MENU_CALL tBack, do_return_divemode_menu | |
582 | 517 MENU_END |
560 | 518 |
519 | |
604 | 520 do_GF_menu: |
521 MENU_BEGIN tGFMenu, .6 | |
522 MENU_OPTION tGF_low, oGF_low, 0 | |
523 MENU_OPTION tGF_high, oGF_high, 0 | |
582 | 524 MENU_OPTION taGF_enable, oEnable_aGF, 0 |
525 MENU_OPTION taGF_low, oaGF_low, 0 | |
526 MENU_OPTION taGF_high, oaGF_high, 0 | |
604 | 527 MENU_CALL tBack, do_return_decoparameters_menu |
582 | 528 MENU_END |
560 | 529 |
530 | |
0 | 531 ;============================================================================= |
532 ; Setup Menu | |
628 | 533 do_return_settings_deeper: ; entry point for return from info menu 2 |
534 call menu_processor_pop ; drop one more stack entry | |
535 | |
0 | 536 do_return_settings: |
623 | 537 bcf imprint_time_date ; stop imprinting of current time & date |
582 | 538 call menu_processor_double_pop ; drop exit line and back to last line |
604 | 539 IFDEF _rx_mode |
623 | 540 bcf tr_functions_activated ; set TR functions as deactivated by default |
541 btfss ostc_rx_present ; TR model / TR module up & running? | |
542 bra do_settings_menu ; NO | |
543 movff opt_TR_mode,WREG ; YES - get TR mode | |
544 tstfsz WREG ; - TR mode <> off ? | |
545 bsf tr_functions_activated ; YES - set TR functions as activated | |
604 | 546 ENDIF |
582 | 547 |
0 | 548 do_settings_menu: |
623 | 549 btfsc ble_available ; BLE available? |
582 | 550 bra do_settings_menu_ble ; YES |
551 | |
604 | 552 MENU_BEGIN tSystSets, .5 |
582 | 553 MENU_CALL tInfoMenu, do_info_menu |
554 MENU_CALL tSetTimeDate, do_date_time_menu | |
555 MENU_CALL tDispSets, do_dispsets_menu | |
556 MENU_CALL tMore, do_settings_menu_more | |
604 | 557 MENU_CALL tBack, do_return_main_menu |
582 | 558 MENU_END |
155
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
559 |
345 | 560 do_settings_menu_ble: |
604 | 561 IFDEF _rx_functions |
623 | 562 btfsc ostc_rx_present ; TR model? |
604 | 563 bra do_settings_menu_rx ; YES |
564 ENDIF | |
565 | |
566 MENU_BEGIN tSystSets, .6 | |
582 | 567 MENU_CALL tInfoMenu, do_info_menu |
623 | 568 MENU_CALL tBleTitle, comm_mode_ble |
582 | 569 MENU_CALL tSetTimeDate, do_date_time_menu |
570 MENU_CALL tDispSets, do_dispsets_menu | |
571 MENU_CALL tMore, do_settings_menu_more | |
604 | 572 MENU_CALL tBack, do_return_main_menu |
582 | 573 MENU_END |
574 | |
604 | 575 IFDEF _rx_functions |
576 do_settings_menu_rx: | |
577 MENU_BEGIN tSystSets, .7 | |
578 MENU_CALL tInfoMenu, do_info_menu | |
623 | 579 MENU_CALL tBleTitle, comm_mode_ble |
604 | 580 MENU_CALL tTrSettings, do_settings_menu_TR |
581 MENU_CALL tSetTimeDate, do_date_time_menu | |
582 MENU_CALL tDispSets, do_dispsets_menu | |
583 MENU_CALL tMore, do_settings_menu_more | |
584 MENU_CALL tBack, do_return_main_menu | |
585 MENU_END | |
586 ENDIF | |
587 | |
588 | |
582 | 589 do_info_menu: |
604 | 590 IFDEF _rx_functions |
591 btfsc ostc_rx_present ; TR model? | |
592 bra do_info_menu_TR ; YES | |
593 ENDIF | |
594 | |
582 | 595 MENU_BEGIN tInfoMenu, .6 |
596 MENU_DYNAMIC info_menu_serial, 0 | |
597 MENU_DYNAMIC info_menu_firmware, 0 | |
628 | 598 MENU_DYNAMIC info_menu_config, 0 |
582 | 599 MENU_DYNAMIC info_menu_battery_volts, 0 |
600 MENU_DYNAMIC info_menu_uptime, 0 | |
628 | 601 MENU_CALL tMore, do_info_menu2 |
604 | 602 MENU_END |
603 | |
604 IFDEF _rx_functions | |
605 do_info_menu_TR: | |
606 MENU_BEGIN tInfoMenu, .7 | |
607 MENU_DYNAMIC info_menu_serial, 0 | |
608 MENU_DYNAMIC info_menu_firmware, 0 | |
609 MENU_DYNAMIC info_menu_firmware_rx, 0 | |
628 | 610 MENU_DYNAMIC info_menu_config, 0 |
604 | 611 MENU_DYNAMIC info_menu_battery_volts, 0 |
612 MENU_DYNAMIC info_menu_uptime, 0 | |
628 | 613 MENU_CALL tMore, do_info_menu2 |
582 | 614 MENU_END |
604 | 615 ENDIF |
616 | |
628 | 617 do_info_menu2: ;same for all hardware versions |
618 MENU_BEGIN tInfoMenu, .2 | |
619 MENU_DYNAMIC info_menu_total_dives, 0 | |
620 MENU_CALL tBack, do_return_settings_deeper | |
621 MENU_END | |
622 | |
623 | |
604 | 624 |
625 IFDEF _rx_functions | |
623 | 626 |
604 | 627 do_settings_menu_TR: |
628 movff opt_dive_mode,WREG ; get dive mode: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR | |
629 incf WREG,W ; add 1 | |
630 dcfsnz WREG,W ; subtract one, became zero? | |
631 bra do_settings_menu_TR_MaxDelta; YES - OC | |
632 dcfsnz WREG,W ; subtract one, became zero? | |
633 bra do_settings_menu_TR_BailPres; YES - CCR | |
634 dcfsnz WREG,W ; subtract one, became zero? | |
635 bra do_settings_menu_TR_MaxDelta; YES - Gauge | |
636 dcfsnz WREG,W ; subtract one, became zero? | |
637 bra do_settings_menu_TR_abort ; YES - Apnea, abort | |
638 dcfsnz WREG,W ; subtract one, became zero? | |
639 bra do_settings_menu_TR_both ; YES - pSCR | |
640 do_settings_menu_TR_abort: | |
641 call menu_processor_pop ; drop last menu selection | |
642 bra do_settings_menu ; back to last menu | |
643 | |
644 do_settings_menu_TR_MaxDelta: ; menu with oTrMaxDeltaPres | |
645 MENU_BEGIN tTrSettings, .5 | |
646 MENU_OPTION tTrMode, oTrMode, 0 | |
647 MENU_OPTION tTr1stPres, oTr1stPres, 0 | |
648 MENU_OPTION tTr2ndPres, oTr2ndPres, 0 | |
649 MENU_DYNAMIC do_toggle_max_pres_diff_label,do_toggle_max_pres_diff | |
650 MENU_CALL tBack, do_return_settings | |
651 MENU_END | |
652 | |
653 do_settings_menu_TR_BailPres: ; menu with oTrBailPres | |
654 MENU_BEGIN tTrSettings, .5 | |
655 MENU_OPTION tTrMode, oTrMode, 0 | |
656 MENU_OPTION tTr1stPres, oTr1stPres, 0 | |
657 MENU_OPTION tTr2ndPres, oTr2ndPres, 0 | |
658 MENU_OPTION tTrBailPres, oTrBailPres, 0 | |
659 MENU_CALL tBack, do_return_settings | |
660 MENU_END | |
661 | |
662 do_settings_menu_TR_both: ; menu with oTrBailPres and oTrMaxDeltaPres | |
663 MENU_BEGIN tTrSettings, .6 | |
664 MENU_OPTION tTrMode, oTrMode, 0 | |
665 MENU_OPTION tTr1stPres, oTr1stPres, 0 | |
666 MENU_OPTION tTr2ndPres, oTr2ndPres, 0 | |
667 MENU_OPTION tTrBailPres, oTrBailPres, 0 | |
668 MENU_DYNAMIC do_toggle_max_pres_diff_label,do_toggle_max_pres_diff | |
669 MENU_CALL tBack, do_return_settings | |
670 MENU_END | |
671 | |
672 | |
673 do_toggle_max_pres_diff: ; add 5 bar, with hard-coded max. | |
674 movff char_I_max_pres_diff,lo ; get current value | |
675 movlw .5 ; load increment | |
676 addwf lo,F ; add increment | |
677 movlw max_pres_diff_max ; load maximum value | |
678 cpfsgt lo ; above maximum value? | |
679 bra do_toggle_max_pres_diff_1 ; NO - store new value | |
680 movlw max_pres_diff_min ; YES - load minimum value | |
681 movwf lo ; - into lo | |
682 do_toggle_max_pres_diff_1: | |
683 movff lo,char_I_max_pres_diff ; write back new value | |
684 return ; done | |
623 | 685 |
686 ENDIF ; _rx_functions | |
582 | 687 |
688 | |
689 do_return_settings_more_deeper: ; entry point for returns from reset sub-menu | |
690 call menu_processor_pop ; drop one more stack entry | |
326
d21b172d5a7a
VSIbar #4: VSI settings submenu, graph option, logbook offset and compass calib. menu exit fix
Janos Kovacs <kovjanos@gmail.com>
parents:
307
diff
changeset
|
691 |
d21b172d5a7a
VSIbar #4: VSI settings submenu, graph option, logbook offset and compass calib. menu exit fix
Janos Kovacs <kovjanos@gmail.com>
parents:
307
diff
changeset
|
692 do_return_settings_more: |
582 | 693 call menu_processor_double_pop ; drop exit line and back to last line |
694 | |
155
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
695 do_settings_menu_more: |
623 | 696 btfsc battery_gauge_available ; piezo buttons available? |
697 bra do_settings_menu_more_piezo ; YES | |
698 | |
699 IFDEF _compass | |
700 MENU_BEGIN tSystSets, .6 ; All MENU_CALLs | |
701 MENU_CALL tCompassMenu, do_compass_menu ; in this menu need to | |
702 MENU_CALL tLogOffset, do_log_offset_menu ; stay together on this | |
703 MENU_OPTION tAltMode, oAltMode, 0 ; menu level in order to | |
704 MENU_OPTION tDvSalinity, oDiveSalinity, 0 ; not mess up the menu | |
705 MENU_CALL tResetMenu, do_reset_menu ; stack on doing the | |
706 MENU_CALL tBack, do_return_settings ; do_return_settings ! | |
582 | 707 MENU_END |
623 | 708 ELSE |
709 MENU_BEGIN tSystSets, .5 ; see above | |
710 MENU_CALL tLogOffset, do_log_offset_menu ; | |
711 MENU_OPTION tAltMode, oAltMode, 0 ; | |
712 MENU_OPTION tDvSalinity, oDiveSalinity, 0 ; | |
713 MENU_CALL tResetMenu, do_reset_menu ; | |
714 MENU_CALL tBack, do_return_settings ; | |
715 MENU_END | |
716 ENDIF ; _compass | |
220
effd7259f5a5
make button sensitivity configurable (cR hardware)
heinrichsweikamp
parents:
218
diff
changeset
|
717 |
582 | 718 |
719 do_return_settings_menu_more_pz: | |
375
a9e35c1327aa
1.88 release, BUGFIX: Start with Sensor use from sleep (cR only), CHANGE: Apply button settings when button menu is closed, NEW: Reset button settings on a magnet reset (cR and OSTC 2)
heinrichsweikamp
parents:
359
diff
changeset
|
720 call TFT_ClearScreen |
604 | 721 call piezo_config ; configure buttons |
582 | 722 call menu_processor_double_pop ; drop exit line and back to last line |
524 | 723 |
269
1207cf9a9408
adjust menu for different hardware versions
heinrichsweikamp
parents:
243
diff
changeset
|
724 do_settings_menu_more_piezo: |
623 | 725 IFDEF _compass |
582 | 726 MENU_BEGIN tSystSets, .7 |
604 | 727 MENU_CALL tCompassMenu, do_compass_menu ; see above |
728 MENU_CALL tLogOffset, do_log_offset_menu ; | |
623 | 729 MENU_OPTION tAltMode, oAltMode, 0 ; |
730 MENU_OPTION tDvSalinity, oDiveSalinity, 0 ; | |
604 | 731 MENU_CALL tResetMenu, do_reset_menu ; |
732 MENU_CALL tMore, do_settings_piezo_menu ; | |
623 | 733 MENU_CALL tBack, do_return_settings ; |
582 | 734 MENU_END |
623 | 735 ELSE |
582 | 736 MENU_BEGIN tSystSets, .6 |
623 | 737 MENU_CALL tLogOffset, do_log_offset_menu ; see above |
738 MENU_OPTION tAltMode, oAltMode, 0 ; | |
739 MENU_OPTION tDvSalinity, oDiveSalinity, 0 ; | |
604 | 740 MENU_CALL tResetMenu, do_reset_menu ; |
623 | 741 MENU_CALL tMore, do_settings_piezo_menu ; |
742 MENU_CALL tBack, do_return_settings ; | |
582 | 743 MENU_END |
623 | 744 ENDIF |
582 | 745 |
243 | 746 |
345 | 747 do_settings_piezo_menu: |
582 | 748 ; Menu with features only available in piezo button hardware |
749 MENU_BEGIN tSystSets, .3 | |
604 | 750 MENU_OPTION tButtonleft, ocR_button_left, 0 ; left button sensitivity |
582 | 751 MENU_OPTION tButtonright, ocR_button_right, 0 ; right button sensitivity |
604 | 752 MENU_CALL tBack, do_return_settings_menu_more_pz |
582 | 753 MENU_END |
220
effd7259f5a5
make button sensitivity configurable (cR hardware)
heinrichsweikamp
parents:
218
diff
changeset
|
754 |
effd7259f5a5
make button sensitivity configurable (cR hardware)
heinrichsweikamp
parents:
218
diff
changeset
|
755 |
623 | 756 IFDEF _compass |
757 | |
18
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
758 do_compass_menu: |
582 | 759 MENU_BEGIN tSystSets, .5 |
623 | 760 MENU_CALL tCompassMenu, compass_calibration_loop ; exits to surface loop |
582 | 761 ; MENU_OPTION tCompassGain, oCompassGain, 0 |
762 MENU_DYNAMIC menu_cal_x, 0 | |
763 MENU_DYNAMIC menu_cal_y, 0 | |
764 MENU_DYNAMIC menu_cal_z, 0 | |
604 | 765 MENU_CALL tBack, do_return_settings_more |
582 | 766 MENU_END |
767 | |
623 | 768 ENDIF ; _compass |
769 | |
18
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
770 |
0 | 771 ;============================================================================= |
604 | 772 ; Reset and confirmation menu |
0 | 773 |
774 do_reset_menu: | |
582 | 775 MENU_BEGIN tResetMenu, .6 |
604 | 776 MENU_CALL tBack, do_return_settings_more |
623 | 777 MENU_CALL tReboot, do_reset_menu_reboot ; confirm |
778 MENU_CALL tResetDeco, do_reset_menu_deco ; confirm | |
779 MENU_CALL tResetSettings, do_reset_menu_settings ; confirm | |
780 MENU_CALL tResetLogbook, do_reset_menu_logbook ; confirm | |
604 | 781 MENU_CALL tResetBattery, do_new_battery_menu ; confirm |
582 | 782 MENU_END |
0 | 783 |
623 | 784 do_reset_menu_reboot: |
582 | 785 MENU_BEGIN tResetMenu2, .2 |
786 MENU_CALL tAbort, do_return_settings_more_deeper | |
623 | 787 MENU_CALL tReboot, do_reboot ; reboot (cold start) |
582 | 788 MENU_END |
0 | 789 |
623 | 790 do_reset_menu_deco: |
582 | 791 MENU_BEGIN tResetMenu2, .2 |
792 MENU_CALL tAbort, do_return_settings_more_deeper | |
623 | 793 MENU_CALL tResetDeco, do_reset_deco ; reset deco and return to main reset menu |
582 | 794 MENU_END |
0 | 795 |
623 | 796 do_reset_menu_settings: |
582 | 797 MENU_BEGIN tResetMenu2, .2 |
798 MENU_CALL tAbort, do_return_settings_more_deeper | |
623 | 799 MENU_CALL tResetSettings, do_reset_settings ; reset all settings and go to surface mode |
582 | 800 MENU_END |
0 | 801 |
623 | 802 do_reset_menu_logbook: |
582 | 803 MENU_BEGIN tResetMenu2, .2 |
804 MENU_CALL tAbort, do_return_settings_more_deeper | |
623 | 805 MENU_CALL tResetLogbook, do_reset_logbook ; reset logbook and return to main reset menu |
582 | 806 MENU_END |
807 | |
63 | 808 |
809 do_reset_logbook: | |
604 | 810 clrf EEADRH ; make sure to select EEPROM bank 0 |
582 | 811 clrf EEDATA |
812 read_int_eeprom .2 | |
813 write_int_eeprom .16 | |
814 read_int_eeprom .3 | |
604 | 815 write_int_eeprom .17 ; copy number of dives |
63 | 816 clrf EEDATA |
582 | 817 write_int_eeprom .2 |
604 | 818 write_int_eeprom .3 ; clear total dives |
582 | 819 write_int_eeprom .4 |
820 write_int_eeprom .5 | |
604 | 821 write_int_eeprom .6 ; reset logbook pointers |
822 call ext_flash_erase_logbook ; and complete logbook | |
823 bra do_return_settings_more_deeper | |
63 | 824 |
0 | 825 |
826 do_reset_deco: | |
623 | 827 call deco_clear_tissue ; set all tissues to absolute pressure * N2_ratio (C-code) |
828 call deco_calc_dive_interval_1min ; update tissues by 1 minute to calculate current GF factor (C-code) | |
829 call deco_calc_desaturation_time ; calculate desaturation and no-fly/no-altitude time (C-code) | |
582 | 830 banksel common |
623 | 831 call vault_decodata_into_eeprom ; store updated deco data to EEPROM |
604 | 832 bra do_return_settings_more_deeper |
582 | 833 |
0 | 834 |
835 do_reset_settings: | |
604 | 836 call TFT_ClearScreen ; clear screen |
837 call option_reset_all ; reset all options to factory default | |
623 | 838 call do_logoffset_reset ; reset log offset |
839 goto restart ; restart into surface mode | |
0 | 840 |
841 do_reboot: | |
623 | 842 call ext_flash_enable_protection ; set write protection on external EEPROM |
843 call rtc_init ; reset the real time clock (will reset to firmware creation date) | |
0 | 844 reset |
845 | |
623 | 846 do_return_date_time_menu: |
847 call menu_processor_double_pop ; drop exit line and back to last line | |
0 | 848 |
849 do_date_time_menu: | |
623 | 850 bsf imprint_time_date ; start imprinting current time & date |
851 bcf block_option_value ; allow display of option values again | |
852 | |
582 | 853 MENU_BEGIN tSetTimeDate, .4 |
854 MENU_CALL tSetTime, do_time_menu | |
855 MENU_CALL tSetDate, do_date_menu | |
623 | 856 MENU_OPTION tDateFormat, oDateFormat, 0 |
604 | 857 MENU_CALL tBack, do_return_settings |
582 | 858 MENU_END |
859 | |
0 | 860 |
861 do_date_menu: | |
623 | 862 bsf block_option_value ; suspend display of option values |
582 | 863 |
864 MENU_BEGIN tSetDate, .4 | |
865 MENU_OPTION tSetDay, oSetDay, 0 | |
866 MENU_OPTION tSetMonth, oSetMonth, 0 | |
867 MENU_OPTION tSetYear, oSetYear, 0 | |
623 | 868 MENU_CALL tBack, do_return_date_time_menu |
582 | 869 MENU_END |
0 | 870 |
871 | |
872 do_time_menu: | |
623 | 873 bsf block_option_value ; suspend display of option values |
582 | 874 |
875 MENU_BEGIN tSetTime, .4 | |
876 MENU_OPTION tSetHours, oSetHours, 0 | |
877 MENU_OPTION tSetMinutes, oSetMinutes, 0 | |
623 | 878 MENU_OPTION tSetSeconds, oClearSeconds, 0 |
879 MENU_CALL tBack, do_return_date_time_menu | |
582 | 880 MENU_END |
0 | 881 |
882 | |
623 | 883 do_toggle_ppo2_max_work: ; add 0.1 bar, with hard-coded max. |
884 movff char_I_ppO2_max_work,lo ; bank-safe copy | |
582 | 885 movlw .10 |
0 | 886 addwf lo,F |
582 | 887 movlw ppo2_warning_high_highest |
0 | 888 cpfsgt lo |
582 | 889 bra do_toggle_ppo2_max2 |
890 movlw ppo2_warning_high_lowest | |
0 | 891 movwf lo |
892 do_toggle_ppo2_max2: | |
623 | 893 movff lo,char_I_ppO2_max_work |
582 | 894 return |
0 | 895 |
604 | 896 do_toggle_ppo2_max_deco: ; add 0.1 bar, with hard-coded max. |
623 | 897 movff char_I_ppO2_max_deco,lo ; bank-safe copy |
582 | 898 movlw .10 |
507
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
899 addwf lo,F |
582 | 900 movlw ppo2_warning_deco_highest |
507
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
901 cpfsgt lo |
582 | 902 bra do_toggle_ppo2_max_deco2 |
903 movlw ppo2_warning_deco_lowest | |
507
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
904 movwf lo |
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
905 do_toggle_ppo2_max_deco2: |
582 | 906 movff lo,char_I_ppO2_max_deco |
907 return | |
908 | |
604 | 909 do_toggle_ppo2_min: ; sub 0.1 bar, with hard-coded min. |
623 | 910 movff char_I_ppO2_min,lo ; bank-safe copy |
582 | 911 incf lo,F |
912 movlw ppo2_warning_low_highest | |
0 | 913 cpfsgt lo |
582 | 914 bra do_toggle_ppo2_min2 |
915 movlw ppo2_warning_low_lowest | |
0 | 916 movwf lo |
917 do_toggle_ppo2_min2: | |
582 | 918 movff lo,char_I_ppO2_min |
919 return | |
0 | 920 |
604 | 921 do_toggle_ppo2_min_cc: ; sub 0.1 bar, with hard-coded min. |
623 | 922 movff char_I_ppO2_min_loop,lo ; bank-safe copy |
582 | 923 incf lo,F |
924 movlw ppo2_warning_loop_highest | |
560 | 925 cpfsgt lo |
582 | 926 bra do_toggle_ppo2_min_cc2 |
927 movlw ppo2_warning_loop_lowest | |
560 | 928 movwf lo |
929 do_toggle_ppo2_min_cc2: | |
582 | 930 movff lo,char_I_ppO2_min_loop |
931 return | |
932 | |
0 | 933 |
934 ; Logbook offset sub-menu | |
935 do_log_offset_menu: | |
623 | 936 |
937 clrf WREG ; select an initial step size of 1 | |
938 movff WREG,opt_logoffset_step ; bank-safe write to option variable | |
939 | |
940 MENU_BEGIN tLogOffset, .5 | |
941 MENU_DYNAMIC TFT_LogOffset, 0 | |
942 MENU_OPTION tLogOffStepSize, oLogOffsetStep, 0 | |
943 MENU_CALL tLogOffsetplus, do_logoffset_plus | |
944 MENU_CALL tLogOffsetminus, do_logoffset_minus | |
604 | 945 MENU_CALL tBack, do_return_settings_more |
582 | 946 MENU_END |
0 | 947 |
948 | |
623 | 949 do_logoffset_common: |
950 call do_logoffset_common_read ; read current offset into mpr+1:mpr+0 | |
951 movff opt_logoffset_step,ul ; get step size: 0=1, 1=10, 2=100, 3=1000 | |
952 incf ul,F ; 0...3 -> 1...4 | |
953 clrf mpr+3 ; clear step size, high byte | |
954 movlw .1 ; set a step size of 1 | |
955 movwf mpr+2 ; copy to step size, low byte | |
956 dcfsnz ul,F ; ul--, did ul became 0, i.e. step size = 1 ? | |
957 return ; YES - done | |
958 movlw .10 ; NO - set a step size of 10 | |
959 movwf mpr+2 ; - copy to step size, low byte | |
960 dcfsnz ul,F ; ul--, did ul became 0, i.e. step size = 10 ? | |
961 return ; YES - done | |
962 movlw .100 ; NO - set a step size of 100 | |
963 movwf mpr+2 ; - copy to step size, low byte | |
964 dcfsnz ul,F ; ul--, did ul became 0, i.e. step size = 100 ? | |
965 return ; YES - done | |
966 movlw LOW .1000 ; NO - set a step size of 1000, low byte | |
967 movwf mpr+2 ; - copy to step size, low byte | |
968 movlw HIGH .1000 ; - set a step size of 1000, high byte | |
969 movwf mpr+3 ; - copy to step size, high byte | |
970 return ; - done | |
0 | 971 |
623 | 972 do_logoffset_plus: |
973 rcall do_logoffset_common ; load current offset and step size | |
974 ; add step size to current offset | |
975 movf mpr+2,W ; get step size, low byte | |
976 addwf mpr+0,F ; add to offset, low byte | |
977 movf mpr+3,W ; get step size, high byte | |
978 addwfc mpr+1,F ; add to offset, high byte, considering carry flag | |
979 ; check if new offset is within limit | |
980 MOVLI .9999,sub_a ; load max limit into sub_a | |
981 MOVII mpr, sub_b ; copy new offset into sub_b | |
982 call cmpU16 ; compute sub_a - sub_b, setting neg_flag if result becomes negative | |
983 btfss neg_flag ; neg_flag set, i.e. new offset > 9999 ? | |
984 bra do_logoffset_exit ; NO - store offset and return | |
985 MOVLI .9999,mpr ; YES - limit offset to 9999 | |
986 bra do_logoffset_exit ; - store offset and return | |
0 | 987 |
623 | 988 do_logoffset_minus: |
989 rcall do_logoffset_common ; load current offset and step size | |
990 ; subtract step size from current offset | |
991 movf mpr+2,W ; get step size, low byte | |
992 subwf mpr+0,F ; subtract from offset, low byte | |
993 movf mpr+3,W ; get step size, high byte | |
994 subwfb mpr+1,F ; subtract from offset, high byte, considering borrow flag | |
995 ; check if new offset is within limit | |
996 btfsc STATUS,C ; borrow to propagate (B == /CARRY) ? | |
997 bra do_logoffset_exit ; NO - result >= 0, store and return | |
998 do_logoffset_reset: | |
999 clrf mpr+0 ; YES - revert offset to 0, low byte | |
1000 clrf mpr+1 ; - ... high byte | |
1001 ;bra do_logoffset_exit ; - store offset and return | |
0 | 1002 |
604 | 1003 do_logoffset_exit: |
623 | 1004 goto do_logoffset_common_write ; store offset and return |
1005 | |
0 | 1006 |
582 | 1007 do_return_dispsets_menu: |
623 | 1008 bcf imprint_color_schemes ; not in color schemes menu any more |
582 | 1009 call menu_processor_double_pop ; drop exit line and back to last line |
0 | 1010 |
1011 do_dispsets_menu: | |
604 | 1012 IF _language_2!=none |
1013 MENU_BEGIN tDispSets, .7 | |
582 | 1014 MENU_OPTION tBright, oBrightness, 0 |
604 | 1015 MENU_OPTION tLanguage, oLanguage, 0 |
1016 MENU_OPTION tUnits, oUnits, 0 | |
582 | 1017 MENU_CALL tColorScheme, do_color_scheme |
1018 MENU_OPTION tFlip, oFlipScreen, 0 | |
1019 MENU_CALL tMore, do_dispsets_menu_more | |
604 | 1020 MENU_CALL tBack, do_return_settings |
582 | 1021 MENU_END |
604 | 1022 ELSE |
1023 MENU_BEGIN tDispSets, .6 | |
1024 MENU_OPTION tBright, oBrightness, 0 | |
1025 MENU_OPTION tUnits, oUnits, 0 | |
1026 MENU_CALL tColorScheme, do_color_scheme | |
1027 MENU_OPTION tFlip, oFlipScreen, 0 | |
1028 MENU_CALL tMore, do_dispsets_menu_more | |
1029 MENU_CALL tBack, do_return_settings | |
1030 MENU_END | |
1031 ENDIF | |
582 | 1032 |
335
3d43da7acfe1
Always show ppO2 (warning position, standard color) option
janos_kovacs <kovjanos@gmail.com>
parents:
333
diff
changeset
|
1033 |
3d43da7acfe1
Always show ppO2 (warning position, standard color) option
janos_kovacs <kovjanos@gmail.com>
parents:
333
diff
changeset
|
1034 do_dispsets_menu_more: |
623 | 1035 IFDEF _helium |
582 | 1036 MENU_BEGIN tDispSets, .7 |
1037 MENU_OPTION tMODwarning, oMODwarning, 0 | |
623 | 1038 ; MENU_OPTION tIBCDwarning, oEnable_IBCD, 0 ; taken out in favor of option oLayout |
582 | 1039 MENU_OPTION tVSItext2, oVSItextv2, 0 |
1040 MENU_OPTION tVSIgraph, oVSIgraph, 0 | |
623 | 1041 MENU_OPTION tLayout, oLayout, 0 |
1042 MENU_OPTION t2ndDepth, o2ndDepthDisp, 0 | |
1043 MENU_OPTION tTissueGraphics, oTissueGraphics, 0 | |
1044 MENU_CALL tBack, do_return_dispsets_menu | |
1045 MENU_END | |
1046 ELSE | |
1047 MENU_BEGIN tDispSets, .6 | |
1048 MENU_OPTION tMODwarning, oMODwarning, 0 | |
1049 ; MENU_OPTION tIBCDwarning, oEnable_IBCD, 0 ; taken out in favor of option oLayout | |
1050 MENU_OPTION tVSItext2, oVSItextv2, 0 | |
1051 MENU_OPTION tVSIgraph, oVSIgraph, 0 | |
1052 MENU_OPTION tLayout, oLayout, 0 | |
604 | 1053 MENU_OPTION t2ndDepth, o2ndDepthDisp, 0 |
1054 MENU_CALL tBack, do_return_dispsets_menu | |
582 | 1055 MENU_END |
623 | 1056 ENDIF |
0 | 1057 |
582 | 1058 |
50 | 1059 do_color_scheme: |
623 | 1060 bsf imprint_color_schemes ; in color schemes menu |
582 | 1061 |
1062 MENU_BEGIN tColorScheme, .2 | |
1063 MENU_OPTION tColorSetDive, oColorSetDive, 0 | |
604 | 1064 MENU_CALL tBack, do_return_dispsets_menu |
582 | 1065 MENU_END |
50 | 1066 |
1067 | |
0 | 1068 ;============================================================================= |
1069 | |
582 | 1070 do_new_battery_menu: |
1071 MENU_BEGIN tNewBattTitle, .2 | |
1072 MENU_CALL tAbort, do_return_settings_more_deeper | |
623 | 1073 MENU_CALL tYes, do_new_battery_select_1 |
582 | 1074 MENU_END |
1075 | |
623 | 1076 |
582 | 1077 global do_new_battery_select |
1078 do_new_battery_select: | |
623 | 1079 call TFT_boot ; initialize TFT (includes clear screen) |
1080 call TFT_Display_FadeIn ; dim up the display | |
1081 call menu_processor_reset ; reset menu stack | |
1082 | |
1083 do_new_battery_select_1: | |
1084 ; make sure to reset battery percentage | |
1085 movlw .100 | |
1086 movwf batt_percent ; set battery level to full | |
1087 | |
1088 ; default (in cases of timeout or USB): use old battery | |
1089 call retrieve_battery_registers ; retrieve stored battery gauge value from EEPROM | |
604 | 1090 |
1091 IFDEF _screendump | |
623 | 1092 bsf screen_dump_avail ; enable screen dump function to prevent exiting into COMM mode immediately |
604 | 1093 ELSE |
623 | 1094 bsf comm_mode_disabled ; disable COMM mode to prevent exiting into COMM mode immediately |
604 | 1095 ENDIF |
1096 | |
623 | 1097 ; hardware descriptor: user changeable battery charger supported battery types |
614 | 1098 ; ------------------------------------------------------------------------------------------------------------------------------------------------------- |
623 | 1099 ; 0x11: BLE and battery gauge ---> OSTC 2 (old model) NO YES internal 18650 |
1100 ; 0x05: analog input and battery gauge ---> OSTC 2 cR NO YES internal 18650 | |
1101 ; 0x33: BLE and RX module and ambient sensor and battery gauge ---> OSTC 2 TR NO YES internal 16650 | |
1102 ; 0x13: BLE and ambient sensor and battery gauge -+-> OSTC 2 (new model) NO YES internal 16650 | |
1103 ; +-> OSTC Plus YES YES 1.5V ----- NO! ----- 3.6V rechargeable | |
1104 ; 0x0A: optical input and ambient sensor ---> OSTC 3 (USB model) YES NO 1.5V 3.6V disposable 3.6V rechargeable | |
1105 ; 0x1A: BLE and optical input and ambient sensor ---> OSTC 3 (BLE model) YES NO 1.5V 3.6V disposable 3.6V rechargeable | |
1106 ; 0x02: ambient sensor ---> OSTC Sport (USB model) YES NO 1.5V 3.6V disposable 3.6V rechargeable | |
1107 ; 0x52: BLE and ambient sensor and low volt core ---> OSTC Sport (BLE model) YES NO 1.5V 3.6V disposable 3.6V rechargeable | |
614 | 1108 |
1109 | |
623 | 1110 movlw 0x11 ; OSTC 2 (old model) |
1111 cpfseq HW_descriptor | |
614 | 1112 bra $+4 |
623 | 1113 bra use_18650_battery |
614 | 1114 |
623 | 1115 movlw 0x05 ; OSTC 2 cR |
1116 cpfseq HW_descriptor | |
614 | 1117 bra $+4 |
623 | 1118 bra use_18650_battery |
76 | 1119 |
614 | 1120 movlw 0x33 ; OSTC 2 TR |
623 | 1121 cpfseq HW_descriptor |
614 | 1122 bra $+4 |
623 | 1123 bra use_16650_battery |
614 | 1124 |
623 | 1125 ; movlw 0xXX ; OSTC 2 (new model) TODO: define signature |
1126 ; cpfseq HW_descriptor | |
1127 ; bra $+4 | |
1128 ; bra use_16650_battery | |
614 | 1129 |
623 | 1130 movlw 0x13 ; OSTC Plus TODO: and OSTC 2 new model as of now |
1131 cpfseq HW_descriptor | |
614 | 1132 bra $+4 |
623 | 1133 bra menu_new_battery_AA_charger |
614 | 1134 |
623 | 1135 ; movlw 0x0A ; OSTC 3 (USB model) |
1136 ; cpfseq HW_descriptor | |
1137 ; bra $+4 | |
1138 ; bra menu_new_battery_AA_no_charger | |
1139 | |
1140 ; movlw 0x1A ; OSTC 3 (BLE model) | |
1141 ; cpfseq HW_descriptor | |
1142 ; bra $+4 | |
1143 ; bra menu_new_battery_AA_no_charger | |
614 | 1144 |
623 | 1145 ; movlw 0x02 ; OSTC Sport (USB model) |
1146 ; cpfseq HW_descriptor | |
1147 ; bra $+4 | |
1148 ; bra menu_new_battery_AA_no_charger | |
614 | 1149 |
623 | 1150 ; movlw 0x52 ; OSTC Sport (BLE model) |
1151 ; cpfseq HW_descriptor | |
1152 ; bra $+4 | |
1153 ; bra menu_new_battery_AA_no_charger | |
1154 | |
1155 bra menu_new_battery_AA_no_charger ; any other model | |
582 | 1156 |
614 | 1157 |
623 | 1158 do_return_menu_new_bat_AA_chrg: |
614 | 1159 call menu_processor_double_pop ; drop exit line and back to last line |
1160 | |
623 | 1161 ; OSTC Plus (charging function) TODO: and OSTC 2 new model as of now |
1162 menu_new_battery_AA_charger: | |
614 | 1163 MENU_BEGIN tNewBattTitle, .4 |
1164 MENU_CALL tNewBattOld, use_old_batteries | |
1165 MENU_CALL tNewBattNew15, use_new_15V_batteries ; not rechargeable | |
623 | 1166 ; MENU_CALL tNewBattNew36, use_36V_disposable ; not rechargeable -> not allowed any more !!! |
1167 MENU_CALL tNewBattAccu, pre_36V_rechargeable ; rechargeable -> goto safety question | |
1168 MENU_CALL tNew16650, use_16650_battery ; OSTC 2 new model TODO: remove when OSTC 2 new model can be separated from Plus | |
614 | 1169 MENU_END |
1170 | |
1171 pre_36V_rechargeable: | |
1172 MENU_BEGIN tNewBattTitle, .5 | |
1173 MENU_CALL tConfirmChargeable1, 0 ; safety question, line 1 | |
1174 MENU_CALL tConfirmChargeable2, 0 ; safety question, line 2 | |
1175 MENU_CALL tConfirmChargeable3, 0 ; safety question, line 3 | |
623 | 1176 MENU_CALL tNo, do_return_menu_new_bat_AA_chrg ; NO - go back |
1177 MENU_CALL tYes, use_37V_rechargeable ; YES - confirmed rechargeable | |
1178 MENU_END | |
1179 | |
1180 ; OSTC 3 and Sport (no charging function) | |
1181 menu_new_battery_AA_no_charger: | |
1182 MENU_BEGIN tNewBattTitle, .4 | |
1183 MENU_CALL tNewBattOld, use_old_batteries | |
1184 MENU_CALL tNewBattNew15, use_new_15V_batteries ; not rechargeable | |
1185 MENU_CALL tNewBattNew36, use_36V_disposable ; not rechargeable | |
1186 MENU_CALL tNewBattAccu, use_37V_rechargeable ; rechargeable | |
582 | 1187 MENU_END |
0 | 1188 |
582 | 1189 |
457 | 1190 global use_old_prior_209 |
1191 use_old_prior_209: | |
1192 clrf EEADRH | |
582 | 1193 read_int_eeprom 0x0F ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah |
604 | 1194 incfsz EEDATA,F ; was 0xFF? |
1195 return ; NO - done | |
477
44b8a826b314
NEW: Show battery type in surface mode next to battery voltage
heinrichsweikamp
parents:
474
diff
changeset
|
1196 |
604 | 1197 call lt2942_get_status ; check for gauge IC |
623 | 1198 movlw .3 ; Assume a 18650 |
582 | 1199 btfss battery_gauge_available ; cR/2 hardware? |
604 | 1200 movlw .1 ; assume a Saft |
582 | 1201 movwf EEDATA |
604 | 1202 write_int_eeprom 0x0F ; store the new battery type into EEPROM |
457 | 1203 return |
582 | 1204 |
1205 | |
0 | 1206 use_old_batteries: |
623 | 1207 rcall get_battery_data ; load data of old battery |
1208 goto surfloop ; proceed to surface loop | |
582 | 1209 |
0 | 1210 |
623 | 1211 global get_battery_data |
1212 get_battery_data: | |
1213 call retrieve_battery_registers ; retrieve stored battery gauge value from EEPROM | |
1214 movff battery_type,lo ; copy retrieved battery type to lo | |
1215 rcall setup_new_saft ; default battery configuration | |
1216 incf lo,F ; (0-4) -> (1-5) | |
1217 dcfsnz lo,F | |
1218 rcall setup_new_15v ; =0 | |
1219 dcfsnz lo,F | |
1220 rcall setup_new_saft ; =1 | |
1221 dcfsnz lo,F | |
1222 rcall setup_new_panasonic ; =2 | |
1223 dcfsnz lo,F | |
1224 rcall setup_new_18650 ; =3 | |
1225 dcfsnz lo,F | |
1226 rcall setup_new_16650 ; =4 | |
1227 bcf use_old_batt_flag ; clear flag | |
1228 IFNDEF _screendump | |
1229 bcf comm_mode_disabled ; re-enable COMM mode again | |
1230 ENDIF | |
1231 return ; done | |
1232 | |
1233 | |
1234 ; 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
|
1235 setup_new_15v: |
623 | 1236 bsf charge_disable ; set charging-inhibit signal |
1237 bcf charge_enable ; activate charging-inhibit signal | |
582 | 1238 movlw .100 |
604 | 1239 movwf batt_percent ; to have 1.5V batteries right after firmware update |
582 | 1240 movlw .0 |
623 | 1241 movwf battery_type |
1242 return | |
1243 | |
1244 ; disposable 3.6 Volt Lithium | |
1245 setup_new_saft: | |
1246 bsf charge_disable ; set charging-inhibit signal | |
1247 bcf charge_enable ; activate charging-inhibit signal | |
1248 MOVLI capacity_saft_internal, battery_capacity_internal | |
1249 MOVLI capacity_saft, battery_capacity | |
1250 MOVLI offset_saft, battery_offset | |
1251 movlw .1 | |
1252 movwf battery_type | |
1253 return | |
1254 | |
1255 ; rechargeable user-changeable 3.7 Volt Lithium-ion | |
1256 setup_new_panasonic: | |
1257 bcf charge_disable ; release charging-inhibit signal | |
1258 bsf charge_enable ; tristate charging-inhibit signal | |
1259 MOVLI capacity_panasonic_internal, battery_capacity_internal | |
1260 MOVLI capacity_panasonic, battery_capacity | |
1261 MOVLI offset_panasonic, battery_offset | |
1262 movlw .2 | |
1263 movwf battery_type | |
1264 return | |
1265 | |
1266 ; rechargeable internal Lithium-ion | |
1267 setup_new_18650: | |
1268 bcf charge_disable ; release charging-inhibit signal | |
1269 bsf charge_enable ; tristate charging-inhibit signal | |
1270 CLRI battery_capacity_internal | |
1271 MOVLI capacity_ncr18650, battery_capacity | |
1272 MOVLI offset_ncr18650, battery_offset | |
1273 movlw .3 | |
1274 movwf battery_type | |
1275 return | |
1276 | |
1277 ; rechargeable internal Lithium-ion | |
1278 setup_new_16650: | |
1279 bcf charge_disable ; release charging-inhibit signal | |
1280 bsf charge_enable ; tristate charging-inhibit signal | |
1281 CLRI battery_capacity_internal | |
1282 MOVLI capacity_ur16650, battery_capacity | |
1283 MOVLI offset_ur16650, battery_offset | |
1284 movlw .4 | |
1285 movwf battery_type | |
582 | 1286 return |
1287 | |
1288 | |
623 | 1289 use_new_15V_batteries: |
1290 rcall setup_new_15v | |
1291 bra use_batt_exit | |
448 | 1292 |
623 | 1293 use_36V_disposable: |
1294 rcall setup_new_saft | |
1295 bra use_batt_exit | |
582 | 1296 |
623 | 1297 use_37V_rechargeable: |
1298 rcall setup_new_panasonic | |
1299 call reset_battery_internal_only | |
1300 bra use_batt_exit_1 | |
472
4fdf6886004b
CHANGE: Show warnings either in Customview (If active) _or_ next to warning sign
heinrichsweikamp
parents:
470
diff
changeset
|
1301 |
474 | 1302 use_16650_battery: |
582 | 1303 rcall setup_new_16650 |
604 | 1304 bra use_batt_exit |
623 | 1305 |
448 | 1306 use_18650_battery: |
582 | 1307 rcall setup_new_18650 |
623 | 1308 ;bra use_batt_exit |
1309 | |
604 | 1310 use_batt_exit: |
623 | 1311 call reset_battery_pointer ; reset battery pointer 0x07-0x0C and battery gauge |
1312 use_batt_exit_1: | |
604 | 1313 IFNDEF _screendump |
623 | 1314 bcf comm_mode_disabled ; re-enable COMM mode again |
604 | 1315 ENDIF |
1316 goto surfloop ; jump to surface loop | |
1317 | |
623 | 1318 ;----------------------------------------------------------------------------- |
0 | 1319 |
623 | 1320 END |