Mercurial > public > hwos_code
annotate src/menu_tree.asm @ 653:8bcd138ab744
add tools/o3pack.bat and the required tools/libs
author | heinrichsweikamp |
---|---|
date | Fri, 11 Aug 2023 15:53:49 +0200 |
parents | 682c514c53c0 |
children | 75e90cd0c2c3 |
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 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
10 ; 2011-07-11 : [jDG] Creation. | |
11 | |
634 | 12 |
13 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
14 ; | |
15 ; ATTENTION | |
16 ; | |
17 ; All Calls made via the Menu Macros need to go to Addresses within 0x0xxxx ! | |
18 ; | |
19 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
20 | |
21 | |
604 | 22 #include "hwos.inc" ; mandatory header |
634 | 23 #include "shared_definitions.h" ; mailbox from/to p2_deco.c |
582 | 24 #include "gaslist.inc" |
25 #include "menu_processor.inc" | |
26 #include "start.inc" | |
27 #include "comm.inc" | |
28 #include "tft.inc" | |
29 #include "eeprom_rs232.inc" | |
30 #include "external_flash.inc" | |
31 #include "adc_lightsensor.inc" | |
32 #include "wait.inc" | |
33 #include "i2c.inc" | |
623 | 34 #include "calibrate.inc" |
35 #include "math.inc" | |
36 #include "rtc.inc" | |
634 | 37 #include "strings.inc" |
38 #include "tft_outputs.inc" | |
39 #include "convert.inc" | |
40 #include "colorschemes.inc" | |
582 | 41 |
0 | 42 |
634 | 43 extern surfloop |
44 extern logbook | |
45 extern demo_divemode | |
46 extern demo_planner | |
47 extern piezo_config | |
48 extern comm_firmware_update_exec | |
49 | |
631 | 50 extern option_check_and_store_all |
582 | 51 extern option_reset |
52 extern option_reset_all | |
634 | 53 extern option_adjust_group_member |
54 extern option_inc | |
55 extern option_dec | |
56 extern option_draw | |
57 | |
58 extern get_cpu_version | |
631 | 59 extern eeprom_deco_data_write |
623 | 60 |
634 | 61 |
623 | 62 IFDEF _ccr_pscr |
604 | 63 extern option_cleanup_oCCRMode |
623 | 64 ENDIF |
65 | |
66 IFDEF _compass | |
634 | 67 extern compass_calibration |
623 | 68 ENDIF |
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
155
diff
changeset
|
69 |
634 | 70 IFDEF _rx_functions |
71 extern get_transmitter_id_by_slot | |
72 ENDIF | |
623 | 73 |
74 | |
0 | 75 ;============================================================================= |
634 | 76 surf_menu CODE 0x01000 ; needs to be at 0x0xxxx |
77 ;============================================================================= | |
78 | |
582 | 79 |
634 | 80 ;----------------------------------------------------------------------------- |
81 ; Returning from a Menu Item | |
82 ; | |
582 | 83 do_return_main_menu: |
604 | 84 call menu_processor_double_pop ; drop exit line and back to last line |
634 | 85 bra main_menu_common ; continue with menu |
86 | |
582 | 87 |
634 | 88 ;----------------------------------------------------------------------------- |
89 ; Entry Point for Main Menu | |
90 ; | |
91 global main_menu | |
92 main_menu: | |
623 | 93 movff active_customview,customview_surfmode ; save last custom view |
94 clrf MS_flags_imprint ; clear all flags for data imprinting | |
631 | 95 call TFT_boot ; initialize display |
96 call menu_processor_reset ; reset menu stack | |
0 | 97 |
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 | |
1297 MENU_BEGIN tInfoMenu, .5 | |
1298 MENU_DYNAMIC dyn_show_battery_volts, 0 | |
1299 MENU_DYNAMIC dyn_show_config, 0 | |
1300 MENU_DYNAMIC dyn_show_sensor_calib, 0 | |
1301 MENU_DYNAMIC dyn_show_sensor_offset, 0 | |
1302 MENU_CALL tBack, do_return_menu_settings_deeper | |
1303 MENU_END | |
1304 ELSE | |
1305 MENU_BEGIN tInfoMenu, .6 | |
1306 MENU_DYNAMIC dyn_show_battery_volts, 0 | |
1307 MENU_DYNAMIC dyn_show_config, 0 | |
1308 MENU_DYNAMIC dyn_show_sensor_calib, 0 | |
1309 MENU_DYNAMIC dyn_show_sensor_offset, 0 | |
1310 MENU_OPT_INC tCommTimeout, oCommTimeout | |
1311 MENU_CALL tBack, do_return_menu_settings_deeper | |
1312 MENU_END | |
1313 ENDIF | |
1314 | |
1315 | |
1316 ;----------------------------------------------------------------------------- | |
1317 ; dynamic Title - show Battery Volts and Type | |
1318 ; | |
1319 dyn_show_battery_volts: | |
1320 STRCAT_TEXT tBatteryV ; print text | |
1321 MOVII batt_voltage,mpr ; get battery voltage | |
1322 bsf decimal_digit3 ; place a decimal point in front of digit 3 | |
1323 bsf omit_digit_1 ; do not print 1st digit | |
1324 output_9999 ; print as x.yy- | |
1325 STRCAT " V(T" ; append fix legend | |
1326 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 | |
1327 output_9 ; print battery type code (0-9) | |
1328 PUTC ")" ; append fix legend | |
1329 return ; done | |
1330 | |
1331 | |
1332 ;----------------------------------------------------------------------------- | |
1333 ; dynamic Title - show Hardware / Software Configuration | |
1334 ; | |
1335 dyn_show_config: | |
1336 STRCAT_TEXT tHardware ; print text | |
1337 call I2C_init_compass ; start compass to get compass configuration | |
1338 movf HW_descriptor,W ; copy hardware descriptor to WREG | |
648 | 1339 output_hex ; print as hex |
634 | 1340 movf HW_variants,W ; copy hardware variants to WREG |
648 | 1341 output_hex ; print as hex |
1342 PUTC "-" ; print a separator | |
1343 movlw FW_CONF ; get firmware configuration | |
1344 output_hex ; print as hex | |
634 | 1345 call get_cpu_version ; get CPU version |
648 | 1346 output_hex ; print as hex |
1347 btfss less_io_cpu ; =1: OSTC has a CPU with less I/O pins | |
1348 return ; Done. | |
1349 PUTC "*" | |
1350 return ; Less I/O CPU done. | |
634 | 1351 |
1352 | |
1353 ;----------------------------------------------------------------------------- | |
1354 ; dynamic Title - show Pressure Sensor Calibration Data C1 and C5 | |
1355 ; | |
1356 dyn_show_sensor_calib: | |
1357 STRCAT_TEXT tSensorC ; print label | |
1358 movff C1+1,WREG ; get C1, high byte | |
1359 output_hex ; print C1, high byte | |
1360 movff C1+0,WREG ; get C1, low byte | |
1361 output_hex ; print C1, low byte | |
1362 PUTC "-" ; print a separator | |
1363 movff C5+1,WREG ; get C5, high byte | |
1364 output_hex ; print C5, high byte | |
1365 movff C5+0,WREG ; get C5, low byte | |
1366 output_hex ; print C5, low byte | |
643 | 1367 btfss press_sensor_type ; =1: pressure sensor MS5837, =0: Pressure sensor MS5541 |
1368 return ; MS5541, done | |
1369 PUTC "*" | |
1370 return ; MS5837, done | |
1371 | |
634 | 1372 |
1373 | |
1374 ;----------------------------------------------------------------------------- | |
1375 ; dynamic Title - show Pressure Sensor Offset Setting | |
1376 ; | |
1377 dyn_show_sensor_offset: | |
1378 STRCAT_TEXT tSensorD ; print label | |
1379 movff opt_pressure_adjust,lo ; get pressure sensor offset | |
1380 movf lo,F ; excite flags | |
1381 bz dyn_show_sensor_offset_zero ; sensor offset = 0 | |
1382 bn dyn_show_sensor_offset_neg ; sensor offset < 0 | |
1383 ;bnn dyn_show_sensor_offset_pos ; sensor offset > 0 | |
1384 dyn_show_sensor_offset_pos: | |
1385 PUTC "+" ; print plus sign | |
1386 bra dyn_show_sensor_offset_com ; continue with common part | |
1387 dyn_show_sensor_offset_zero: | |
1388 PUTC " " ; print a space | |
1389 bra dyn_show_sensor_offset_com ; continue with common part | |
1390 dyn_show_sensor_offset_neg: | |
1391 PUTC "-" ; print a minus sign | |
1392 negf lo ; negate lo | |
1393 ;bra dyn_show_sensor_offset_com ; continue with common part | |
1394 dyn_show_sensor_offset_com: | |
1395 PUTC " " ; print a space | |
1396 bsf leftbind ; print left-aligned | |
1397 output_99 ; print value (0-99) | |
1398 PUTC " " ; print a space | |
1399 STRCAT_TEXT tMBAR ; print unit | |
1400 return ; done | |
1401 | |
1402 | |
1403 IFDEF _rx_functions | |
1404 | |
1405 ;----------------------------------------------------------------------------- | |
1406 ; Settings Menu - 2nd Layer - TR Settings | |
1407 ; | |
1408 do_menu_settings_TR: | |
604 | 1409 movff opt_dive_mode,WREG ; get dive mode: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR |
1410 incf WREG,W ; add 1 | |
1411 dcfsnz WREG,W ; subtract one, became zero? | |
634 | 1412 bra do_menu_settings_TR_MaxDelta; YES - OC |
1413 dcfsnz WREG,W ; subtract one, became zero? | |
1414 bra do_menu_settings_TR_BailPres; YES - CCR | |
604 | 1415 dcfsnz WREG,W ; subtract one, became zero? |
634 | 1416 bra do_menu_settings_TR_MaxDelta; YES - Gauge |
604 | 1417 dcfsnz WREG,W ; subtract one, became zero? |
634 | 1418 bra do_menu_settings_TR_abort ; YES - Apnea, abort |
604 | 1419 dcfsnz WREG,W ; subtract one, became zero? |
634 | 1420 bra do_menu_settings_TR_both ; YES - pSCR |
1421 | |
1422 do_menu_settings_TR_abort: | |
1423 call menu_processor_pop ; drop button press | |
1424 bra do_menu_settings ; back to same menu | |
604 | 1425 |
634 | 1426 |
1427 ;----------------------------------------------------------------------------- | |
1428 ; Settings Menu - 3rd Layer - TR Settings - Sidemount Mode | |
1429 ; | |
1430 do_menu_settings_TR_MaxDelta: ; menu with oTrMaxDeltaPres | |
604 | 1431 MENU_BEGIN tTrSettings, .5 |
634 | 1432 MENU_OPT_INC tTrMode, oTrMode |
1433 MENU_OPT_INC tTr1stPres, oTr1stPres | |
1434 MENU_OPT_INC tTr2ndPres, oTr2ndPres | |
1435 MENU_DYNAMIC dyn_toggle_max_pres_diff, do_toggle_max_pres_diff | |
1436 MENU_CALL tBack, do_return_menu_settings | |
604 | 1437 MENU_END |
1438 | |
1439 | |
634 | 1440 ;----------------------------------------------------------------------------- |
1441 ; Settings Menu - 3rd Layer - TR Settings - CCR Mode | |
1442 ; | |
1443 do_menu_settings_TR_BailPres: ; menu with oTrBailPres | |
1444 MENU_BEGIN tTrSettings, .5 | |
1445 MENU_OPT_INC tTrMode, oTrMode | |
1446 MENU_OPT_INC tTr1stPres, oTr1stPres | |
1447 MENU_OPT_INC tTr2ndPres, oTr2ndPres | |
1448 MENU_OPT_INC tTrBailPres, oTrBailPres | |
1449 MENU_CALL tBack, do_return_menu_settings | |
1450 MENU_END | |
1451 | |
1452 | |
1453 ;----------------------------------------------------------------------------- | |
1454 ; Settings Menu - 3rd Layer - TR Settings - pSCR Mode | |
1455 ; | |
1456 do_menu_settings_TR_both: ; menu with oTrBailPres and oTrMaxDeltaPres | |
1457 MENU_BEGIN tTrSettings, .6 | |
1458 MENU_OPT_INC tTrMode, oTrMode | |
1459 MENU_OPT_INC tTr1stPres, oTr1stPres | |
1460 MENU_OPT_INC tTr2ndPres, oTr2ndPres | |
1461 MENU_OPT_INC tTrBailPres, oTrBailPres | |
1462 MENU_DYNAMIC dyn_toggle_max_pres_diff, do_toggle_max_pres_diff | |
1463 MENU_CALL tBack, do_return_menu_settings | |
1464 MENU_END | |
1465 | |
1466 | |
1467 ;----------------------------------------------------------------------------- | |
1468 ; dynamic Title - max. Delta Pressure for Swap Tanks Advice | |
1469 ; | |
1470 dyn_toggle_max_pres_diff: | |
1471 movff opt_TR_mode,WREG ; get TR mode | |
1472 xorlw .2 ; compare with 2 (ind.double) | |
1473 tstfsz WREG ; equal? | |
1474 FONT_COLOR_DISABLED ; NO - print in disabled color | |
1475 STRCAT_TEXT tTrMaxDeltaP ; output label | |
1476 movff char_I_max_pres_diff,lo ; get configured deltaP | |
1477 output_99 ; print deltaP (0-99) | |
1478 STRCAT_TEXT tbar ; append " bar" | |
1479 return ; done | |
1480 | |
1481 | |
1482 ;----------------------------------------------------------------------------- | |
1483 ; Call Function - adjust max. Delta Pressure for Swap Tanks Advice | |
1484 ; | |
604 | 1485 do_toggle_max_pres_diff: ; add 5 bar, with hard-coded max. |
1486 movff char_I_max_pres_diff,lo ; get current value | |
1487 movlw .5 ; load increment | |
1488 addwf lo,F ; add increment | |
1489 movlw max_pres_diff_max ; load maximum value | |
1490 cpfsgt lo ; above maximum value? | |
1491 bra do_toggle_max_pres_diff_1 ; NO - store new value | |
1492 movlw max_pres_diff_min ; YES - load minimum value | |
1493 movwf lo ; - into lo | |
1494 do_toggle_max_pres_diff_1: | |
1495 movff lo,char_I_max_pres_diff ; write back new value | |
1496 return ; done | |
623 | 1497 |
1498 ENDIF ; _rx_functions | |
582 | 1499 |
1500 | |
634 | 1501 ;----------------------------------------------------------------------------- |
1502 ; return to Settings Menu from Sub-Menu | |
1503 ; | |
1504 do_return_menu_date_time: | |
582 | 1505 call menu_processor_double_pop ; drop exit line and back to last line |
1506 | |
634 | 1507 |
1508 ;----------------------------------------------------------------------------- | |
1509 ; Settings Menu - 2nd Layer - set Time & Date | |
1510 ; | |
1511 do_menu_date_time: | |
1512 bsf imprint_time_date ; start imprinting current time & date | |
1513 bcf block_option_value ; resume displaying of option values | |
1514 | |
1515 MENU_BEGIN tSetTimeDate, .4 | |
1516 MENU_CALL tSetTime, do_menu_set_time | |
1517 MENU_CALL tSetDate, do_menu_set_date | |
1518 MENU_OPT_INC tDateFormat, oDateFormat | |
1519 MENU_CALL tBack, do_return_menu_settings | |
1520 MENU_END | |
1521 | |
1522 | |
1523 ;----------------------------------------------------------------------------- | |
1524 ; Settings Menu - 3rd Layer - set Time & Date - set Time | |
1525 ; | |
1526 do_menu_set_time: | |
1527 bsf block_option_value ; suspend displaying of option values | |
1528 | |
1529 MENU_BEGIN tSetTime, .4 | |
1530 MENU_OPT_INC tSetHours, oSetHours | |
1531 MENU_OPT_INC tSetMinutes, oSetMinutes | |
1532 MENU_OPT_INC tSetSeconds, oClearSeconds | |
1533 MENU_CALL tBack, do_return_menu_date_time | |
1534 MENU_END | |
1535 | |
623 | 1536 |
634 | 1537 ;----------------------------------------------------------------------------- |
1538 ; Settings Menu - 3rd Layer - set Time & Date - set Date | |
1539 ; | |
1540 do_menu_set_date: | |
1541 bsf block_option_value ; suspend displaying of option values | |
1542 | |
1543 MENU_BEGIN tSetDate, .4 | |
1544 MENU_OPT_INC tSetDay, oSetDay | |
1545 MENU_OPT_INC tSetMonth, oSetMonth | |
1546 MENU_OPT_INC tSetYear, oSetYear | |
1547 MENU_CALL tBack, do_return_menu_date_time | |
1548 MENU_END | |
1549 | |
1550 | |
1551 ;----------------------------------------------------------------------------- | |
1552 ; return to Display Settings from Sub-Menu | |
1553 ; | |
1554 do_return_dispsets_menu: | |
1555 bcf imprint_color_schemes ; deactivate color schemes demonstration | |
1556 call menu_processor_double_pop ; drop exit line and back to last line | |
1557 ;bra do_menu_dispsets ; continue | |
1558 | |
1559 | |
1560 ;----------------------------------------------------------------------------- | |
1561 ; Settings Menu - 2nd Layer - Display Settings - Page 1 | |
1562 ; | |
1563 do_menu_dispsets: | |
1564 IF _language_2!=none | |
1565 MENU_BEGIN tDispSets, .7 | |
645 | 1566 MENU_CALL tBright, do_menu_Brightness |
634 | 1567 MENU_OPT_INC tLayout, oLayout |
1568 MENU_OPT_INC tUnits, oUnits | |
1569 MENU_OPT_INC tLanguage, oLanguage | |
1570 MENU_OPT_INC tFlip, oFlipScreen | |
1571 MENU_CALL tColorScheme, do_menu_color_scheme | |
1572 MENU_CALL tMore, do_menu_dispsets_more | |
582 | 1573 MENU_END |
623 | 1574 ELSE |
634 | 1575 MENU_BEGIN tDispSets, .6 |
645 | 1576 MENU_CALL tBright, do_menu_Brightness |
634 | 1577 MENU_OPT_INC tLayout, oLayout |
1578 MENU_OPT_INC tUnits, oUnits | |
1579 MENU_OPT_INC tFlip, oFlipScreen | |
1580 MENU_CALL tColorScheme, do_menu_color_scheme | |
1581 MENU_CALL tMore, do_menu_dispsets_more | |
623 | 1582 MENU_END |
634 | 1583 ENDIF |
220
effd7259f5a5
make button sensitivity configurable (cR hardware)
heinrichsweikamp
parents:
218
diff
changeset
|
1584 |
645 | 1585 ;----------------------------------------------------------------------------- |
1586 ; Settings Menu - 3rd Layer - Display Settings - Brightness | |
1587 ; | |
1588 do_menu_Brightness: | |
650 | 1589 MENU_BEGIN tBright, .4 |
1590 MENU_OPT_INC tBrightDive, oBrightness_dive | |
1591 MENU_OPT_INC tBrightSurface, oBrightness_surface | |
1592 MENU_OPT_INC tUseAmbientSensor, oUseAmbientSensor | |
645 | 1593 MENU_CALL tBack, do_return_dispsets_menu |
1594 MENU_END | |
582 | 1595 |
645 | 1596 |
634 | 1597 ;----------------------------------------------------------------------------- |
1598 ; Settings Menu - 3rd Layer - Display Settings - Color Schemes | |
1599 ; | |
1600 do_menu_color_scheme: | |
1601 bsf imprint_color_schemes ; activate color schemes demonstration | |
1602 | |
1603 ; menu with 4 leading empty menu lines to give space for the color scheme imprinting | |
1604 MENU_BEGIN_OFFSET tColorScheme, .2, .4 | |
1605 MENU_OPT_INC tColorSetDive, oColorSetDive | |
1606 MENU_CALL tBack, do_return_dispsets_menu | |
1607 MENU_END | |
1608 | |
524 | 1609 |
634 | 1610 ;----------------------------------------------------------------------------- |
1611 ; Settings Menu - 2nd Layer - Display Settings - Page 2 | |
1612 ; | |
1613 do_menu_dispsets_more: | |
1614 IFDEF _helium | |
1615 MENU_BEGIN tDispSets, .7 | |
1616 MENU_OPT_INC tVSIgraph, oVSIgraph | |
1617 MENU_OPT_INC tVSItext2, oVSItext | |
1618 MENU_OPT_INC tShowppO2, oShowppO2 | |
1619 MENU_OPT_INC tDepthWarning, oDepthWarn | |
1620 MENU_OPT_INC t2ndDepth, o2ndDepthDisp | |
1621 MENU_OPT_INC tTissueGraphics, oTissueGraphics | |
1622 MENU_CALL tBack, do_return_menu_settings_deeper | |
582 | 1623 MENU_END |
623 | 1624 ELSE |
634 | 1625 MENU_BEGIN tDispSets, .6 |
1626 MENU_OPT_INC tVSIgraph, oVSIgraph | |
1627 MENU_OPT_INC tVSItext2, oVSItext | |
1628 MENU_OPT_INC tShowppO2, oShowppO2 | |
1629 MENU_OPT_INC tDepthWarning, oDepthWarn | |
1630 MENU_OPT_INC t2ndDepth, o2ndDepthDisp | |
1631 MENU_CALL tBack, do_return_menu_settings_deeper | |
582 | 1632 MENU_END |
623 | 1633 ENDIF |
582 | 1634 |
243 | 1635 |
634 | 1636 ;----------------------------------------------------------------------------- |
1637 ; return to System Settings Menu from Sub-Sub-Menu | |
1638 ; | |
1639 do_return_menu_syssets_more_more: ; entry point for returns from reset sub-menu | |
1640 call menu_processor_pop ; drop one more stack entry | |
1641 ;bra do_return_menu_syssets_more ; continue | |
1642 | |
1643 | |
1644 ;----------------------------------------------------------------------------- | |
1645 ; return to System Settings Menu from Sub-Menu | |
1646 ; | |
1647 do_return_menu_syssets_more: | |
1648 call menu_processor_double_pop ; drop exit line and back to last line | |
1649 bra do_menu_syssets ; continue | |
1650 | |
1651 | |
1652 ;----------------------------------------------------------------------------- | |
1653 ; return to System Settings Menu from Piezo-Sub-Menu | |
1654 ; | |
1655 do_return_menu_syssets_piezo: | |
1656 call menu_processor_double_pop ; drop exit line and back to last line | |
1657 call TFT_ClearScreen ; clear the screen | |
1658 call piezo_config ; configure buttons | |
1659 ;bra do_menu_syssets ; continue | |
1660 | |
1661 | |
1662 ;----------------------------------------------------------------------------- | |
1663 ; Settings Menu - 2nd Layer - System Settings | |
1664 ; | |
1665 do_menu_syssets: | |
1666 btfsc battery_gauge_available ; piezo buttons available? | |
1667 bra do_menu_syssets_piezo ; YES | |
1668 | |
1669 IFDEF _compass | |
1670 MENU_BEGIN tSystSets, .4 ; All MENU_CALLs in this menu | |
1671 MENU_CALL tCompassMenu, do_menu_compass ; need to stay together on this | |
1672 MENU_CALL tLogOffset, do_menu_log_offset ; menu level in order to not | |
1673 MENU_CALL tResetMenu, do_menu_reset ; mess up the menu stack on doing | |
1674 MENU_CALL tBack, do_return_menu_settings ; the do_return_menu_settings ! | |
582 | 1675 MENU_END |
634 | 1676 ELSE |
1677 MENU_BEGIN tSystSets, .3 ; see above | |
1678 MENU_CALL tLogOffset, do_menu_log_offset ; | |
1679 MENU_CALL tResetMenu, do_menu_reset ; | |
1680 MENU_CALL tBack, do_return_menu_settings ; | |
1681 MENU_END | |
1682 ENDIF ; _compass | |
1683 | |
1684 do_menu_syssets_piezo: | |
1685 IFDEF _compass | |
1686 MENU_BEGIN tSystSets, .5 | |
1687 MENU_CALL tCompassMenu, do_menu_compass ; see above | |
1688 MENU_CALL tLogOffset, do_menu_log_offset ; | |
1689 MENU_CALL tResetMenu, do_menu_reset ; | |
1690 MENU_CALL tPiezo, do_menu_piezo ; | |
1691 MENU_CALL tBack, do_return_menu_settings ; | |
1692 MENU_END | |
1693 ELSE | |
1694 MENU_BEGIN tSystSets, .4 | |
1695 MENU_CALL tLogOffset, do_menu_log_offset ; see above | |
1696 MENU_CALL tResetMenu, do_menu_reset ; | |
1697 MENU_CALL tPiezo, do_menu_piezo ; | |
1698 MENU_CALL tBack, do_return_menu_settings ; | |
1699 MENU_END | |
1700 ENDIF | |
220
effd7259f5a5
make button sensitivity configurable (cR hardware)
heinrichsweikamp
parents:
218
diff
changeset
|
1701 |
effd7259f5a5
make button sensitivity configurable (cR hardware)
heinrichsweikamp
parents:
218
diff
changeset
|
1702 |
623 | 1703 IFDEF _compass |
1704 | |
634 | 1705 ;----------------------------------------------------------------------------- |
1706 ; Settings Menu - 3rd Layer - System Settings - Compass | |
1707 ; | |
1708 do_menu_compass: | |
631 | 1709 MENU_BEGIN tCompassMenu, .5 |
634 | 1710 MENU_CALL tCompassCalibration, do_compass_calibration |
1711 ; MENU_OPT_INC tCompassGain, oCompassGain | |
1712 MENU_DYNAMIC dyn_compass_cal_x, 0 | |
1713 MENU_DYNAMIC dyn_compass_cal_y, 0 | |
1714 MENU_DYNAMIC dyn_compass_cal_z, 0 | |
1715 MENU_CALL tBack, do_return_menu_syssets_more | |
582 | 1716 MENU_END |
1717 | |
634 | 1718 |
1719 ;----------------------------------------------------------------------------- | |
1720 ; Call Function - start Compass Calibration | |
1721 ; | |
1722 do_compass_calibration: | |
1723 goto compass_calibration ; code hosted in compass_ops.asm | |
1724 | |
1725 | |
1726 ;----------------------------------------------------------------------------- | |
1727 ; dynamic Title - Calibration Value X | |
1728 ; | |
1729 dyn_compass_cal_x: | |
1730 STRCAT_TEXT tCalX ; print label | |
1731 lfsr FSR0,compass_CX_f ; address calibration value X | |
1732 bra dyn_compass_cal_common ; continue with common part | |
1733 | |
1734 | |
1735 ;----------------------------------------------------------------------------- | |
1736 ; dynamic Title - Calibration Value Y | |
1737 ; | |
1738 dyn_compass_cal_y: | |
1739 STRCAT_TEXT tCalY ; print label | |
1740 lfsr FSR0,compass_CY_f ; address calibration value Y | |
1741 bra dyn_compass_cal_common ; continue with common part | |
1742 | |
1743 | |
1744 ;----------------------------------------------------------------------------- | |
1745 ; dynamic Title - Calibration Value Z | |
1746 ; | |
1747 dyn_compass_cal_z: | |
1748 STRCAT_TEXT tCalZ ; print label | |
1749 lfsr FSR0,compass_CZ_f ; address calibration value Z | |
1750 ;bra dyn_compass_cal_common ; continue with common part | |
1751 | |
1752 | |
1753 ;----------------------------------------------------------------------------- | |
1754 ; Helper Function to dynamic Titles - Calibration Value | |
1755 ; | |
1756 dyn_compass_cal_common: | |
1757 movff POSTINC0,lo ; read calibration value, low byte | |
1758 movff POSTINC0,hi ; read calibration value, high byte | |
1759 PUTC ':' ; print ":" | |
1760 PUTC ' ' ; print a space | |
1761 call convert_signed_16bit ; convert lo:hi into signed-short and adds '-' to POSTINC2 if required | |
1762 btfsc neg_flag ; value negative? | |
1763 bra dyn_compass_cal_common_1 ; YES - print value | |
1764 PUTC '+' ; NO - add a plus sign | |
1765 dyn_compass_cal_common_1: | |
1766 output_65535 ; print value | |
1767 return ; done | |
1768 | |
623 | 1769 ENDIF ; _compass |
1770 | |
18
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
1771 |
634 | 1772 ;----------------------------------------------------------------------------- |
1773 ; Settings Menu - 3rd Layer - System Settings - Logbook Offset | |
1774 ; | |
1775 do_menu_log_offset: | |
63 | 1776 |
634 | 1777 clrf WREG ; select an initial step size of 1 |
1778 movff WREG,opt_logoffset_step ; bank-safe write to option variable (volatile option) | |
0 | 1779 |
634 | 1780 MENU_BEGIN tLogOffset, .5 |
1781 MENU_DYNAMIC dyn_logoffset_show_value, 0 | |
1782 MENU_OPT_INC tLogOffStepSize, oLogOffsetStep | |
1783 MENU_CALL tLogOffsetplus, do_log_offset_plus | |
1784 MENU_CALL tLogOffsetminus, do_log_offset_minus | |
1785 MENU_CALL tBack, do_return_menu_syssets_more | |
582 | 1786 MENU_END |
1787 | |
0 | 1788 |
634 | 1789 ;----------------------------------------------------------------------------- |
1790 ; dynamic Title - show Logbook Offset | |
1791 ; | |
1792 dyn_logoffset_show_value: | |
1793 STRCPY_TEXT tLogOffsetValue ; print "Offset" in selected language | |
1794 call eeprom_log_offset_read ; read offset into lo:hi | |
1795 output_9999 ; print offset (0-9999) | |
1796 return ; no "_PRINT" here... | |
0 | 1797 |
1798 | |
634 | 1799 ;----------------------------------------------------------------------------- |
1800 ; Call Function - increment Logbook Offset | |
1801 ; | |
1802 do_log_offset_plus: | |
1803 rcall do_logoffset_common ; load current offset and step size | |
1804 ; add step size to current offset | |
1805 movf mpr+2,W ; get step size, low byte | |
1806 addwf mpr+0,F ; add to offset, low byte | |
1807 movf mpr+3,W ; get step size, high byte | |
1808 addwfc mpr+1,F ; add to offset, high byte, considering carry flag | |
1809 ; check if new offset is within limit | |
1810 MOVLI .9999,sub_a ; load max limit into sub_a | |
1811 MOVII mpr, sub_b ; copy new offset into sub_b | |
1812 call cmpU16 ; compute sub_a - sub_b, setting neg_flag if result becomes negative | |
1813 btfss neg_flag ; neg_flag set, i.e. new offset > 9999 ? | |
1814 bra do_logoffset_exit ; NO - store offset and return | |
1815 MOVLI .9999,mpr ; YES - limit offset to 9999 | |
1816 bra do_logoffset_exit ; - store offset and return | |
582 | 1817 |
0 | 1818 |
634 | 1819 ;----------------------------------------------------------------------------- |
1820 ; Call Function - decrement Logbook Offset | |
1821 ; | |
1822 do_log_offset_minus: | |
1823 rcall do_logoffset_common ; load current offset and step size | |
1824 ; subtract step size from current offset | |
1825 movf mpr+2,W ; get step size, low byte | |
1826 subwf mpr+0,F ; subtract from offset, low byte | |
1827 movf mpr+3,W ; get step size, high byte | |
1828 subwfb mpr+1,F ; subtract from offset, high byte, considering borrow flag | |
1829 ; check if new offset is within limit | |
1830 btfsc STATUS,C ; borrow to propagate (B == /CARRY) ? | |
1831 bra do_logoffset_exit ; NO - result >= 0, store and return | |
1832 ;bra do_logoffset_reset ; YES - revert offset to 0 | |
0 | 1833 |
1834 | |
634 | 1835 ;----------------------------------------------------------------------------- |
1836 ; Helper Functions - Logbook Offset Reset & Write-Back | |
1837 ; | |
1838 do_logoffset_reset: | |
1839 CLRI mpr ; set offset to 0 | |
1840 do_logoffset_exit: | |
1841 goto eeprom_log_offset_write ; store offset and return | |
1842 | |
1843 | |
1844 ;----------------------------------------------------------------------------- | |
1845 ; Helper Function - compute Step Size | |
1846 ; | |
623 | 1847 do_logoffset_common: |
631 | 1848 call eeprom_log_offset_read ; read current offset into mpr+1:mpr+0 |
623 | 1849 movff opt_logoffset_step,ul ; get step size: 0=1, 1=10, 2=100, 3=1000 |
1850 incf ul,F ; 0...3 -> 1...4 | |
1851 clrf mpr+3 ; clear step size, high byte | |
1852 movlw .1 ; set a step size of 1 | |
1853 movwf mpr+2 ; copy to step size, low byte | |
1854 dcfsnz ul,F ; ul--, did ul became 0, i.e. step size = 1 ? | |
1855 return ; YES - done | |
1856 movlw .10 ; NO - set a step size of 10 | |
1857 movwf mpr+2 ; - copy to step size, low byte | |
1858 dcfsnz ul,F ; ul--, did ul became 0, i.e. step size = 10 ? | |
1859 return ; YES - done | |
1860 movlw .100 ; NO - set a step size of 100 | |
1861 movwf mpr+2 ; - copy to step size, low byte | |
1862 dcfsnz ul,F ; ul--, did ul became 0, i.e. step size = 100 ? | |
1863 return ; YES - done | |
634 | 1864 movlw LOW .1000 ; NO - set a step size of 1000, low byte |
1865 movwf mpr+2 ; - copy to step size, low byte | |
623 | 1866 movlw HIGH .1000 ; - set a step size of 1000, high byte |
1867 movwf mpr+3 ; - copy to step size, high byte | |
1868 return ; - done | |
0 | 1869 |
1870 | |
634 | 1871 ;----------------------------------------------------------------------------- |
1872 ; Settings Menu - 3rd Layer - System Settings - adjust Piezo Buttons | |
1873 ; | |
1874 do_menu_piezo: | |
640 | 1875 MENU_BEGIN tPiezo, .5 |
1876 MENU_CALL tButtonExplain1, 0 | |
1877 MENU_CALL tButtonExplain2, 0 | |
634 | 1878 MENU_OPT_INC tButtonleft, ocR_button_left ; left button sensitivity |
1879 MENU_OPT_INC tButtonright, ocR_button_right ; right button sensitivity | |
1880 MENU_CALL tBack, do_return_menu_syssets_piezo | |
1881 MENU_END | |
623 | 1882 |
0 | 1883 |
634 | 1884 ;----------------------------------------------------------------------------- |
1885 ; Settings Menu - 3rd Layer - System Settings - Reset Menus | |
1886 ; | |
1887 do_menu_reset: | |
648 | 1888 MENU_BEGIN tResetMenu, .7 |
634 | 1889 MENU_CALL tBack, do_return_menu_syssets_more |
1890 MENU_CALL tReboot, do_menu_reset_reboot ; confirm | |
1891 MENU_CALL tResetDeco, do_menu_reset_deco ; confirm | |
1892 MENU_CALL tResetSettings, do_menu_reset_settings ; confirm | |
1893 MENU_CALL tResetLogbook, do_menu_reset_logbook ; confirm | |
1894 MENU_CALL tResetBattery, do_menu_reset_battery ; confirm | |
648 | 1895 MENU_CALL tResetBLE2, do_menu_reset_ble2 ; Configure the new BLE module |
634 | 1896 MENU_END |
0 | 1897 |
634 | 1898 |
1899 ;----------------------------------------------------------------------------- | |
1900 ; Settings Menu - 4th Layer - System Settings - Reset - Reboot / FW Recovery | |
1901 ; | |
1902 do_menu_reset_reboot: | |
1903 IFDEF _firmware_recovery | |
1904 MENU_BEGIN tResetMenu2, .4 | |
1905 MENU_CALL tAbort, do_return_menu_syssets_more_more | |
1906 MENU_CALL tRebootCurFirmware, do_reboot ; reboot current firmware | |
1907 MENU_DYNAMIC dyn_menu_fw_backup, do_firmware_backup ; backup current firmware | |
1908 MENU_DYNAMIC dyn_menu_fw_restore, do_firmware_restore ; restore backup firmware | |
582 | 1909 MENU_END |
604 | 1910 ELSE |
634 | 1911 MENU_BEGIN tResetMenu2, .2 |
1912 MENU_CALL tAbort, do_return_menu_syssets_more_more | |
1913 MENU_CALL tReboot, do_reboot ; reboot (cold start) | |
604 | 1914 MENU_END |
1915 ENDIF | |
582 | 1916 |
335
3d43da7acfe1
Always show ppO2 (warning position, standard color) option
janos_kovacs <kovjanos@gmail.com>
parents:
333
diff
changeset
|
1917 |
634 | 1918 ;----------------------------------------------------------------------------- |
1919 ; Call Function - Reboot | |
1920 ; | |
1921 do_reboot: | |
1922 call ext_flash_enable_protection ; set write protection on external flash | |
1923 call eeprom_deco_data_write ; update deco data in EEPROM | |
1924 call eeprom_battery_gauge_write ; update battery gauge in EEPROM | |
1925 btfsc option_changed ; do the options need to be stored to EEPROM ? | |
1926 call option_check_and_store_all ; YES - check and store all option values in EEPROM | |
1927 reset ; cold-start the processor | |
1928 | |
1929 | |
1930 IFDEF _firmware_recovery | |
1931 | |
1932 ;----------------------------------------------------------------------------- | |
1933 ; dynamic Title - Firmware Backup Option | |
1934 ; | |
1935 dyn_menu_fw_backup: | |
1936 EEPROM_CC_READ eeprom_fw_chksum_current+.5,WREG ; read stored FW ID | |
1937 xorlw FW_ID ; XOR with current FW ID, equal? | |
1938 bnz dyn_menu_fw_backup_unable ; NO - unable to make a backup | |
1939 STRCPY_TEXT tBackupFirmware ; YES - print "Backup current Firmware" | |
1940 return ; - done | |
1941 dyn_menu_fw_backup_unable: | |
1942 STRCPY "-------" ; print dashes | |
1943 return ; done | |
1944 | |
1945 | |
1946 ;----------------------------------------------------------------------------- | |
1947 ; dynamic Title - Firmware Restore Option | |
1948 ; | |
1949 dyn_menu_fw_restore: | |
1950 STRCPY_TEXT tRecoverFirmware ; print "Recover" | |
1951 PUTC " " ; add a space | |
1952 PUTC "V" ; add a V for Version | |
1953 movlw 0x3C ; address firmware version in backup storage at 0x3C000A | |
1954 movwf ext_flash_address+2 ; ... | |
1955 clrf ext_flash_address+1 ; ... | |
1956 movlw 0x0A ; ... | |
1957 movwf ext_flash_address+0 ; ... | |
1958 FLASH_RR_READ mpr,.3 ; read backup firmware version (lo: major, hi: minor, up: beta) | |
1959 infsnz lo,W ; major = 0xFF ? | |
1960 bra dyn_menu_fw_restore_inop ; YES - no version to show | |
1961 bsf leftbind ; NO - print left-aligned | |
1962 output_99 ; - print major (0-99) | |
1963 PUTC '.' ; - add a dot | |
1964 movff hi,lo ; - get minor | |
1965 output_99x ; - print minor (00-99) | |
1966 PUTC ' ' ; - add a space | |
1967 movff up,lo ; - get beta/release | |
1968 tstfsz lo ; - release version? | |
1969 bra dyn_menu_fw_restore_beta ; - NO - beta | |
1970 STRCAT "Rel." ; - YES - append "Rel(ease)" | |
1971 return ; - done | |
1972 dyn_menu_fw_restore_beta: | |
1973 PUTC 'B' ; append "B(eta)" | |
1974 bsf leftbind ; print left-aligned | |
1975 output_256 ; print beta version (0-255) | |
1976 return ; done | |
1977 dyn_menu_fw_restore_inop: | |
1978 STRCAT "--.--" ; no recovery firmware available | |
1979 return ; done | |
1980 | |
1981 | |
1982 ;----------------------------------------------------------------------------- | |
1983 ; Call Function - backup Firmware | |
1984 ; | |
1985 do_firmware_backup: | |
1986 EEPROM_CC_READ eeprom_fw_chksum_current+.5,WREG ; read stored FW ID | |
1987 xorlw FW_ID ; XOR with current FW ID, equal? | |
1988 bnz do_firmware_abort ; NO - abort | |
1989 call TFT_ClearScreen ; YES - clear the screen | |
1990 WIN_SMALL .0, .100 ; - set position | |
1991 STRCPY_TEXT_PRINT tBackingUp ; - print "backing up..." | |
1992 call copy_fw_active_to_backup ; - copy 0x3Exxxx -> 0x3Cxxxx | |
1993 EEPROM_RR_READ eeprom_fw_chksum_current,buffer,.6 ; - retrieve checksum of current firmware | |
1994 EEPROM_RR_WRITE buffer,eeprom_fw_chksum_recovry,.6 ; - store as checksum of recovery firmware | |
1995 bra do_return_menu_syssets_more_more ; - done | |
1996 | |
1997 | |
1998 ;----------------------------------------------------------------------------- | |
1999 ; Call Function - restore Firmware | |
2000 ; | |
2001 do_firmware_restore: | |
2002 EXT_FLASH_ADDR 0x3C000A ; address firmware version in backup storage at 0x3C000A | |
2003 FLASH_CW_READ_0x40 ; read backup firmware major version into WREG | |
2004 infsnz WREG ; major = 0xFF ? | |
2005 bra do_firmware_abort ; YES - abort, no firmware available for restoration | |
2006 call TFT_ClearScreen ; NO - clear the screen | |
2007 WIN_SMALL .0, .100 ; - set position | |
2008 STRCPY_TEXT_PRINT tRestoring ; - print "restoring..." | |
2009 call copy_fw_backup_to_active ; - copy 0x3Cxxxx -> 0x3Exxxx | |
2010 EEPROM_RR_READ eeprom_fw_chksum_recovry,buffer,.6 ; - retrieve checksum of recovery firmware | |
2011 EEPROM_RR_WRITE buffer,eeprom_fw_chksum_current,.6 ; - store as checksum of current firmware (to be) | |
2012 goto comm_firmware_update_exec ; - initiate firmware update | |
2013 | |
2014 | |
2015 ;----------------------------------------------------------------------------- | |
2016 ; Helper Function - back to same menu | |
2017 ; | |
2018 do_firmware_abort: | |
2019 call menu_processor_pop ; back to last line | |
2020 bra do_menu_reset_reboot ; back to same menu | |
2021 | |
623 | 2022 ENDIF |
0 | 2023 |
582 | 2024 |
634 | 2025 ;----------------------------------------------------------------------------- |
2026 ; Settings Menu - 4th Layer - System Settings - Reset - Reset Deco | |
2027 ; | |
2028 do_menu_reset_deco: | |
2029 MENU_BEGIN tResetMenu2, .2 | |
2030 MENU_CALL tAbort, do_return_menu_syssets_more_more | |
2031 MENU_CALL tResetDeco, do_reset_deco ; reset deco and return to main reset menu | |
2032 MENU_END | |
2033 | |
582 | 2034 |
634 | 2035 ;----------------------------------------------------------------------------- |
2036 ; Call Function - Reset Deco | |
2037 ; | |
2038 do_reset_deco: | |
2039 call deco_clear_tissue ; set all tissues to absolute pressure * N2_ratio (C-code) | |
2040 call deco_calc_dive_interval_1min; update tissues by 1 minute to calculate current GF factor (C-code) | |
2041 call deco_calc_desaturation_time ; calculate desaturation and no-fly/no-altitude time (C-code) | |
2042 banksel common | |
2043 call eeprom_deco_data_write ; store updated deco data into EEPROM | |
2044 bra do_return_menu_syssets_more_more | |
2045 | |
2046 | |
2047 ;----------------------------------------------------------------------------- | |
2048 ; Settings Menu - 4th Layer - System Settings - Reset - Reset Settings | |
2049 ; | |
2050 do_menu_reset_settings: | |
2051 MENU_BEGIN tResetMenu2, .2 | |
2052 MENU_CALL tAbort, do_return_menu_syssets_more_more | |
2053 MENU_CALL tResetSettings, do_reset_settings ; reset all settings and go to surface mode | |
582 | 2054 MENU_END |
50 | 2055 |
2056 | |
634 | 2057 ;----------------------------------------------------------------------------- |
2058 ; Call Function - Reset Settings | |
2059 ; | |
2060 do_reset_settings: | |
2061 call TFT_ClearScreen ; clear screen to show start of activity | |
2062 call option_reset_all ; reset all options to factory default | |
2063 call do_logoffset_reset ; reset log offset | |
2064 goto restart ; restart into surface mode | |
0 | 2065 |
634 | 2066 |
2067 ;----------------------------------------------------------------------------- | |
2068 ; Settings Menu - 4th Layer - System Settings - Reset - Reset Logbook | |
2069 ; | |
2070 do_menu_reset_logbook: | |
2071 MENU_BEGIN tResetMenu2, .2 | |
2072 MENU_CALL tAbort, do_return_menu_syssets_more_more | |
2073 MENU_CALL tResetLogbook, do_reset_logbook ; reset logbook and return to main reset menu | |
582 | 2074 MENU_END |
2075 | |
623 | 2076 |
634 | 2077 ;----------------------------------------------------------------------------- |
2078 ; Call Function - Reset Logbook | |
2079 ; | |
2080 do_reset_logbook: | |
2081 call erase_complete_logbook ; erase complete logbook | |
2082 bra do_return_menu_syssets_more_more | |
2083 | |
2084 | |
2085 ;----------------------------------------------------------------------------- | |
2086 ; Settings Menu - 4th Layer - System Settings - Reset - Reset Battery | |
2087 ; | |
2088 do_menu_reset_battery: | |
2089 MENU_BEGIN tNewBattTitle, .2 | |
2090 MENU_CALL tAbort, do_return_menu_syssets_more_more | |
2091 MENU_CALL tYes, do_new_battery_select | |
2092 MENU_END | |
648 | 2093 |
2094 ;----------------------------------------------------------------------------- | |
2095 ; Settings Menu - 4th Layer - System Settings - Reset - Reset BLE2 | |
2096 ; | |
2097 do_menu_reset_ble2: | |
2098 call TFT_ClearScreen ; clear screen to show start of activity | |
2099 call ble2_configure | |
2100 goto surfloop ; restart into surface mode | |
634 | 2101 |
2102 | |
2103 ;----------------------------------------------------------------------------- | |
2104 ; Entry Point for Battery Selection after Power-Outage | |
2105 ; | |
2106 global new_battery_select | |
2107 new_battery_select: | |
623 | 2108 call TFT_boot ; initialize TFT (includes clear screen) |
640 | 2109 call TFT_load_std_color_pallet ; load standard color pallet |
623 | 2110 call TFT_Display_FadeIn ; dim up the display |
2111 call menu_processor_reset ; reset menu stack | |
634 | 2112 ;bra do_new_battery_select ; enter menu system |
623 | 2113 |
2114 | |
634 | 2115 ;----------------------------------------------------------------------------- |
2116 ; Settings Menu - 5th Layer - System Settings - Reset - Reset - Battery Selection | |
2117 ; | |
2118 do_new_battery_select: | |
2119 movlw .100 ; set battery level to full | |
2120 movwf batt_percent ; ... | |
2121 ; default (in cases of timeout or USB) to use old battery: | |
631 | 2122 call eeprom_battery_gauge_read ; retrieve stored battery gauge value from EEPROM |
604 | 2123 |
2124 IFDEF _screendump | |
623 | 2125 bsf screen_dump_avail ; enable screen dump function to prevent exiting into COMM mode immediately |
604 | 2126 ELSE |
623 | 2127 bsf comm_mode_disabled ; disable COMM mode to prevent exiting into COMM mode immediately |
604 | 2128 ENDIF |
2129 | |
623 | 2130 ; hardware descriptor: user changeable battery charger supported battery types |
614 | 2131 ; ------------------------------------------------------------------------------------------------------------------------------------------------------- |
623 | 2132 ; 0x11: BLE and battery gauge ---> OSTC 2 (old model) NO YES internal 18650 |
2133 ; 0x05: analog input and battery gauge ---> OSTC 2 cR NO YES internal 18650 | |
640 | 2134 ; 0x15: BLE and analog input and battery gauge ---> OSTC 2 cR (2020 model) NO YES internal 18650 |
623 | 2135 ; 0x33: BLE and RX module and ambient sensor and battery gauge ---> OSTC 2 TR NO YES internal 16650 |
2136 ; 0x13: BLE and ambient sensor and battery gauge -+-> OSTC 2 (new model) NO YES internal 16650 | |
2137 ; +-> OSTC Plus YES YES 1.5V ----- NO! ----- 3.6V rechargeable | |
2138 ; 0x0A: optical input and ambient sensor ---> OSTC 3 (USB model) YES NO 1.5V 3.6V disposable 3.6V rechargeable | |
2139 ; 0x1A: BLE and optical input and ambient sensor ---> OSTC 3 (BLE model) YES NO 1.5V 3.6V disposable 3.6V rechargeable | |
2140 ; 0x02: ambient sensor ---> OSTC Sport (USB model) YES NO 1.5V 3.6V disposable 3.6V rechargeable | |
2141 ; 0x52: BLE and ambient sensor and low volt core ---> OSTC Sport (BLE model) YES NO 1.5V 3.6V disposable 3.6V rechargeable | |
614 | 2142 |
635
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2143 movlw 0x11 ; OSTC 2 (2015 model) |
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2144 cpfseq HW_descriptor |
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2145 bra $+4 |
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2146 bra use_18650_battery |
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2147 |
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2148 movlw 0x91 ; OSTC 2 (2015 model) with block write |
623 | 2149 cpfseq HW_descriptor |
614 | 2150 bra $+4 |
623 | 2151 bra use_18650_battery |
614 | 2152 |
623 | 2153 movlw 0x05 ; OSTC 2 cR |
2154 cpfseq HW_descriptor | |
614 | 2155 bra $+4 |
623 | 2156 bra use_18650_battery |
76 | 2157 |
640 | 2158 movlw 0x15 ; OSTC 2 cR (2020 model) |
2159 cpfseq HW_descriptor | |
2160 bra $+4 | |
2161 bra use_18650_battery | |
2162 | |
2163 | |
635
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2164 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
|
2165 cpfseq HW_descriptor |
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2166 bra $+4 |
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2167 bra use_18650_battery |
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2168 |
9a64914a8fca
3.10 re-release addressing some minor issues and language fixes
heinrichsweikamp
parents:
634
diff
changeset
|
2169 movlw 0xB3 ; OSTC 2 TR |
623 | 2170 cpfseq HW_descriptor |
614 | 2171 bra $+4 |
634 | 2172 bra do_use_16650_battery |
614 | 2173 |
637 | 2174 movlw 0x93 ; OSTC Plus and OSTC 2 (2017 model) |
623 | 2175 cpfseq HW_descriptor |
614 | 2176 bra $+4 |
634 | 2177 bra do_menu_new_battery_AA_charger |
614 | 2178 |
640 | 2179 movlw 0x13 ; OSTC Plus and OSTC 2 (2017 model), w/o block write |
623 | 2180 cpfseq HW_descriptor |
614 | 2181 bra $+4 |
634 | 2182 bra do_menu_new_battery_AA_charger |
614 | 2183 |
623 | 2184 |
640 | 2185 movlw 0x0A ; OSTC 3 (USB model) |
2186 cpfseq HW_descriptor | |
2187 bra $+4 | |
2188 bra do_menu_new_battery_AA_no_charge | |
2189 | |
2190 movlw 0x1A ; OSTC 3 (BLE model) | |
2191 cpfseq HW_descriptor | |
2192 bra $+4 | |
2193 bra do_menu_new_battery_AA_no_charge | |
614 | 2194 |
640 | 2195 movlw 0x02 ; OSTC Sport (USB model) |
2196 cpfseq HW_descriptor | |
2197 bra $+4 | |
2198 bra do_menu_new_battery_AA_no_charge | |
614 | 2199 |
640 | 2200 movlw 0x52 ; OSTC Sport (BLE model) |
2201 cpfseq HW_descriptor | |
2202 bra $+4 | |
2203 bra do_menu_new_battery_AA_no_charge | |
623 | 2204 |
640 | 2205 bra do_menu_new_battery_other_model ; any other model |
582 | 2206 |
614 | 2207 |
634 | 2208 ;----------------------------------------------------------------------------- |
2209 ; return from confirm 3.6 V rechargeable | |
2210 ; | |
623 | 2211 do_return_menu_new_bat_AA_chrg: |
634 | 2212 call menu_processor_double_pop ; drop exit line and back to last line |
2213 ;bra do_menu_new_battery_AA_charger ; continue | |
614 | 2214 |
634 | 2215 ;----------------------------------------------------------------------------- |
640 | 2216 ; Battery Selection for OSTC (Full selection) |
2217 | |
2218 do_menu_new_battery_other_model: | |
2219 MENU_BEGIN tNewBattTitle, .6 | |
2220 MENU_CALL tNewBattOld, do_use_old_battery ; load data of old battery | |
2221 MENU_CALL tNewBattNew15, do_use_15V_disposable ; not rechargeable | |
2222 MENU_CALL tNewBattNew36, do_use_36V_disposable ; not rechargeable | |
2223 MENU_CALL tNewBattAccu, do_menu_new_battery_36V_charge ; rechargeable -> goto safety question | |
2224 MENU_CALL tNew16650, do_use_16650_battery ; OSTC 2 new model | |
2225 MENU_CALL tNew18650, use_18650_battery ; OSTC 2 (2015 model) | |
2226 MENU_END | |
2227 | |
2228 ;----------------------------------------------------------------------------- | |
634 | 2229 ; Battery Selection for OSTC Plus (charging function) TODO: and OSTC 2 new model as of now |
2230 ; | |
2231 do_menu_new_battery_AA_charger: | |
614 | 2232 MENU_BEGIN tNewBattTitle, .4 |
634 | 2233 MENU_CALL tNewBattOld, do_use_old_battery ; load data of old battery |
2234 MENU_CALL tNewBattNew15, do_use_15V_disposable ; not rechargeable | |
2235 ; MENU_CALL tNewBattNew36, do_use_36V_disposable ; not rechargeable -> not allowed any more !!! | |
2236 MENU_CALL tNewBattAccu, do_menu_new_battery_36V_charge ; rechargeable -> goto safety question | |
2237 MENU_CALL tNew16650, do_use_16650_battery ; OSTC 2 new model TODO: remove when OSTC 2 new model can be separated from Plus | |
614 | 2238 MENU_END |
2239 | |
634 | 2240 |
2241 ;----------------------------------------------------------------------------- | |
2242 ; Safety Question for 3.6 V rechargeable Battery | |
2243 ; | |
2244 do_menu_new_battery_36V_charge: | |
614 | 2245 MENU_BEGIN tNewBattTitle, .5 |
2246 MENU_CALL tConfirmChargeable1, 0 ; safety question, line 1 | |
2247 MENU_CALL tConfirmChargeable2, 0 ; safety question, line 2 | |
2248 MENU_CALL tConfirmChargeable3, 0 ; safety question, line 3 | |
623 | 2249 MENU_CALL tNo, do_return_menu_new_bat_AA_chrg ; NO - go back |
634 | 2250 MENU_CALL tYes, do_use_36V_chargeable ; YES - confirmed rechargeable |
623 | 2251 MENU_END |
2252 | |
634 | 2253 |
2254 ;----------------------------------------------------------------------------- | |
2255 ; Battery Selection for OSTC 3 and Sport (no charging function) | |
2256 ; | |
2257 do_menu_new_battery_AA_no_charge: | |
623 | 2258 MENU_BEGIN tNewBattTitle, .4 |
634 | 2259 MENU_CALL tNewBattOld, do_use_old_battery ; load data of old battery |
2260 MENU_CALL tNewBattNew15, do_use_15V_disposable ; not rechargeable | |
2261 MENU_CALL tNewBattNew36, do_use_36V_disposable ; not rechargeable | |
2262 MENU_CALL tNewBattAccu, do_use_36V_chargeable ; rechargeable | |
582 | 2263 MENU_END |
0 | 2264 |
582 | 2265 |
634 | 2266 ;----------------------------------------------------------------------------- |
2267 ; Call Function - keep old Battery | |
2268 ; | |
2269 do_use_old_battery: | |
2270 rcall get_battery_data ; load data of old battery | |
2271 goto surfloop ; proceed to surface mode | |
2272 | |
2273 | |
2274 ;----------------------------------------------------------------------------- | |
2275 ; Call Function - new 1.5 V disposable | |
2276 ; | |
2277 do_use_15V_disposable: | |
2278 rcall setup_new_15v | |
2279 bra use_batt_exit | |
2280 | |
2281 | |
2282 ;----------------------------------------------------------------------------- | |
2283 ; Call Function - new 3.6 V disposable | |
2284 ; | |
2285 do_use_36V_disposable: | |
2286 rcall setup_new_saft | |
2287 bra use_batt_exit | |
2288 | |
2289 | |
2290 ;----------------------------------------------------------------------------- | |
2291 ; Call Function - new 3.6 V rechargeable | |
2292 ; | |
2293 do_use_36V_chargeable: | |
2294 rcall setup_new_panasonic | |
2295 call reset_battery_gauge | |
2296 bra use_batt_exit_1 | |
2297 | |
2298 | |
2299 ;----------------------------------------------------------------------------- | |
2300 ; Call Function - build-in 16650 | |
2301 ; | |
2302 do_use_16650_battery: | |
2303 rcall setup_new_16650 | |
2304 bra use_batt_exit | |
2305 | |
2306 | |
2307 ;----------------------------------------------------------------------------- | |
2308 ; Call Function - build-in 18650 | |
2309 ; | |
2310 use_18650_battery: | |
2311 rcall setup_new_18650 | |
2312 ;bra use_batt_exit | |
2313 | |
2314 | |
2315 ;----------------------------------------------------------------------------- | |
2316 ; Helper Function - finish Battery Selection | |
2317 ; | |
2318 use_batt_exit: | |
2319 call reset_battery_gauge_and_lt2942 ; reset battery hard- and software gauge | |
2320 | |
2321 use_batt_exit_1: | |
2322 IFNDEF _screendump | |
2323 bcf comm_mode_disabled ; re-enable COMM mode again | |
2324 ENDIF | |
2325 goto surfloop ; exit to surface mode | |
2326 | |
2327 | |
2328 ;----------------------------------------------------------------------------- | |
2329 ; Migrate Battery Selection from Firmwares prior 2.09 | |
2330 ; | |
457 | 2331 global use_old_prior_209 |
2332 use_old_prior_209: | |
631 | 2333 EEPROM_CC_READ eeprom_battery_type,WREG ; read battery type from EEPROM |
2334 incfsz WREG,W ; battery type = 0xFF (undefined) ? | |
2335 return ; NO - done | |
2336 call lt2942_get_status ; YES - check for gauge IC | |
2337 movlw .3 ; - default to a 18650 (LiIon 3.7V/3.1Ah) | |
2338 btfss battery_gauge_available ; - OSTC 2 or cR hardware? | |
2339 movlw .1 ; - NO - assume a Saft (disposable 3.6 V) | |
2340 EEPROM_CC_WRITE WREG,eeprom_battery_type; - write battery type to EEPROM | |
2341 return ; - done | |
582 | 2342 |
2343 | |
634 | 2344 ;----------------------------------------------------------------------------- |
2345 ; Retrieve Battery Selection from EEPROM | |
2346 ; | |
623 | 2347 global get_battery_data |
2348 get_battery_data: | |
631 | 2349 call eeprom_battery_gauge_read ; retrieve stored battery gauge value from EEPROM |
623 | 2350 movff battery_type,lo ; copy retrieved battery type to lo |
2351 rcall setup_new_saft ; default battery configuration | |
2352 incf lo,F ; (0-4) -> (1-5) | |
2353 dcfsnz lo,F | |
2354 rcall setup_new_15v ; =0 | |
2355 dcfsnz lo,F | |
2356 rcall setup_new_saft ; =1 | |
2357 dcfsnz lo,F | |
2358 rcall setup_new_panasonic ; =2 | |
2359 dcfsnz lo,F | |
2360 rcall setup_new_18650 ; =3 | |
2361 dcfsnz lo,F | |
2362 rcall setup_new_16650 ; =4 | |
2363 bcf use_old_batt_flag ; clear flag | |
2364 IFNDEF _screendump | |
2365 bcf comm_mode_disabled ; re-enable COMM mode again | |
2366 ENDIF | |
2367 return ; done | |
2368 | |
2369 | |
634 | 2370 ;----------------------------------------------------------------------------- |
2371 ; Helper Functions - configure Battery Types | |
2372 | |
623 | 2373 ; 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
|
2374 setup_new_15v: |
623 | 2375 bsf charge_disable ; set charging-inhibit signal |
2376 bcf charge_enable ; activate charging-inhibit signal | |
582 | 2377 movlw .100 |
604 | 2378 movwf batt_percent ; to have 1.5V batteries right after firmware update |
582 | 2379 movlw .0 |
623 | 2380 movwf battery_type |
2381 return | |
2382 | |
2383 ; disposable 3.6 Volt Lithium | |
2384 setup_new_saft: | |
2385 bsf charge_disable ; set charging-inhibit signal | |
2386 bcf charge_enable ; activate charging-inhibit signal | |
2387 MOVLI capacity_saft_internal, battery_capacity_internal | |
2388 MOVLI capacity_saft, battery_capacity | |
2389 MOVLI offset_saft, battery_offset | |
2390 movlw .1 | |
2391 movwf battery_type | |
2392 return | |
2393 | |
2394 ; rechargeable user-changeable 3.7 Volt Lithium-ion | |
2395 setup_new_panasonic: | |
2396 bcf charge_disable ; release charging-inhibit signal | |
2397 bsf charge_enable ; tristate charging-inhibit signal | |
2398 MOVLI capacity_panasonic_internal, battery_capacity_internal | |
2399 MOVLI capacity_panasonic, battery_capacity | |
2400 MOVLI offset_panasonic, battery_offset | |
2401 movlw .2 | |
2402 movwf battery_type | |
2403 return | |
2404 | |
2405 ; rechargeable internal Lithium-ion | |
2406 setup_new_18650: | |
2407 bcf charge_disable ; release charging-inhibit signal | |
2408 bsf charge_enable ; tristate charging-inhibit signal | |
2409 CLRI battery_capacity_internal | |
2410 MOVLI capacity_ncr18650, battery_capacity | |
2411 MOVLI offset_ncr18650, battery_offset | |
2412 movlw .3 | |
2413 movwf battery_type | |
2414 return | |
2415 | |
2416 ; rechargeable internal Lithium-ion | |
2417 setup_new_16650: | |
2418 bcf charge_disable ; release charging-inhibit signal | |
2419 bsf charge_enable ; tristate charging-inhibit signal | |
2420 CLRI battery_capacity_internal | |
2421 MOVLI capacity_ur16650, battery_capacity | |
2422 MOVLI offset_ur16650, battery_offset | |
2423 movlw .4 | |
2424 movwf battery_type | |
582 | 2425 return |
2426 | |
623 | 2427 ;----------------------------------------------------------------------------- |
0 | 2428 |
623 | 2429 END |