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