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