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