Mercurial > public > hwos_code
annotate src/menu_tree.asm @ 622:02d1386429a6
0x60 added for (future) option to change logbook offset via PC/Bluetooth
author | heinrichsweikamp |
---|---|
date | Wed, 10 Apr 2019 10:51:07 +0200 |
parents | 7b3903536213 |
children | c40025d8e750 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
614 | 3 ; File menu_tree.asm REFACTORED VERSION V2.99g |
0 | 4 ; |
275 | 5 ; OSTC menus |
0 | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
10 ; 2011-07-11 : [jDG] Creation. | |
11 | |
604 | 12 #include "hwos.inc" ; mandatory header |
582 | 13 #include "gaslist.inc" |
14 #include "menu_processor.inc" | |
15 #include "start.inc" | |
16 #include "comm.inc" | |
17 #include "logbook.inc" | |
18 #include "tft.inc" | |
19 #include "eeprom_rs232.inc" | |
20 #include "external_flash.inc" | |
604 | 21 #include "shared_definitions.h" ; mailbox from/to p2_deco.c |
582 | 22 #include "isr.inc" |
23 #include "ghostwriter.inc" | |
24 #include "adc_lightsensor.inc" | |
25 #include "wait.inc" | |
26 #include "i2c.inc" | |
27 | |
0 | 28 |
582 | 29 extern do_demo_divemode |
30 extern restart | |
31 extern option_save_all | |
32 extern option_reset | |
33 extern do_demo_planner | |
34 extern calibrate_mix | |
35 extern comm_mode0 | |
36 extern piezo_config | |
37 extern compass_calibration_loop | |
38 extern option_reset_all | |
39 extern rtc_set_rtc | |
40 extern surfloop | |
41 extern oColorSetDive | |
604 | 42 extern option_cleanup_oCCRMode |
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
155
diff
changeset
|
43 |
582 | 44 |
604 | 45 menu_tree CODE |
582 | 46 |
0 | 47 ;============================================================================= |
48 ; Main Menu | |
582 | 49 |
50 do_return_main_menu: | |
604 | 51 call menu_processor_double_pop ; drop exit line and back to last line |
582 | 52 bra do_main_menu_common |
53 | |
54 global do_main_menu | |
0 | 55 do_main_menu: |
582 | 56 movff menupos3,customview_surfmode ; save last customview |
0 | 57 |
582 | 58 global do_main_menu2 |
59 do_main_menu2: ; entry point used by logbook.asm | |
60 call TFT_boot | |
61 bcf sleepmode ; for timeout | |
62 call menu_processor_reset ; restart from first icon | |
0 | 63 |
582 | 64 do_main_menu_common: |
65 MENU_BEGIN tMainMenu, .7 | |
66 MENU_CALL tLogbook, logbook | |
67 MENU_CALL tGasSetup, do_gas_menu | |
68 MENU_CALL tCCRSetup, do_ccr_menu | |
69 MENU_CALL tPlan, do_planner_menu | |
70 MENU_CALL tDiveModeMenu, do_divemode_menu | |
71 MENU_CALL tSystSets, do_settings_menu | |
72 MENU_CALL tExit, restart | |
73 MENU_END | |
74 | |
0 | 75 |
76 ;============================================================================= | |
77 ; CCR Setup | |
78 | |
582 | 79 do_return_ccr_menu: |
80 call menu_processor_double_pop ; drop exit line and back to last line | |
0 | 81 |
82 do_ccr_menu: | |
604 | 83 bcf menu_update_sensor_mv ; stop imprinting of live sensor values |
84 call option_cleanup_oCCRMode ; in pSCR mode, revert AutoSP (2) to calculated SP (0) | |
560 | 85 |
582 | 86 btfsc analog_o2_input |
87 bra do_ccr_menu_cR | |
88 | |
89 ; COMMENTED OUT - currently there is no difference between the OSTC 2 and 3 regarding this menu | |
90 ; btfss optical_input | |
91 ; bra do_ccr_menu_ostc2 | |
240 | 92 |
582 | 93 MENU_BEGIN tCCRSetup, .6 ; OSTC3 menu (and currently also the OSTC2 menu) |
94 MENU_OPTION tCCRMode, oCCRMode, 0 | |
95 MENU_CALL tDiluentSetup, do_diluent_setup | |
96 MENU_CALL tFixedSetpoints, do_fixed_setpoints | |
97 MENU_CALL tPSCRMenu, do_PSCR_menu | |
98 MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 | |
604 | 99 MENU_CALL tBack, do_return_main_menu |
582 | 100 MENU_END |
101 | |
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
155
diff
changeset
|
102 |
582 | 103 do_ccr_menu_cR: ; cR menu |
104 MENU_BEGIN tCCRSetup, .7 | |
105 MENU_OPTION tCCRMode, oCCRMode, 0 | |
106 MENU_CALL tCalibrateMenu, do_calibrate_menu | |
107 MENU_CALL tDiluentSetup, do_diluent_setup | |
108 MENU_CALL tFixedSetpoints, do_fixed_setpoints | |
109 MENU_CALL tPSCRMenu, do_PSCR_menu | |
110 MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 | |
604 | 111 MENU_CALL tBack, do_return_main_menu |
582 | 112 MENU_END |
0 | 113 |
582 | 114 ; COMMENTED OUT - currently there is no difference between the OSTC 2 and 3 regarding this menu |
560 | 115 ;do_ccr_menu_ostc2: |
582 | 116 ; MENU_BEGIN tCCRSetup, .6 ; ostc2 menu |
117 ; MENU_OPTION tCCRMode, oCCRMode, 0 | |
118 ; MENU_CALL tDiluentSetup, do_diluent_setup | |
119 ; MENU_CALL tFixedSetpoints, do_fixed_setpoints | |
120 ; MENU_CALL tPSCRMenu, do_PSCR_menu | |
121 ; MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 | |
604 | 122 ; MENU_CALL tBack, do_return_main_menu |
582 | 123 ; MENU_END |
240 | 124 |
125 | |
113 | 126 do_calibrate_menu: |
604 | 127 call enable_ir_s8 ; enable IR/S8-Port |
128 bsf menu_update_sensor_mv ; start imprinting of live sensor values | |
582 | 129 |
113 | 130 do_calibrate_menu2: |
582 | 131 MENU_BEGIN tCalibrateMenu, .6 |
132 MENU_CALL tDiveHudMask1, 0 | |
133 MENU_CALL tDiveHudMask2, 0 | |
134 MENU_CALL tDiveHudMask3, 0 | |
135 MENU_OPTION tCalibrationGas,oCalGasO2, 0 | |
136 MENU_CALL tCalibrate, do_calibrate_mix | |
604 | 137 MENU_CALL tBack, do_return_ccr_menu |
582 | 138 MENU_END |
139 | |
113 | 140 |
141 do_calibrate_mix: | |
604 | 142 call calibrate_mix ; calibrate with opt_calibration_O2_ratio, also calibrate S8 HUD if connected |
143 WAITMS d'250' ; wait for HUD v3 | |
582 | 144 movlw .9 |
145 movff WREG,customview_surfmode ; show sensor mV custom view after restart | |
604 | 146 goto restart ; restart into surface mode |
113 | 147 |
0 | 148 |
149 do_diluent_setup: | |
604 | 150 bsf FLAG_diluent_setup ; setting up diluents |
151 bcf short_gas_decriptions ; do not use short versions of gaslist_strcat_gas_cd and gaslist_strcat_setpoint | |
152 bcf better_gas_hint ; do not mark the best gas/diluent (to be used in dive mode only) | |
153 call gaslist_cleanup_list ; take care that only one gas can be first | |
582 | 154 |
155 MENU_BEGIN tDiluentSetup, .6 | |
604 | 156 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu |
157 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu | |
158 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu | |
159 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu | |
160 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu | |
161 MENU_CALL tBack, do_return_ccr_menu | |
582 | 162 MENU_END |
163 | |
0 | 164 |
165 do_return_fixed_setpoints: | |
582 | 166 call menu_processor_double_pop ; drop exit line and back to last line |
0 | 167 |
168 do_fixed_setpoints: | |
604 | 169 bcf short_gas_decriptions ; =1: use short versions of gaslist_strcat_gas_cd and gaslist_strcat_setpoint |
170 bcf better_gas_hint ; do not mark the best gas/diluent (to be used in dive mode only) | |
582 | 171 |
172 MENU_BEGIN tFixedSetpoints, .6 | |
173 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
174 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
175 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
176 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
177 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
604 | 178 MENU_CALL tBack, do_return_ccr_menu |
582 | 179 MENU_END |
180 | |
0 | 181 |
182 do_edit_sp_menu: | |
604 | 183 movff PRODL,gaslist_gas ; get menu item we came from (0-4) |
582 | 184 |
185 MENU_BEGIN tFixedSetpoints, .5 | |
186 MENU_DYNAMIC gaslist_strcat_setpoint_0, 0 | |
187 MENU_CALL tSPPlus, gaslist_spplus | |
188 MENU_CALL tDepthPlus, gaslist_spdepthplus | |
189 MENU_CALL tDepthMinus, gaslist_spdepthminus | |
604 | 190 MENU_CALL tBack, do_return_fixed_setpoints |
582 | 191 MENU_END |
192 | |
193 | |
194 do_PSCR_menu: | |
604 | 195 MENU_BEGIN tPSCRMenu, .3 ; pSCR Menu |
582 | 196 MENU_OPTION tPSCR_O2_drop, oPSCR_drop, 0 |
197 MENU_OPTION tPSCR_lungratio, oPSCR_lungratio, 0 | |
604 | 198 MENU_CALL tBack, do_return_ccr_menu |
582 | 199 MENU_END |
0 | 200 |
201 ;============================================================================= | |
202 ; OC Gas Setup | |
203 | |
582 | 204 do_return_gas_menu: |
205 call menu_processor_double_pop ; drop exit line and back to last line | |
0 | 206 |
604 | 207 btfsc FLAG_diluent_setup ; return to CCR-Menu? |
208 bra do_diluent_setup ; YES | |
582 | 209 |
0 | 210 do_gas_menu: |
604 | 211 bcf FLAG_diluent_setup ; not setting up diluents |
212 bcf short_gas_decriptions ; do not use short versions of gaslist_strcat_gas_cd and gaslist_strcat_setpoint | |
213 bcf better_gas_hint ; do not mark the best gas/diluent (to be used in dive mode only) | |
214 call gaslist_cleanup_list ; takes care that only one gas can be first | |
0 | 215 |
582 | 216 MENU_BEGIN tGaslist, .6 |
604 | 217 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu |
218 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu | |
219 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu | |
220 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu | |
221 MENU_DYNAMIC gaslist_strcat_gas_cd, do_edit_gas_menu | |
222 MENU_CALL tBack, do_return_main_menu | |
582 | 223 MENU_END |
224 | |
225 | |
226 do_return_edit_gas_menu: | |
604 | 227 IFDEF _rx_functions |
228 bcf menu_update_tank_pres ; stop imprinting of tank pressure updates | |
229 bcf FLAG_pairing_mode ; not in pairing menu any more (back to normal timeout) | |
230 ENDIF | |
582 | 231 call menu_processor_pop ; drop exit line and ... |
232 do_abort_gas_depth_menu: | |
233 call menu_processor_pop ; back to last line | |
234 bra do_edit_gas_menu_common | |
604 | 235 do_edit_gas_menu: |
236 movff PRODL,gaslist_gas ; get menu item we came from (0-4) | |
237 movlw .5 ; offset between gases and diluents | |
238 btfsc FLAG_diluent_setup ; in CCR menu? | |
239 addwf gaslist_gas,F ; YES - add the offset | |
0 | 240 |
604 | 241 do_edit_gas_menu_common: |
242 MENU_BEGIN tGasEdit, .7 | |
582 | 243 MENU_DYNAMIC gaslist_gastitle, 0 |
244 MENU_DYNAMIC gaslist_MOD_END, 0 | |
245 MENU_DYNAMIC gaslist_show_type, gaslist_toggle_type | |
604 | 246 MENU_CALL tSetup_GasMix, do_setup_mix_menu |
247 MENU_DYNAMIC gaslist_GasDepth, do_setup_depth_menu | |
248 MENU_CALL tSetup_Tank, do_setup_tank_menu | |
249 MENU_CALL tBack, do_return_gas_menu | |
582 | 250 MENU_END |
251 | |
0 | 252 |
604 | 253 do_setup_mix_menu: |
582 | 254 MENU_BEGIN tGasEdit, .7 |
255 MENU_DYNAMIC gaslist_gastitle, 0 | |
256 MENU_DYNAMIC gaslist_MOD_END, 0 | |
257 MENU_CALL tO2Plus, gaslist_pO2 | |
258 MENU_CALL tO2Minus, gaslist_mO2 | |
259 MENU_CALL tHePlus, gaslist_pHe | |
260 MENU_CALL tHeMinus, gaslist_mHe | |
604 | 261 MENU_CALL tBack, do_return_edit_gas_menu |
262 MENU_END | |
263 | |
264 | |
265 do_setup_tank_menu: | |
266 IFDEF _rx_functions | |
267 btfsc FLAG_tr_enabled ; TR functions enabled? | |
268 bra do_setup_tank_menu_rx ; YES | |
269 ENDIF | |
270 | |
271 MENU_BEGIN tSetup_Tank, .6 | |
272 MENU_DYNAMIC gaslist_gastitle, 0 | |
273 MENU_DYNAMIC gaslist_tank_size_pres, 0 | |
274 MENU_CALL tTankSize, gaslist_tank_size | |
275 MENU_CALL tTankUsablePress, gaslist_tank_pres | |
276 MENU_CALL tCopyDilToOC, gaslist_copy_dil_to_oc | |
277 MENU_CALL tBack, do_return_edit_gas_menu | |
582 | 278 MENU_END |
428 | 279 |
560 | 280 |
604 | 281 IFDEF _rx_functions |
282 | |
283 do_setup_tank_menu_rx: | |
284 setf pairing_slot ; prime slot number with 255 aka -1, used in pairing function | |
285 bsf FLAG_pairing_mode ; in pairing menu (longer timeout) | |
286 | |
287 MENU_BEGIN tSetup_Tank, .7 | |
288 MENU_DYNAMIC gaslist_gastitle, 0 | |
289 MENU_DYNAMIC gaslist_tank_id_pres, 0 ; when changing position, adopt TFT_menu_tank_pres! | |
290 MENU_DYNAMIC gaslist_tank_size_pres, 0 | |
291 MENU_CALL tTankPairing, gaslist_tank_pairing | |
292 MENU_CALL tTankSize, gaslist_tank_size | |
293 MENU_CALL tTankUsablePress, gaslist_tank_pres | |
294 MENU_CALL tBack, do_return_edit_gas_menu | |
295 MENU_END | |
296 | |
297 ENDIF | |
298 | |
299 | |
300 do_setup_depth_menu: | |
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
155
diff
changeset
|
301 |
582 | 302 MENU_BEGIN tGasEdit, .7 |
303 MENU_DYNAMIC gaslist_gastitle, 0 | |
304 MENU_DYNAMIC gaslist_MOD_END, 0 | |
305 MENU_DYNAMIC gaslist_ppo2, 0 ; ppO2 at change depth | |
306 MENU_CALL tDepthPlus, gaslist_pDepth | |
307 MENU_CALL tDepthMinus, gaslist_mDepth | |
308 MENU_DYNAMIC gaslist_reset_mod_title, gaslist_reset_mod | |
604 | 309 MENU_CALL tBack, do_return_edit_gas_menu |
582 | 310 MENU_END |
0 | 311 |
582 | 312 |
0 | 313 ;============================================================================= |
604 | 314 ; Simulator Menus |
0 | 315 |
582 | 316 do_return_planner_menu: |
317 call menu_processor_pop ; drop exit line and ... | |
0 | 318 |
582 | 319 global do_return_demo_planner |
320 do_return_demo_planner: | |
321 call menu_processor_pop ; back to last line | |
322 bra do_planner_common | |
0 | 323 |
324 do_planner_menu: | |
582 | 325 ; to have correct simulator results after mode changes without prior excursion to surfacemode |
326 call option_save_all | |
327 call restart_set_modes_and_flags | |
604 | 328 ; reset dive time/depth to default values |
582 | 329 lfsr FSR0,odiveInterval |
330 call option_reset | |
331 lfsr FSR0,obottomTime | |
332 call option_reset | |
333 lfsr FSR0,obottomDepth | |
334 call option_reset | |
604 | 335 lfsr FSR0,oSimAGF |
336 call option_reset | |
582 | 337 |
338 do_planner_common: | |
604 | 339 movff opt_dive_mode,WREG ; get dive mode: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR |
340 dcfsnz WREG,W ; subtract one, became zero? | |
341 bra do_planner_common_ccr ; YES - use CCR version | |
342 | |
343 MENU_BEGIN tPlan, .7 | |
344 MENU_OPTION tIntvl, odiveInterval, 0 | |
345 MENU_OPTION tBtDep, obottomDepth, 0 | |
346 MENU_CALL tInter, do_demo_divemode | |
347 MENU_OPTION tBtTm, obottomTime, 0 | |
348 MENU_OPTION tuseAGF, oSimAGF, 0 | |
349 MENU_CALL tDeco, do_demo_planner | |
350 MENU_CALL tBack, do_return_main_menu | |
351 MENU_END | |
352 | |
353 do_planner_common_ccr: | |
582 | 354 MENU_BEGIN tPlan, .7 |
355 MENU_OPTION tIntvl, odiveInterval, 0 | |
356 MENU_OPTION tBtDep, obottomDepth, 0 | |
357 MENU_CALL tInter, do_demo_divemode | |
358 MENU_OPTION tBtTm, obottomTime, 0 | |
359 MENU_CALL tDecoSetup, do_planner_config | |
360 MENU_CALL tDeco, do_demo_planner | |
604 | 361 MENU_CALL tBack, do_return_main_menu |
582 | 362 MENU_END |
0 | 363 |
298
2fe34fc0e2ae
new submenu for gas consumption, show actual mix instead of GAS1-GAS5 in deco planner
heinrichsweikamp
parents:
275
diff
changeset
|
364 do_planner_config: |
582 | 365 MENU_BEGIN tPlan, .3 |
366 MENU_OPTION tSelectSetpoint, oSimSetpoint, 0 | |
367 MENU_OPTION tuseAGF, oSimAGF, 0 | |
604 | 368 MENU_CALL tBack, do_return_planner_menu |
582 | 369 MENU_END |
524 | 370 |
298
2fe34fc0e2ae
new submenu for gas consumption, show actual mix instead of GAS1-GAS5 in deco planner
heinrichsweikamp
parents:
275
diff
changeset
|
371 |
0 | 372 ;============================================================================= |
604 | 373 ; Divemode Menu |
0 | 374 |
375 do_return_divemode_menu: | |
582 | 376 call menu_processor_double_pop ; drop exit line and back to last line |
0 | 377 |
378 do_divemode_menu: | |
582 | 379 MENU_BEGIN tDiveModeMenu, .7 |
380 MENU_OPTION tDvMode, oDiveMode, 0 | |
381 MENU_OPTION tDkMode, oDecoMode, 0 | |
382 MENU_CALL tppO2settings, do_ppo2_menu | |
383 MENU_OPTION tsafetystopmenu, oSafetyStop, 0 | |
604 | 384 MENU_CALL tDecoparameters, do_decoparameters_menu |
582 | 385 MENU_CALL t2ndDecoPlanMenu, do_2nd_deco_plan_menu |
604 | 386 MENU_CALL tBack, do_return_main_menu |
582 | 387 MENU_END |
388 | |
0 | 389 |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
90
diff
changeset
|
390 do_ppo2_menu: |
582 | 391 MENU_BEGIN tppO2settings, .6 |
392 MENU_DYNAMIC divesets_ppo2_max, do_toggle_ppo2_max | |
393 MENU_DYNAMIC divesets_ppo2_max_deco, do_toggle_ppo2_max_deco | |
394 MENU_DYNAMIC divesets_ppo2_min, do_toggle_ppo2_min | |
395 MENU_DYNAMIC divesets_ppo2_min_cc, do_toggle_ppo2_min_cc | |
396 MENU_OPTION tShowppO2, oShowppO2, 0 | |
604 | 397 MENU_CALL tBack, do_return_divemode_menu |
582 | 398 MENU_END |
399 | |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
90
diff
changeset
|
400 |
0 | 401 do_return_decoparameters_menu: |
582 | 402 call menu_processor_double_pop ; drop exit line and back to last line |
403 | |
404 do_decoparameters_menu: | |
405 movff char_I_deco_model,lo ; 0 = ZH-L16, 1 = ZH-L16-GF | |
406 tstfsz lo | |
604 | 407 bra do_decoparameters_menu_gf ; <> 0 -> GF menu! |
582 | 408 ; NON-GF menu |
604 | 409 MENU_BEGIN tDecoparameters, .6 |
410 MENU_OPTION tSetBotUse, obottom_usage, 0 | |
411 MENU_OPTION tSetDecoUse, odeco_usage, 0 | |
582 | 412 MENU_OPTION tSaturationMult, osatmult, 0 |
413 MENU_OPTION tDesaturationMult, odesatmult, 0 | |
604 | 414 MENU_CALL tMore, do_decoparameters_menu_more |
415 MENU_CALL tBack, do_return_divemode_menu | |
582 | 416 MENU_END |
417 | |
604 | 418 do_decoparameters_menu_gf: |
582 | 419 ; GF menu |
420 MENU_BEGIN tDecoparameters, .7 | |
604 | 421 MENU_OPTION tSetBotUse, obottom_usage, 0 |
422 MENU_OPTION tSetDecoUse, odeco_usage, 0 | |
423 MENU_CALL tGFMenu, do_GF_menu | |
582 | 424 MENU_OPTION tSaturationMult, osatmultgf, 0 |
425 MENU_OPTION tDesaturationMult, odesatmultgf, 0 | |
604 | 426 MENU_CALL tMore, do_decoparameters_menu_more |
427 MENU_CALL tBack, do_return_divemode_menu | |
582 | 428 MENU_END |
0 | 429 |
560 | 430 |
604 | 431 do_decoparameters_menu_more: |
432 MENU_BEGIN tDecoparameters, .4 | |
433 MENU_OPTION tLastDecostop, oLastDeco, 0 | |
434 MENU_OPTION tAscentSpeed, oAscentSpeed, 0 | |
435 MENU_OPTION tGasChangeTime, oGasChangeTime, 0 | |
436 MENU_CALL tBack, do_return_decoparameters_menu | |
582 | 437 MENU_END |
560 | 438 |
439 | |
604 | 440 do_2nd_deco_plan_menu: |
441 MENU_BEGIN t2ndDecoPlanMenu, .3 | |
442 MENU_OPTION tFTTSMenu, oExtraTime, 0 | |
443 MENU_OPTION tCalcAscGas, oCalcAscGas, 0 | |
444 MENU_CALL tBack, do_return_divemode_menu | |
582 | 445 MENU_END |
560 | 446 |
447 | |
604 | 448 do_GF_menu: |
449 MENU_BEGIN tGFMenu, .6 | |
450 MENU_OPTION tGF_low, oGF_low, 0 | |
451 MENU_OPTION tGF_high, oGF_high, 0 | |
582 | 452 MENU_OPTION taGF_enable, oEnable_aGF, 0 |
453 MENU_OPTION taGF_low, oaGF_low, 0 | |
454 MENU_OPTION taGF_high, oaGF_high, 0 | |
604 | 455 MENU_CALL tBack, do_return_decoparameters_menu |
582 | 456 MENU_END |
560 | 457 |
458 | |
0 | 459 ;============================================================================= |
460 ; Setup Menu | |
461 | |
582 | 462 do_return_settings_deeper: ; entry point for return from set time/date sub-menu |
463 bcf settime_setdate ; clear flag | |
464 call menu_processor_pop ; drop one more stack entry | |
465 | |
0 | 466 do_return_settings: |
582 | 467 call menu_processor_double_pop ; drop exit line and back to last line |
604 | 468 IFDEF _rx_mode |
469 bcf FLAG_tr_enabled ; clear TR functions flag by default | |
470 movff opt_TR_mode,WREG ; get TR functions mode | |
471 tstfsz WREG ; TR functions enabled? | |
472 bsf FLAG_tr_enabled ; YES | |
473 ENDIF | |
582 | 474 |
0 | 475 do_settings_menu: |
582 | 476 btfsc ble_available ; ble available? |
477 bra do_settings_menu_ble ; YES | |
478 | |
604 | 479 MENU_BEGIN tSystSets, .5 |
582 | 480 MENU_CALL tInfoMenu, do_info_menu |
481 MENU_CALL tSetTimeDate, do_date_time_menu | |
482 MENU_CALL tDispSets, do_dispsets_menu | |
483 MENU_CALL tMore, do_settings_menu_more | |
604 | 484 MENU_CALL tBack, do_return_main_menu |
582 | 485 MENU_END |
155
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
486 |
345 | 487 do_settings_menu_ble: |
604 | 488 IFDEF _rx_functions |
489 btfsc ostc_rx_present ; RX model? | |
490 bra do_settings_menu_rx ; YES | |
491 ENDIF | |
492 | |
493 MENU_BEGIN tSystSets, .6 | |
582 | 494 MENU_CALL tInfoMenu, do_info_menu |
495 MENU_CALL tBleTitle, comm_mode0 | |
496 MENU_CALL tSetTimeDate, do_date_time_menu | |
497 MENU_CALL tDispSets, do_dispsets_menu | |
498 MENU_CALL tMore, do_settings_menu_more | |
604 | 499 MENU_CALL tBack, do_return_main_menu |
582 | 500 MENU_END |
501 | |
604 | 502 IFDEF _rx_functions |
503 do_settings_menu_rx: | |
504 MENU_BEGIN tSystSets, .7 | |
505 MENU_CALL tInfoMenu, do_info_menu | |
506 MENU_CALL tBleTitle, comm_mode0 | |
507 MENU_CALL tTrSettings, do_settings_menu_TR | |
508 MENU_CALL tSetTimeDate, do_date_time_menu | |
509 MENU_CALL tDispSets, do_dispsets_menu | |
510 MENU_CALL tMore, do_settings_menu_more | |
511 MENU_CALL tBack, do_return_main_menu | |
512 MENU_END | |
513 ENDIF | |
514 | |
515 | |
582 | 516 do_info_menu: |
604 | 517 IFDEF _rx_functions |
518 btfsc ostc_rx_present ; TR model? | |
519 bra do_info_menu_TR ; YES | |
520 ENDIF | |
521 | |
582 | 522 MENU_BEGIN tInfoMenu, .6 |
523 MENU_DYNAMIC info_menu_serial, 0 | |
524 MENU_DYNAMIC info_menu_firmware, 0 | |
525 MENU_DYNAMIC info_menu_battery_volts, 0 | |
526 MENU_DYNAMIC info_menu_uptime, 0 | |
527 MENU_DYNAMIC info_menu_total_dives, 0 | |
604 | 528 MENU_CALL tBack, do_return_settings |
529 MENU_END | |
530 | |
531 IFDEF _rx_functions | |
532 do_info_menu_TR: | |
533 MENU_BEGIN tInfoMenu, .7 | |
534 MENU_DYNAMIC info_menu_serial, 0 | |
535 MENU_DYNAMIC info_menu_firmware, 0 | |
536 MENU_DYNAMIC info_menu_firmware_rx, 0 | |
537 MENU_DYNAMIC info_menu_total_dives, 0 | |
538 MENU_DYNAMIC info_menu_battery_volts, 0 | |
539 MENU_DYNAMIC info_menu_uptime, 0 | |
540 MENU_CALL tBack, do_return_settings | |
582 | 541 MENU_END |
604 | 542 ENDIF |
543 | |
544 | |
545 IFDEF _rx_functions | |
546 do_settings_menu_TR: | |
547 movff opt_dive_mode,WREG ; get dive mode: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR | |
548 incf WREG,W ; add 1 | |
549 dcfsnz WREG,W ; subtract one, became zero? | |
550 bra do_settings_menu_TR_MaxDelta; YES - OC | |
551 dcfsnz WREG,W ; subtract one, became zero? | |
552 bra do_settings_menu_TR_BailPres; YES - CCR | |
553 dcfsnz WREG,W ; subtract one, became zero? | |
554 bra do_settings_menu_TR_MaxDelta; YES - Gauge | |
555 dcfsnz WREG,W ; subtract one, became zero? | |
556 bra do_settings_menu_TR_abort ; YES - Apnea, abort | |
557 dcfsnz WREG,W ; subtract one, became zero? | |
558 bra do_settings_menu_TR_both ; YES - pSCR | |
559 do_settings_menu_TR_abort: | |
560 call menu_processor_pop ; drop last menu selection | |
561 bra do_settings_menu ; back to last menu | |
562 | |
563 do_settings_menu_TR_MaxDelta: ; menu with oTrMaxDeltaPres | |
564 MENU_BEGIN tTrSettings, .5 | |
565 MENU_OPTION tTrMode, oTrMode, 0 | |
566 MENU_OPTION tTr1stPres, oTr1stPres, 0 | |
567 MENU_OPTION tTr2ndPres, oTr2ndPres, 0 | |
568 MENU_DYNAMIC do_toggle_max_pres_diff_label,do_toggle_max_pres_diff | |
569 MENU_CALL tBack, do_return_settings | |
570 MENU_END | |
571 | |
572 do_settings_menu_TR_BailPres: ; menu with oTrBailPres | |
573 MENU_BEGIN tTrSettings, .5 | |
574 MENU_OPTION tTrMode, oTrMode, 0 | |
575 MENU_OPTION tTr1stPres, oTr1stPres, 0 | |
576 MENU_OPTION tTr2ndPres, oTr2ndPres, 0 | |
577 MENU_OPTION tTrBailPres, oTrBailPres, 0 | |
578 MENU_CALL tBack, do_return_settings | |
579 MENU_END | |
580 | |
581 do_settings_menu_TR_both: ; menu with oTrBailPres and oTrMaxDeltaPres | |
582 MENU_BEGIN tTrSettings, .6 | |
583 MENU_OPTION tTrMode, oTrMode, 0 | |
584 MENU_OPTION tTr1stPres, oTr1stPres, 0 | |
585 MENU_OPTION tTr2ndPres, oTr2ndPres, 0 | |
586 MENU_OPTION tTrBailPres, oTrBailPres, 0 | |
587 MENU_DYNAMIC do_toggle_max_pres_diff_label,do_toggle_max_pres_diff | |
588 MENU_CALL tBack, do_return_settings | |
589 MENU_END | |
590 | |
591 | |
592 do_toggle_max_pres_diff: ; add 5 bar, with hard-coded max. | |
593 movff char_I_max_pres_diff,lo ; get current value | |
594 movlw .5 ; load increment | |
595 addwf lo,F ; add increment | |
596 movlw max_pres_diff_max ; load maximum value | |
597 cpfsgt lo ; above maximum value? | |
598 bra do_toggle_max_pres_diff_1 ; NO - store new value | |
599 movlw max_pres_diff_min ; YES - load minimum value | |
600 movwf lo ; - into lo | |
601 do_toggle_max_pres_diff_1: | |
602 movff lo,char_I_max_pres_diff ; write back new value | |
603 return ; done | |
604 ENDIF | |
582 | 605 |
606 | |
607 do_return_settings_more_deeper: ; entry point for returns from reset sub-menu | |
608 call menu_processor_pop ; drop one more stack entry | |
326
d21b172d5a7a
VSIbar #4: VSI settings submenu, graph option, logbook offset and compass calib. menu exit fix
Janos Kovacs <kovjanos@gmail.com>
parents:
307
diff
changeset
|
609 |
d21b172d5a7a
VSIbar #4: VSI settings submenu, graph option, logbook offset and compass calib. menu exit fix
Janos Kovacs <kovjanos@gmail.com>
parents:
307
diff
changeset
|
610 do_return_settings_more: |
582 | 611 call menu_processor_double_pop ; drop exit line and back to last line |
612 | |
155
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
613 do_settings_menu_more: |
582 | 614 btfsc battery_gauge_available ; piezo buttons available |
615 bra do_settings_menu_more_piezo | |
616 btfsc ble_available ; ble available | |
617 bra do_settings_menu_more_ostc3p | |
618 ; All MENU_CALLs that are | |
619 MENU_BEGIN tSystSets, .6 ; in all of this 3 menus | |
620 MENU_CALL tCompassMenu, do_compass_menu ; need to stay together | |
621 MENU_CALL tLogOffset, do_log_offset_menu ; on this menu level in | |
604 | 622 MENU_OPTION tAltMode, oAltMode, 0 ; oder to not mess up the |
582 | 623 MENU_OPTION tDvSalinity, oDiveSalinity, 0 ; menu stack on doing the |
624 MENU_CALL tResetMenu, do_reset_menu ; do_return_settings ! | |
604 | 625 MENU_CALL tBack, do_return_settings |
582 | 626 MENU_END |
220
effd7259f5a5
make button sensitivity configurable (cR hardware)
heinrichsweikamp
parents:
218
diff
changeset
|
627 |
582 | 628 |
629 do_return_settings_menu_more_pz: | |
375
a9e35c1327aa
1.88 release, BUGFIX: Start with Sensor use from sleep (cR only), CHANGE: Apply button settings when button menu is closed, NEW: Reset button settings on a magnet reset (cR and OSTC 2)
heinrichsweikamp
parents:
359
diff
changeset
|
630 call TFT_ClearScreen |
604 | 631 call piezo_config ; configure buttons |
582 | 632 call menu_processor_double_pop ; drop exit line and back to last line |
524 | 633 |
269
1207cf9a9408
adjust menu for different hardware versions
heinrichsweikamp
parents:
243
diff
changeset
|
634 do_settings_menu_more_piezo: |
582 | 635 MENU_BEGIN tSystSets, .7 |
604 | 636 MENU_CALL tCompassMenu, do_compass_menu ; see above |
637 MENU_CALL tLogOffset, do_log_offset_menu ; | |
582 | 638 MENU_OPTION tAltMode, oAltMode, 0 |
639 MENU_OPTION tDvSalinity, oDiveSalinity, 0 | |
604 | 640 MENU_CALL tResetMenu, do_reset_menu ; |
641 MENU_CALL tMore, do_settings_piezo_menu ; | |
642 MENU_CALL tBack, do_return_settings | |
582 | 643 MENU_END |
0 | 644 |
604 | 645 do_settings_menu_more_ostc3p: ; menu with BLE feature |
582 | 646 MENU_BEGIN tSystSets, .6 |
604 | 647 MENU_CALL tCompassMenu, do_compass_menu ; see above |
648 MENU_CALL tLogOffset, do_log_offset_menu ; | |
582 | 649 MENU_OPTION tAltMode, oAltMode, 0 |
650 MENU_OPTION tDvSalinity, oDiveSalinity, 0 | |
604 | 651 MENU_CALL tResetMenu, do_reset_menu ; |
652 MENU_CALL tBack, do_return_settings | |
582 | 653 MENU_END |
654 | |
243 | 655 |
345 | 656 do_settings_piezo_menu: |
582 | 657 ; Menu with features only available in piezo button hardware |
658 MENU_BEGIN tSystSets, .3 | |
604 | 659 MENU_OPTION tButtonleft, ocR_button_left, 0 ; left button sensitivity |
582 | 660 MENU_OPTION tButtonright, ocR_button_right, 0 ; right button sensitivity |
604 | 661 MENU_CALL tBack, do_return_settings_menu_more_pz |
582 | 662 MENU_END |
220
effd7259f5a5
make button sensitivity configurable (cR hardware)
heinrichsweikamp
parents:
218
diff
changeset
|
663 |
effd7259f5a5
make button sensitivity configurable (cR hardware)
heinrichsweikamp
parents:
218
diff
changeset
|
664 |
18
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
665 do_compass_menu: |
582 | 666 MENU_BEGIN tSystSets, .5 |
667 MENU_CALL tCompassMenu, compass_calibration_loop ; exits to surfloop | |
668 ; MENU_OPTION tCompassGain, oCompassGain, 0 | |
669 MENU_DYNAMIC menu_cal_x, 0 | |
670 MENU_DYNAMIC menu_cal_y, 0 | |
671 MENU_DYNAMIC menu_cal_z, 0 | |
604 | 672 MENU_CALL tBack, do_return_settings_more |
582 | 673 MENU_END |
674 | |
18
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
675 |
0 | 676 ;============================================================================= |
604 | 677 ; Reset and confirmation menu |
0 | 678 |
679 do_reset_menu: | |
582 | 680 MENU_BEGIN tResetMenu, .6 |
604 | 681 MENU_CALL tBack, do_return_settings_more |
682 MENU_CALL tReboot, do_reset_menu2 ; confirm | |
683 MENU_CALL tResetDeco, do_reset_menu3 ; confirm | |
684 MENU_CALL tResetSettings, do_reset_menu4 ; confirm | |
685 MENU_CALL tResetLogbook, do_reset_menu5 ; confirm | |
686 MENU_CALL tResetBattery, do_new_battery_menu ; confirm | |
582 | 687 MENU_END |
0 | 688 |
689 do_reset_menu2: | |
582 | 690 MENU_BEGIN tResetMenu2, .2 |
691 MENU_CALL tAbort, do_return_settings_more_deeper | |
604 | 692 MENU_CALL tReboot, do_reboot ; reboot |
582 | 693 MENU_END |
0 | 694 |
695 do_reset_menu3: | |
582 | 696 MENU_BEGIN tResetMenu2, .2 |
697 MENU_CALL tAbort, do_return_settings_more_deeper | |
604 | 698 MENU_CALL tResetDeco, do_reset_deco ; reset deco |
582 | 699 MENU_END |
0 | 700 |
701 do_reset_menu4: | |
582 | 702 MENU_BEGIN tResetMenu2, .2 |
703 MENU_CALL tAbort, do_return_settings_more_deeper | |
604 | 704 MENU_CALL tResetSettings, do_reset_settings ; reset all settings |
582 | 705 MENU_END |
0 | 706 |
63 | 707 do_reset_menu5: |
582 | 708 MENU_BEGIN tResetMenu2, .2 |
709 MENU_CALL tAbort, do_return_settings_more_deeper | |
604 | 710 MENU_CALL tResetLogbook, do_reset_logbook ; reset logbook |
582 | 711 MENU_END |
712 | |
63 | 713 |
714 do_reset_logbook: | |
604 | 715 clrf EEADRH ; make sure to select EEPROM bank 0 |
582 | 716 clrf EEDATA |
717 read_int_eeprom .2 | |
718 write_int_eeprom .16 | |
719 read_int_eeprom .3 | |
604 | 720 write_int_eeprom .17 ; copy number of dives |
63 | 721 clrf EEDATA |
582 | 722 write_int_eeprom .2 |
604 | 723 write_int_eeprom .3 ; clear total dives |
582 | 724 write_int_eeprom .4 |
725 write_int_eeprom .5 | |
604 | 726 write_int_eeprom .6 ; reset logbook pointers |
727 call ext_flash_erase_logbook ; and complete logbook | |
728 bra do_return_settings_more_deeper | |
63 | 729 |
0 | 730 |
731 do_reset_deco: | |
560 | 732 SAFE_2BYTE_COPY last_surfpressure_30min,int_I_pres_respiration ; copy surface pressure to deco routine |
733 SAFE_2BYTE_COPY last_surfpressure_30min,int_I_pres_surface ; copy surface pressure to deco routine | |
582 | 734 |
735 call deco_clear_tissue ; set all tissues to Pamb * N2_ratio (C-Code) | |
736 call deco_calc_dive_interval_1min; calculate deco in surface mode | |
737 call deco_calc_desaturation_time ; calculate desaturation and no-fly time | |
738 banksel common | |
604 | 739 bra do_return_settings_more_deeper |
582 | 740 |
0 | 741 |
742 do_reset_settings: | |
604 | 743 call TFT_ClearScreen ; clear screen |
744 call option_reset_all ; reset all options to factory default | |
745 goto restart ; restart into surfacemode | |
0 | 746 |
747 do_reboot: | |
604 | 748 call ext_flash_enable_protection ; enables write protection |
0 | 749 reset |
750 | |
751 | |
752 do_date_time_menu: | |
582 | 753 MENU_BEGIN tSetTimeDate, .4 |
754 MENU_CALL tSetTime, do_time_menu | |
755 MENU_CALL tSetDate, do_date_menu | |
614 | 756 MENU_OPTION tDateFormat, oDateFormat, 0 |
604 | 757 MENU_CALL tBack, do_return_settings |
582 | 758 MENU_END |
759 | |
0 | 760 |
761 do_date_menu: | |
762 bsf settime_setdate | |
582 | 763 |
764 MENU_BEGIN tSetDate, .4 | |
765 MENU_OPTION tSetDay, oSetDay, 0 | |
766 MENU_OPTION tSetMonth, oSetMonth, 0 | |
767 MENU_OPTION tSetYear, oSetYear, 0 | |
604 | 768 MENU_CALL tBack, do_return_settings_deeper |
582 | 769 MENU_END |
0 | 770 |
771 | |
772 do_reset_seconds: | |
773 clrf secs | |
582 | 774 call rtc_set_rtc ; writes mins, sec, hours, day, month and year to RTC module |
775 call menu_processor_pop ; clear the MENU_CALL for do_reset_seconds from the stack | |
776 ;bra do_time_menu ; direct jump-back into the menu | |
777 | |
0 | 778 do_time_menu: |
779 bsf settime_setdate | |
582 | 780 |
781 MENU_BEGIN tSetTime, .4 | |
782 MENU_OPTION tSetHours, oSetHours, 0 | |
783 MENU_OPTION tSetMinutes, oSetMinutes, 0 | |
784 MENU_CALL tSetSeconds, do_reset_seconds | |
604 | 785 MENU_CALL tBack, do_return_settings_deeper |
582 | 786 MENU_END |
0 | 787 |
788 | |
604 | 789 do_toggle_ppo2_max: ; add 0.1 bar, with hard-coded max. |
582 | 790 movff char_I_ppO2_max,lo ; banksafe |
791 movlw .10 | |
0 | 792 addwf lo,F |
582 | 793 movlw ppo2_warning_high_highest |
0 | 794 cpfsgt lo |
582 | 795 bra do_toggle_ppo2_max2 |
796 movlw ppo2_warning_high_lowest | |
0 | 797 movwf lo |
798 do_toggle_ppo2_max2: | |
582 | 799 movff lo,char_I_ppO2_max |
800 return | |
0 | 801 |
604 | 802 do_toggle_ppo2_max_deco: ; add 0.1 bar, with hard-coded max. |
582 | 803 movff char_I_ppO2_max_deco,lo ; banksafe |
804 movlw .10 | |
507
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
805 addwf lo,F |
582 | 806 movlw ppo2_warning_deco_highest |
507
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
807 cpfsgt lo |
582 | 808 bra do_toggle_ppo2_max_deco2 |
809 movlw ppo2_warning_deco_lowest | |
507
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
810 movwf lo |
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
811 do_toggle_ppo2_max_deco2: |
582 | 812 movff lo,char_I_ppO2_max_deco |
813 return | |
814 | |
604 | 815 do_toggle_ppo2_min: ; sub 0.1 bar, with hard-coded min. |
582 | 816 movff char_I_ppO2_min,lo ; banksafe |
817 incf lo,F | |
818 movlw ppo2_warning_low_highest | |
0 | 819 cpfsgt lo |
582 | 820 bra do_toggle_ppo2_min2 |
821 movlw ppo2_warning_low_lowest | |
0 | 822 movwf lo |
823 do_toggle_ppo2_min2: | |
582 | 824 movff lo,char_I_ppO2_min |
825 return | |
0 | 826 |
604 | 827 do_toggle_ppo2_min_cc: ; sub 0.1 bar, with hard-coded min. |
582 | 828 movff char_I_ppO2_min_loop,lo ; banksafe |
829 incf lo,F | |
830 movlw ppo2_warning_loop_highest | |
560 | 831 cpfsgt lo |
582 | 832 bra do_toggle_ppo2_min_cc2 |
833 movlw ppo2_warning_loop_lowest | |
560 | 834 movwf lo |
835 do_toggle_ppo2_min_cc2: | |
582 | 836 movff lo,char_I_ppO2_min_loop |
837 return | |
838 | |
0 | 839 |
840 ; Logbook offset sub-menu | |
841 do_log_offset_menu: | |
582 | 842 MENU_BEGIN tLogOffset, .6 |
843 MENU_DYNAMIC TFT_LogOffset_Logtitle, 0 | |
844 MENU_CALL tLogOffsetp1, do_logoffset_plus1 | |
845 MENU_CALL tLogOffsetp10, do_logoffset_plus10 | |
846 MENU_CALL tLogOffsetm1, do_logoffset_minus1 | |
847 MENU_CALL tLogOffsetm10, do_logoffset_minus10 | |
604 | 848 MENU_CALL tBack, do_return_settings_more |
582 | 849 MENU_END |
0 | 850 |
851 | |
852 do_logoffset_minus1: | |
604 | 853 call do_logoffset_common_read ; read into lo:hi |
582 | 854 movlw .1 |
0 | 855 subwf lo |
582 | 856 movlw .0 |
0 | 857 subwfb hi |
604 | 858 btfss hi,7 ; < 0 ? |
859 bra do_logoffset_exit ; store and return | |
0 | 860 clrf lo |
861 clrf hi | |
604 | 862 bra do_logoffset_exit ; store and return |
0 | 863 |
864 do_logoffset_minus10: | |
604 | 865 call do_logoffset_common_read ; read into lo:hi |
582 | 866 movlw .10 |
0 | 867 subwf lo |
582 | 868 movlw .0 |
0 | 869 subwfb hi |
604 | 870 btfss hi,7 ; < 0 ? |
871 bra do_logoffset_exit ; store and return | |
0 | 872 clrf lo |
873 clrf hi | |
604 | 874 bra do_logoffset_exit ; store and return |
0 | 875 |
876 do_logoffset_plus1: | |
604 | 877 call do_logoffset_common_read ; read into lo:hi |
582 | 878 infsnz lo,F |
879 incf hi,F | |
604 | 880 bra do_logoffset_exit ; store and return |
0 | 881 |
882 do_logoffset_plus10: | |
604 | 883 call do_logoffset_common_read ; read into lo:hi |
582 | 884 movlw .10 |
0 | 885 addwf lo |
582 | 886 movlw .0 |
0 | 887 addwfc hi |
604 | 888 do_logoffset_exit: |
889 goto do_logoffset_common_write ; store and return | |
0 | 890 |
582 | 891 do_return_dispsets_menu: |
892 bcf in_color_menu | |
893 call menu_processor_double_pop ; drop exit line and back to last line | |
0 | 894 |
895 do_dispsets_menu: | |
604 | 896 |
897 IF _language_2!=none | |
898 MENU_BEGIN tDispSets, .7 | |
582 | 899 MENU_OPTION tBright, oBrightness, 0 |
604 | 900 MENU_OPTION tLanguage, oLanguage, 0 |
901 MENU_OPTION tUnits, oUnits, 0 | |
582 | 902 MENU_CALL tColorScheme, do_color_scheme |
903 MENU_OPTION tFlip, oFlipScreen, 0 | |
904 MENU_CALL tMore, do_dispsets_menu_more | |
604 | 905 MENU_CALL tBack, do_return_settings |
582 | 906 MENU_END |
604 | 907 ELSE |
908 MENU_BEGIN tDispSets, .6 | |
909 MENU_OPTION tBright, oBrightness, 0 | |
910 MENU_OPTION tUnits, oUnits, 0 | |
911 MENU_CALL tColorScheme, do_color_scheme | |
912 MENU_OPTION tFlip, oFlipScreen, 0 | |
913 MENU_CALL tMore, do_dispsets_menu_more | |
914 MENU_CALL tBack, do_return_settings | |
915 MENU_END | |
916 ENDIF | |
582 | 917 |
335
3d43da7acfe1
Always show ppO2 (warning position, standard color) option
janos_kovacs <kovjanos@gmail.com>
parents:
333
diff
changeset
|
918 |
3d43da7acfe1
Always show ppO2 (warning position, standard color) option
janos_kovacs <kovjanos@gmail.com>
parents:
333
diff
changeset
|
919 do_dispsets_menu_more: |
582 | 920 MENU_BEGIN tDispSets, .7 |
921 MENU_OPTION tMODwarning, oMODwarning, 0 | |
922 MENU_OPTION tIBCDwarning, oEnable_IBCD, 0 | |
923 MENU_OPTION tVSItext2, oVSItextv2, 0 | |
924 MENU_OPTION tVSIgraph, oVSIgraph, 0 | |
925 MENU_OPTION tTimeoutDive, oDiveTimeout, 0 | |
604 | 926 MENU_OPTION t2ndDepth, o2ndDepthDisp, 0 |
927 MENU_CALL tBack, do_return_dispsets_menu | |
582 | 928 MENU_END |
0 | 929 |
582 | 930 |
50 | 931 do_color_scheme: |
582 | 932 bsf in_color_menu |
933 | |
934 MENU_BEGIN tColorScheme, .2 | |
935 MENU_OPTION tColorSetDive, oColorSetDive, 0 | |
604 | 936 MENU_CALL tBack, do_return_dispsets_menu |
582 | 937 MENU_END |
50 | 938 |
939 | |
0 | 940 ;============================================================================= |
941 | |
582 | 942 do_new_battery_menu: |
943 MENU_BEGIN tNewBattTitle, .2 | |
944 MENU_CALL tAbort, do_return_settings_more_deeper | |
945 MENU_CALL tYes, do_new_battery_select | |
946 MENU_END | |
947 | |
948 global do_new_battery_select | |
949 do_new_battery_select: | |
604 | 950 |
951 IFDEF _screendump | |
952 bsf enable_screen_dumps ; to prevent exiting into COMM mode immediately | |
953 ELSE | |
954 bsf disable_comm_mode ; to prevent exiting into COMM mode immediately | |
955 ENDIF | |
956 | |
957 call TFT_boot ; initialize TFT (includes clear screen) | |
614 | 958 call TFT_Display_FadeIn ; switch on backlight |
582 | 959 movlw .100 |
960 movwf batt_percent ; make sure to reset batt_percent | |
961 | |
604 | 962 ; Default (in cases of timeout or USB): use old battery |
0 | 963 clrf EEADRH |
964 read_int_eeprom 0x07 | |
965 movff EEDATA,battery_gauge+0 | |
966 read_int_eeprom 0x08 | |
967 movff EEDATA,battery_gauge+1 | |
968 read_int_eeprom 0x09 | |
969 movff EEDATA,battery_gauge+2 | |
970 read_int_eeprom 0x0A | |
971 movff EEDATA,battery_gauge+3 | |
972 read_int_eeprom 0x0B | |
973 movff EEDATA,battery_gauge+4 | |
974 read_int_eeprom 0x0C | |
975 movff EEDATA,battery_gauge+5 | |
976 | |
604 | 977 call menu_processor_reset ; restart from first item |
582 | 978 |
614 | 979 ; hardware_flag1: battery changeable by user charger supported battery types |
980 ; ------------------------------------------------------------------------------------------------------------------------------------------------------- | |
981 ; 0x11: BLE and battery gauge ---> OSTC 2 (old model ) NO YES internal 18650 | |
982 ; 0x05: analog input and battery gauge ---> OSTC 2 cR NO YES internal 18650 | |
983 ; 0x33: BLE and xmitter input and ambient sensor and battery gauge ---> OSTC 2 TR NO YES internal 16650 | |
984 ; 0x13: BLE and ambient sensor and battery gauge -+-> OSTC 2 (new model ) NO YES internal 16650 | |
985 ; +-> OSTC Plus YES YES 1.5V ----- NO! ----- 3.6V rechargeable | |
986 ; 0x12; BLE and ambient sensor ---> OSTC Sport (both models) YES NO 1.5V 3.6V disposable 3.6V rechargeable | |
987 ; 0x0A: optical input and ambient sensor ---> OSTC 3 /USB YES NO 1.5V 3.6V disposable 3.6V rechargeable | |
615 | 988 ; 0x02: ambient sensor ---> OSTC sport /USB YES NO 1.5V 3.6V disposable 3.6V rechargeable |
614 | 989 ; 0x1A: BLE and optical input and ambient sensor ---> OSTC 3 /BLE YES NO 1.5V 3.6V disposable 3.6V rechargeable |
990 | |
991 | |
992 movlw 0x0A ; OSTC 3 /USB | |
993 cpfseq hardware_flag1 | |
994 bra $+4 | |
995 bra menu_new_battery_AA | |
996 | |
618 | 997 movlw 0x02 ; OSTC Sport (USB model) |
998 cpfseq hardware_flag1 | |
999 bra $+4 | |
1000 bra menu_new_battery_AA | |
1001 | |
614 | 1002 movlw 0x13 ; OSTC 2 and Plus |
1003 cpfseq hardware_flag1 | |
1004 bra $+4 | |
1005 bra menu_new_battery_AA_16650 | |
76 | 1006 |
614 | 1007 movlw 0x33 ; OSTC 2 TR |
1008 cpfseq hardware_flag1 | |
1009 bra $+4 | |
1010 bra menu_new_battery_AA_16650 | |
1011 | |
1012 movlw 0x12 ; OSTC Sport | |
1013 cpfseq hardware_flag1 | |
1014 bra $+4 | |
1015 bra menu_new_battery_AA | |
1016 | |
1017 movlw 0x1A ; OSTC 3 /BLE | |
1018 cpfseq hardware_flag1 | |
1019 bra $+4 | |
1020 bra menu_new_battery_AA | |
1021 | |
1022 movlw 0x11 ; OSTC 2 (old model) | |
1023 cpfseq hardware_flag1 | |
1024 bra $+4 | |
1025 bra menu_new_battery_18650 | |
1026 | |
1027 movlw 0x05 ; OSTC 2 cR | |
1028 cpfseq hardware_flag1 | |
1029 bra $+4 | |
1030 bra menu_new_battery_18650 | |
1031 | |
582 | 1032 bra use_old_batteries ; any unsupported value |
1033 | |
614 | 1034 |
1035 do_return_menu_new_bat_AA_16650: | |
1036 call menu_processor_double_pop ; drop exit line and back to last line | |
1037 | |
1038 ; OSTC 2, TR and Plus | |
474 | 1039 menu_new_battery_AA_16650: |
614 | 1040 MENU_BEGIN tNewBattTitle, .4 |
582 | 1041 MENU_CALL tNewBattOld, use_old_batteries |
614 | 1042 MENU_CALL tNewBattNew15, use_new_15V_batteries ; OSTC Plus : not rechargeable |
1043 ; MENU_CALL tNewBattNew36, use_new_36V_batteries ; OSTC Plus : not rechargeable -> not allowed any more !!! | |
1044 MENU_CALL tNewBattAccu, pre_36V_rechargeable ; OSTC Plus : rechargeable -> goto safety question | |
1045 MENU_CALL tNew16650, use_16650_battery ; OSTC 2, TR: rechargeable | |
1046 MENU_END | |
1047 | |
1048 ; OSTC 3 and Sport (no charging function) | |
1049 menu_new_battery_AA: | |
1050 MENU_BEGIN tNewBattTitle, .4 | |
1051 MENU_CALL tNewBattOld, use_old_batteries | |
1052 MENU_CALL tNewBattNew15, use_new_15V_batteries ; not rechargeable | |
1053 MENU_CALL tNewBattNew36, use_new_36V_batteries ; not rechargeable | |
1054 MENU_CALL tNewBattAccu, use_36V_rechargeable ; rechargeable | |
1055 MENU_END | |
1056 | |
1057 ; OSTC 2 (big housing) and cR | |
1058 menu_new_battery_18650: | |
1059 MENU_BEGIN tNewBattTitle, .2 | |
1060 MENU_CALL tNewBattOld, use_old_batteries | |
1061 MENU_CALL tNew18650, use_18650_battery ; rechargeable | |
582 | 1062 MENU_END |
1063 | |
1064 | |
614 | 1065 pre_36V_rechargeable: |
1066 MENU_BEGIN tNewBattTitle, .5 | |
1067 MENU_CALL tConfirmChargeable1, 0 ; safety question, line 1 | |
1068 MENU_CALL tConfirmChargeable2, 0 ; safety question, line 2 | |
1069 MENU_CALL tConfirmChargeable3, 0 ; safety question, line 3 | |
1070 MENU_CALL tNo, do_return_menu_new_bat_AA_16650 ; NO - go back | |
1071 MENU_CALL tYes, use_36V_rechargeable ; YES - confirmed rechargeable | |
582 | 1072 MENU_END |
0 | 1073 |
582 | 1074 |
457 | 1075 global use_old_prior_209 |
1076 use_old_prior_209: | |
1077 clrf EEADRH | |
582 | 1078 read_int_eeprom 0x0F ; =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 |
604 | 1079 incfsz EEDATA,F ; was 0xFF? |
1080 return ; NO - done | |
477
44b8a826b314
NEW: Show battery type in surface mode next to battery voltage
heinrichsweikamp
parents:
474
diff
changeset
|
1081 |
604 | 1082 call lt2942_get_status ; check for gauge IC |
614 | 1083 movlw .3 ; assume a 18650 |
582 | 1084 btfss battery_gauge_available ; cR/2 hardware? |
604 | 1085 movlw .1 ; assume a Saft |
582 | 1086 movwf EEDATA |
604 | 1087 write_int_eeprom 0x0F ; store the new battery type into EEPROM |
457 | 1088 return |
582 | 1089 |
1090 | |
0 | 1091 global use_old_batteries |
1092 use_old_batteries: | |
1093 clrf EEADRH | |
1094 read_int_eeprom 0x07 | |
1095 movff EEDATA,battery_gauge+0 | |
1096 read_int_eeprom 0x08 | |
1097 movff EEDATA,battery_gauge+1 | |
1098 read_int_eeprom 0x09 | |
1099 movff EEDATA,battery_gauge+2 | |
1100 read_int_eeprom 0x0A | |
1101 movff EEDATA,battery_gauge+3 | |
1102 read_int_eeprom 0x0B | |
1103 movff EEDATA,battery_gauge+4 | |
1104 read_int_eeprom 0x0C | |
1105 movff EEDATA,battery_gauge+5 | |
448 | 1106 read_int_eeprom 0x0F |
582 | 1107 movff EEDATA,battery_type ; =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 |
448 | 1108 |
614 | 1109 rcall setup_new_saft ; set a save default, not rechargeable |
1110 | |
604 | 1111 incf EEDATA,F ; 1...5 |
450 | 1112 dcfsnz EEDATA,F |
604 | 1113 rcall setup_new_15v ; =0 |
450 | 1114 dcfsnz EEDATA,F |
604 | 1115 rcall setup_new_saft ; =1 |
450 | 1116 dcfsnz EEDATA,F |
604 | 1117 rcall setup_new_panasonic ; =2 |
582 | 1118 dcfsnz EEDATA,F |
604 | 1119 rcall setup_new_18650 ; =3 |
582 | 1120 dcfsnz EEDATA,F |
604 | 1121 rcall setup_new_16650 ; =4 |
582 | 1122 |
1123 bcf use_old_batt_flag ; clear flag | |
604 | 1124 |
1125 IFNDEF _screendump | |
614 | 1126 bcf disable_comm_mode ; re-enable COMM mode again |
604 | 1127 ENDIF |
1128 | |
1129 goto surfloop ; jump to surface loop | |
582 | 1130 |
0 | 1131 |
472
4fdf6886004b
CHANGE: Show warnings either in Customview (If active) _or_ next to warning sign
heinrichsweikamp
parents:
470
diff
changeset
|
1132 setup_new_15v: |
582 | 1133 bsf charge_disable |
1134 bcf TRISE,2 | |
1135 movlw .100 | |
604 | 1136 movwf batt_percent ; to have 1.5V batteries right after firmware update |
582 | 1137 movlw .0 |
1138 movff WREG,battery_type | |
1139 return | |
1140 | |
1141 | |
448 | 1142 setup_new_saft: |
582 | 1143 banksel battery_capacity |
1144 movlw LOW internal_saft_capacity | |
1145 movwf internal_battery_capacity+0 | |
1146 movlw HIGH internal_saft_capacity | |
1147 movwf internal_battery_capacity+1 | |
1148 movlw LOW saft_capacity | |
1149 movwf battery_capacity+0 | |
1150 movlw HIGH saft_capacity | |
1151 movwf battery_capacity+1 | |
1152 movlw LOW saft_offset | |
1153 movwf battery_offset+0 | |
1154 movlw HIGH saft_offset | |
1155 movwf battery_offset+1 | |
1156 banksel common | |
1157 bsf charge_disable | |
1158 bcf TRISE,2 | |
1159 movlw .1 | |
1160 movff WREG,battery_type | |
1161 return | |
1162 | |
448 | 1163 |
582 | 1164 setup_new_panasonic: |
604 | 1165 banksel battery_capacity |
582 | 1166 movlw LOW internal_panasonic_capacity |
1167 movwf internal_battery_capacity+0 | |
1168 movlw HIGH internal_panasonic_capacity | |
1169 movwf internal_battery_capacity+1 | |
1170 movlw LOW panasonic_capacity | |
1171 movwf battery_capacity+0 | |
1172 movlw HIGH panasonic_capacity | |
1173 movwf battery_capacity+1 | |
1174 movlw LOW panasonic_offset | |
1175 movwf battery_offset+0 | |
1176 movlw HIGH panasonic_offset | |
1177 movwf battery_offset+1 | |
1178 banksel common | |
1179 bcf charge_disable | |
1180 bsf TRISE,2 | |
1181 movlw .2 | |
1182 movff WREG,battery_type | |
1183 return | |
472
4fdf6886004b
CHANGE: Show warnings either in Customview (If active) _or_ next to warning sign
heinrichsweikamp
parents:
470
diff
changeset
|
1184 |
582 | 1185 |
1186 setup_new_18650: | |
1187 banksel battery_capacity | |
1188 clrf internal_battery_capacity+0 | |
1189 clrf internal_battery_capacity+1 | |
1190 movlw LOW ncr18650_capacity | |
1191 movwf battery_capacity+0 | |
1192 movlw HIGH ncr18650_capacity | |
1193 movwf battery_capacity+1 | |
1194 movlw LOW ncr18650_offset | |
1195 movwf battery_offset+0 | |
1196 movlw HIGH ncr18650_offset | |
1197 movwf battery_offset+1 | |
1198 banksel common | |
1199 bcf charge_disable | |
1200 bsf TRISE,2 | |
1201 movlw .3 | |
1202 movff WREG,battery_type | |
1203 return | |
1204 | |
472
4fdf6886004b
CHANGE: Show warnings either in Customview (If active) _or_ next to warning sign
heinrichsweikamp
parents:
470
diff
changeset
|
1205 |
4fdf6886004b
CHANGE: Show warnings either in Customview (If active) _or_ next to warning sign
heinrichsweikamp
parents:
470
diff
changeset
|
1206 setup_new_16650: |
582 | 1207 banksel battery_capacity |
1208 clrf internal_battery_capacity+0 | |
1209 clrf internal_battery_capacity+1 | |
1210 movlw LOW ur16650_capacity | |
1211 movwf battery_capacity+0 | |
1212 movlw HIGH ur16650_capacity | |
1213 movwf battery_capacity+1 | |
1214 movlw LOW ur16650_offset | |
1215 movwf battery_offset+0 | |
1216 movlw HIGH ur16650_offset | |
1217 movwf battery_offset+1 | |
1218 banksel common | |
1219 bcf charge_disable | |
1220 bsf TRISE,2 | |
1221 movlw .4 | |
1222 movff WREG,battery_type | |
1223 return | |
1224 | |
472
4fdf6886004b
CHANGE: Show warnings either in Customview (If active) _or_ next to warning sign
heinrichsweikamp
parents:
470
diff
changeset
|
1225 |
474 | 1226 use_16650_battery: |
582 | 1227 rcall setup_new_16650 |
604 | 1228 bra use_batt_exit |
448 | 1229 use_18650_battery: |
582 | 1230 rcall setup_new_18650 |
604 | 1231 bra use_batt_exit |
0 | 1232 use_new_36V_batteries: |
582 | 1233 rcall setup_new_saft |
604 | 1234 bra use_batt_exit |
448 | 1235 use_new_15V_batteries: |
582 | 1236 rcall setup_new_15v |
604 | 1237 use_batt_exit: |
1238 call reset_battery_pointer ; resets battery pointer 0x07-0x0C and battery_gauge:5 | |
1239 use_batt_exit1: | |
1240 | |
1241 IFNDEF _screendump | |
614 | 1242 bcf disable_comm_mode ; re-enable COMM mode again |
604 | 1243 ENDIF |
1244 | |
1245 goto surfloop ; jump to surface loop | |
1246 | |
448 | 1247 use_36V_rechargeable: |
582 | 1248 rcall setup_new_panasonic |
1249 call reset_battery_internal_only | |
604 | 1250 bra use_batt_exit1 ; jump to surface loop |
0 | 1251 |
582 | 1252 END |