Mercurial > public > hwos_code
annotate src/menu_tree.asm @ 610:2ce43f09586e
Mod for new pcb designs
author | heinrichsweikamp |
---|---|
date | Wed, 09 Jan 2019 18:35:20 +0100 |
parents | 6341f6663579 |
children | a32212cd5ea9 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
604 | 3 ; File menu_tree.asm REFACTORED VERSION V2.99e |
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 | |
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) | |
958 call TFT_Display_FadeIn ; show splash | |
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 |
604 | 979 ; hardware_flag1: |
582 | 980 ; 3: 0x0A or 0x13 (2016) |
981 ; cR: 0x05 | |
982 ; 2 with BLE: 0x11 | |
983 ; Sport: 0x12 | |
984 ; 3 with BLE: 0x1A | |
76 | 985 |
609 | 986 movlw 0x0A |
987 cpfseq hardware_flag1 | |
988 bra $+4 | |
989 bra menu_new_battery_AA | |
990 movlw 0x13 | |
991 cpfseq hardware_flag1 | |
992 bra $+4 | |
993 bra menu_new_battery_16650 | |
994 movlw 0x33 | |
995 cpfseq hardware_flag1 | |
996 bra $+4 | |
997 bra menu_new_battery_AA_16650 | |
998 movlw 0x12 | |
999 cpfseq hardware_flag1 | |
1000 bra $+4 | |
1001 bra menu_new_battery_AA | |
1002 movlw 0x1A | |
1003 cpfseq hardware_flag1 | |
1004 bra $+4 | |
1005 bra menu_new_battery_AA | |
1006 movlw 0x11 | |
1007 cpfseq hardware_flag1 | |
1008 bra $+4 | |
1009 bra menu_new_battery_18650 | |
1010 movlw 0x05 | |
1011 cpfseq hardware_flag1 | |
1012 bra $+4 | |
1013 bra menu_new_battery_18650 | |
582 | 1014 bra use_old_batteries ; any unsupported value |
1015 | |
609 | 1016 menu_new_battery_16650: |
1017 MENU_BEGIN tNewBattTitle, .1 | |
1018 MENU_CALL tNew16650, use_16650_battery | |
1019 MENU_END | |
1020 | |
474 | 1021 menu_new_battery_AA_16650: |
582 | 1022 MENU_BEGIN tNewBattTitle, .5 |
1023 MENU_CALL tNewBattOld, use_old_batteries | |
600 | 1024 MENU_CALL tNewBattNew15, use_new_15V_batteries |
582 | 1025 MENU_CALL tNewBattNew36, use_new_36V_batteries |
1026 MENU_CALL tNewBattAccu, use_36V_rechargeable | |
1027 MENU_CALL tNew16650, use_16650_battery | |
1028 MENU_END | |
1029 | |
1030 | |
464
0491a84fd0b8
CHANGE: Easier to understand "New Battery" menu (OSTC model dependent)
heinrichsweikamp
parents:
457
diff
changeset
|
1031 menu_new_battery_AA: |
582 | 1032 MENU_BEGIN tNewBattTitle, .4 |
1033 MENU_CALL tNewBattOld, use_old_batteries | |
600 | 1034 MENU_CALL tNewBattNew15, use_new_15V_batteries |
582 | 1035 MENU_CALL tNewBattNew36, use_new_36V_batteries |
1036 MENU_CALL tNewBattAccu, use_36V_rechargeable | |
1037 MENU_END | |
1038 | |
464
0491a84fd0b8
CHANGE: Easier to understand "New Battery" menu (OSTC model dependent)
heinrichsweikamp
parents:
457
diff
changeset
|
1039 |
0491a84fd0b8
CHANGE: Easier to understand "New Battery" menu (OSTC model dependent)
heinrichsweikamp
parents:
457
diff
changeset
|
1040 menu_new_battery_18650: |
582 | 1041 MENU_BEGIN tNewBattTitle, .2 |
1042 MENU_CALL tNewBattOld, use_old_batteries | |
1043 MENU_CALL tNew18650, use_18650_battery | |
1044 MENU_END | |
0 | 1045 |
582 | 1046 |
457 | 1047 global use_old_prior_209 |
1048 use_old_prior_209: | |
1049 clrf EEADRH | |
582 | 1050 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 | 1051 incfsz EEDATA,F ; was 0xFF? |
1052 return ; NO - done | |
477
44b8a826b314
NEW: Show battery type in surface mode next to battery voltage
heinrichsweikamp
parents:
474
diff
changeset
|
1053 |
604 | 1054 call lt2942_get_status ; check for gauge IC |
582 | 1055 movlw .3 ; Assume a 18650 |
1056 btfss battery_gauge_available ; cR/2 hardware? | |
604 | 1057 movlw .1 ; assume a Saft |
582 | 1058 movwf EEDATA |
604 | 1059 write_int_eeprom 0x0F ; store the new battery type into EEPROM |
457 | 1060 return |
582 | 1061 |
1062 | |
0 | 1063 global use_old_batteries |
1064 use_old_batteries: | |
1065 clrf EEADRH | |
1066 read_int_eeprom 0x07 | |
1067 movff EEDATA,battery_gauge+0 | |
1068 read_int_eeprom 0x08 | |
1069 movff EEDATA,battery_gauge+1 | |
1070 read_int_eeprom 0x09 | |
1071 movff EEDATA,battery_gauge+2 | |
1072 read_int_eeprom 0x0A | |
1073 movff EEDATA,battery_gauge+3 | |
1074 read_int_eeprom 0x0B | |
1075 movff EEDATA,battery_gauge+4 | |
1076 read_int_eeprom 0x0C | |
1077 movff EEDATA,battery_gauge+5 | |
448 | 1078 read_int_eeprom 0x0F |
582 | 1079 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 | 1080 |
604 | 1081 rcall setup_new_saft ; any other value |
1082 incf EEDATA,F ; 1...5 | |
450 | 1083 dcfsnz EEDATA,F |
604 | 1084 rcall setup_new_15v ; =0 |
450 | 1085 dcfsnz EEDATA,F |
604 | 1086 rcall setup_new_saft ; =1 |
450 | 1087 dcfsnz EEDATA,F |
604 | 1088 rcall setup_new_panasonic ; =2 |
582 | 1089 dcfsnz EEDATA,F |
604 | 1090 rcall setup_new_18650 ; =3 |
582 | 1091 dcfsnz EEDATA,F |
604 | 1092 rcall setup_new_16650 ; =4 |
582 | 1093 |
1094 bcf use_old_batt_flag ; clear flag | |
604 | 1095 |
1096 IFNDEF _screendump | |
1097 bcf disable_comm_mode ; re-enable COMM mode again | |
1098 ENDIF | |
1099 | |
1100 goto surfloop ; jump to surface loop | |
582 | 1101 |
0 | 1102 |
472
4fdf6886004b
CHANGE: Show warnings either in Customview (If active) _or_ next to warning sign
heinrichsweikamp
parents:
470
diff
changeset
|
1103 setup_new_15v: |
582 | 1104 bsf charge_disable |
1105 bcf TRISE,2 | |
1106 movlw .100 | |
604 | 1107 movwf batt_percent ; to have 1.5V batteries right after firmware update |
582 | 1108 movlw .0 |
1109 movff WREG,battery_type | |
1110 return | |
1111 | |
1112 | |
448 | 1113 setup_new_saft: |
582 | 1114 banksel battery_capacity |
1115 movlw LOW internal_saft_capacity | |
1116 movwf internal_battery_capacity+0 | |
1117 movlw HIGH internal_saft_capacity | |
1118 movwf internal_battery_capacity+1 | |
1119 movlw LOW saft_capacity | |
1120 movwf battery_capacity+0 | |
1121 movlw HIGH saft_capacity | |
1122 movwf battery_capacity+1 | |
1123 movlw LOW saft_offset | |
1124 movwf battery_offset+0 | |
1125 movlw HIGH saft_offset | |
1126 movwf battery_offset+1 | |
1127 banksel common | |
1128 bsf charge_disable | |
1129 bcf TRISE,2 | |
1130 movlw .1 | |
1131 movff WREG,battery_type | |
1132 return | |
1133 | |
448 | 1134 |
582 | 1135 setup_new_panasonic: |
604 | 1136 banksel battery_capacity |
582 | 1137 movlw LOW internal_panasonic_capacity |
1138 movwf internal_battery_capacity+0 | |
1139 movlw HIGH internal_panasonic_capacity | |
1140 movwf internal_battery_capacity+1 | |
1141 movlw LOW panasonic_capacity | |
1142 movwf battery_capacity+0 | |
1143 movlw HIGH panasonic_capacity | |
1144 movwf battery_capacity+1 | |
1145 movlw LOW panasonic_offset | |
1146 movwf battery_offset+0 | |
1147 movlw HIGH panasonic_offset | |
1148 movwf battery_offset+1 | |
1149 banksel common | |
1150 bcf charge_disable | |
1151 bsf TRISE,2 | |
1152 movlw .2 | |
1153 movff WREG,battery_type | |
1154 return | |
472
4fdf6886004b
CHANGE: Show warnings either in Customview (If active) _or_ next to warning sign
heinrichsweikamp
parents:
470
diff
changeset
|
1155 |
582 | 1156 |
1157 setup_new_18650: | |
1158 banksel battery_capacity | |
1159 clrf internal_battery_capacity+0 | |
1160 clrf internal_battery_capacity+1 | |
1161 movlw LOW ncr18650_capacity | |
1162 movwf battery_capacity+0 | |
1163 movlw HIGH ncr18650_capacity | |
1164 movwf battery_capacity+1 | |
1165 movlw LOW ncr18650_offset | |
1166 movwf battery_offset+0 | |
1167 movlw HIGH ncr18650_offset | |
1168 movwf battery_offset+1 | |
1169 banksel common | |
1170 bcf charge_disable | |
1171 bsf TRISE,2 | |
1172 movlw .3 | |
1173 movff WREG,battery_type | |
1174 return | |
1175 | |
472
4fdf6886004b
CHANGE: Show warnings either in Customview (If active) _or_ next to warning sign
heinrichsweikamp
parents:
470
diff
changeset
|
1176 |
4fdf6886004b
CHANGE: Show warnings either in Customview (If active) _or_ next to warning sign
heinrichsweikamp
parents:
470
diff
changeset
|
1177 setup_new_16650: |
582 | 1178 banksel battery_capacity |
1179 clrf internal_battery_capacity+0 | |
1180 clrf internal_battery_capacity+1 | |
1181 movlw LOW ur16650_capacity | |
1182 movwf battery_capacity+0 | |
1183 movlw HIGH ur16650_capacity | |
1184 movwf battery_capacity+1 | |
1185 movlw LOW ur16650_offset | |
1186 movwf battery_offset+0 | |
1187 movlw HIGH ur16650_offset | |
1188 movwf battery_offset+1 | |
1189 banksel common | |
1190 bcf charge_disable | |
1191 bsf TRISE,2 | |
1192 movlw .4 | |
1193 movff WREG,battery_type | |
1194 return | |
1195 | |
472
4fdf6886004b
CHANGE: Show warnings either in Customview (If active) _or_ next to warning sign
heinrichsweikamp
parents:
470
diff
changeset
|
1196 |
474 | 1197 use_16650_battery: |
582 | 1198 rcall setup_new_16650 |
604 | 1199 bra use_batt_exit |
448 | 1200 use_18650_battery: |
582 | 1201 rcall setup_new_18650 |
604 | 1202 bra use_batt_exit |
0 | 1203 use_new_36V_batteries: |
582 | 1204 rcall setup_new_saft |
604 | 1205 bra use_batt_exit |
448 | 1206 use_new_15V_batteries: |
582 | 1207 rcall setup_new_15v |
604 | 1208 use_batt_exit: |
1209 call reset_battery_pointer ; resets battery pointer 0x07-0x0C and battery_gauge:5 | |
1210 use_batt_exit1: | |
1211 | |
1212 IFNDEF _screendump | |
1213 bcf disable_comm_mode ; re-enable COMM mode again | |
1214 ENDIF | |
1215 | |
1216 goto surfloop ; jump to surface loop | |
1217 | |
448 | 1218 use_36V_rechargeable: |
582 | 1219 rcall setup_new_panasonic |
1220 call reset_battery_internal_only | |
604 | 1221 bra use_batt_exit1 ; jump to surface loop |
0 | 1222 |
582 | 1223 END |