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