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