Mercurial > public > hwos_code
annotate src/menu_tree.asm @ 586:06642f6ffe59
2.97 release
author | heinrichsweikamp |
---|---|
date | Thu, 01 Mar 2018 11:12:47 +0100 |
parents | b455b31ce022 |
children | cb59872ad53d |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
582 | 3 ; File menu_tree.asm REFACTORED VERSION V2.98 |
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 | |
582 | 12 #include "hwos.inc" ; Mandatory header |
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" | |
21 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c | |
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 | |
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
155
diff
changeset
|
42 |
582 | 43 |
44 gui CODE | |
45 | |
0 | 46 ;============================================================================= |
47 ; Main Menu | |
582 | 48 |
49 do_return_main_menu: | |
50 call menu_processor_double_pop ; drop exit line and back to last line | |
51 bra do_main_menu_common | |
52 | |
53 global do_main_menu | |
0 | 54 do_main_menu: |
582 | 55 movff menupos3,customview_surfmode ; save last customview |
0 | 56 |
582 | 57 global do_main_menu2 |
58 do_main_menu2: ; entry point used by logbook.asm | |
59 call TFT_boot | |
60 bcf sleepmode ; for timeout | |
61 call menu_processor_reset ; restart from first icon | |
0 | 62 |
582 | 63 do_main_menu_common: |
64 MENU_BEGIN tMainMenu, .7 | |
65 MENU_CALL tLogbook, logbook | |
66 MENU_CALL tGasSetup, do_gas_menu | |
67 MENU_CALL tCCRSetup, do_ccr_menu | |
68 MENU_CALL tPlan, do_planner_menu | |
69 MENU_CALL tDiveModeMenu, do_divemode_menu | |
70 MENU_CALL tSystSets, do_settings_menu | |
71 MENU_CALL tExit, restart | |
72 MENU_END | |
73 | |
0 | 74 |
75 ;============================================================================= | |
76 ; CCR Setup | |
77 | |
582 | 78 do_return_ccr_menu: |
79 call menu_processor_double_pop ; drop exit line and back to last line | |
0 | 80 |
81 do_ccr_menu: | |
582 | 82 bcf menu_show_sensors2 ; stop imprinting of live sensor values |
560 | 83 |
582 | 84 btfsc analog_o2_input |
85 bra do_ccr_menu_cR | |
86 | |
87 ; COMMENTED OUT - currently there is no difference between the OSTC 2 and 3 regarding this menu | |
88 ; btfss optical_input | |
89 ; bra do_ccr_menu_ostc2 | |
240 | 90 |
582 | 91 MENU_BEGIN tCCRSetup, .6 ; OSTC3 menu (and currently also the OSTC2 menu) |
92 MENU_OPTION tCCRMode, oCCRMode, 0 | |
93 MENU_CALL tDiluentSetup, do_diluent_setup | |
94 MENU_CALL tFixedSetpoints, do_fixed_setpoints | |
95 MENU_CALL tPSCRMenu, do_PSCR_menu | |
96 MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 | |
97 MENU_CALL tExit, do_return_main_menu | |
98 MENU_END | |
99 | |
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
155
diff
changeset
|
100 |
582 | 101 do_ccr_menu_cR: ; cR menu |
102 MENU_BEGIN tCCRSetup, .7 | |
103 MENU_OPTION tCCRMode, oCCRMode, 0 | |
104 MENU_CALL tCalibrateMenu, do_calibrate_menu | |
105 MENU_CALL tDiluentSetup, do_diluent_setup | |
106 MENU_CALL tFixedSetpoints, do_fixed_setpoints | |
107 MENU_CALL tPSCRMenu, do_PSCR_menu | |
108 MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 | |
109 MENU_CALL tExit, do_return_main_menu | |
110 MENU_END | |
0 | 111 |
582 | 112 ; COMMENTED OUT - currently there is no difference between the OSTC 2 and 3 regarding this menu |
560 | 113 ;do_ccr_menu_ostc2: |
582 | 114 ; MENU_BEGIN tCCRSetup, .6 ; ostc2 menu |
115 ; MENU_OPTION tCCRMode, oCCRMode, 0 | |
116 ; MENU_CALL tDiluentSetup, do_diluent_setup | |
117 ; MENU_CALL tFixedSetpoints, do_fixed_setpoints | |
118 ; MENU_CALL tPSCRMenu, do_PSCR_menu | |
119 ; MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 | |
120 ; MENU_CALL tExit, do_return_main_menu | |
121 ; MENU_END | |
240 | 122 |
123 | |
113 | 124 do_calibrate_menu: |
582 | 125 call enable_ir_s8 ; Enable IR/S8-Port |
126 bsf menu_show_sensors2 ; start imprinting of live sensor values | |
127 | |
113 | 128 do_calibrate_menu2: |
582 | 129 MENU_BEGIN tCalibrateMenu, .6 |
130 MENU_CALL tDiveHudMask1, 0 | |
131 MENU_CALL tDiveHudMask2, 0 | |
132 MENU_CALL tDiveHudMask3, 0 | |
133 MENU_OPTION tCalibrationGas,oCalGasO2, 0 | |
134 MENU_CALL tCalibrate, do_calibrate_mix | |
135 MENU_CALL tExit, do_return_ccr_menu | |
136 MENU_END | |
137 | |
113 | 138 |
139 do_calibrate_mix: | |
582 | 140 call calibrate_mix ; Calibrate with opt_calibration_O2_ratio, also calibrate S8 HUD if connected |
141 WAITMS d'250' ; Wait for HUD v3 | |
142 movlw .9 | |
143 movff WREG,customview_surfmode ; show sensor mV custom view after restart | |
144 goto restart ; Restart into surface mode | |
113 | 145 |
0 | 146 |
147 do_diluent_setup: | |
582 | 148 bsf ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") |
149 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
150 call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth | |
151 | |
152 MENU_BEGIN tDiluentSetup, .6 | |
153 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
154 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
155 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
156 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
157 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
158 MENU_CALL tExit, do_return_ccr_menu | |
159 MENU_END | |
160 | |
0 | 161 |
162 do_return_fixed_setpoints: | |
582 | 163 call menu_processor_double_pop ; drop exit line and back to last line |
0 | 164 |
165 do_fixed_setpoints: | |
582 | 166 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint |
167 | |
168 MENU_BEGIN tFixedSetpoints, .6 | |
169 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
170 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
171 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
172 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
173 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
174 MENU_CALL tExit, do_return_ccr_menu | |
175 MENU_END | |
176 | |
0 | 177 |
178 do_edit_sp_menu: | |
582 | 179 call gaslist_setSP ; Save current item. |
180 | |
181 MENU_BEGIN tFixedSetpoints, .5 | |
182 MENU_DYNAMIC gaslist_strcat_setpoint_0, 0 | |
183 MENU_CALL tSPPlus, gaslist_spplus | |
184 MENU_CALL tDepthPlus, gaslist_spdepthplus | |
185 MENU_CALL tDepthMinus, gaslist_spdepthminus | |
186 MENU_CALL tExit, do_return_fixed_setpoints | |
187 MENU_END | |
188 | |
189 | |
190 do_PSCR_menu: | |
191 MENU_BEGIN tPSCRMenu, .3 ; PSCR Menu | |
192 MENU_OPTION tPSCR_O2_drop, oPSCR_drop, 0 | |
193 MENU_OPTION tPSCR_lungratio, oPSCR_lungratio, 0 | |
194 MENU_CALL tExit, do_return_ccr_menu | |
195 MENU_END | |
0 | 196 |
197 ;============================================================================= | |
198 ; OC Gas Setup | |
199 | |
582 | 200 do_return_gas_menu: |
201 call menu_processor_double_pop ; drop exit line and back to last line | |
0 | 202 |
582 | 203 btfsc ccr_diluent_setup ; Return to CCR-Menu? |
204 bra do_diluent_setup ; Yes. | |
205 | |
0 | 206 do_gas_menu: |
582 | 207 bcf ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") |
208 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
209 call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth | |
0 | 210 |
582 | 211 MENU_BEGIN tGaslist, .6 |
212 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
213 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
214 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
215 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
216 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
217 MENU_CALL tExit, do_return_main_menu | |
218 MENU_END | |
219 | |
220 | |
221 do_return_edit_gas_menu: | |
222 call menu_processor_pop ; drop exit line and ... | |
223 do_abort_gas_depth_menu: | |
224 call menu_processor_pop ; back to last line | |
225 bra do_edit_gas_menu_common | |
0 | 226 |
227 do_edit_gas_menu: | |
582 | 228 call gaslist_setgas ; set gaslist_gas |
229 | |
230 do_edit_gas_menu_common: ; keep current gas | |
231 MENU_BEGIN tGasEdit, .6 | |
232 MENU_DYNAMIC gaslist_gastitle, 0 | |
233 MENU_DYNAMIC gaslist_MOD_END, 0 | |
234 MENU_DYNAMIC gaslist_show_type, gaslist_toggle_type | |
235 MENU_CALL tSetup_mix, do_setup_mix | |
236 MENU_CALL tGasDepth, do_gas_depth_menu | |
237 MENU_CALL tExit, do_return_gas_menu | |
238 MENU_END | |
239 | |
0 | 240 |
241 do_setup_mix: | |
582 | 242 MENU_BEGIN tGasEdit, .7 |
243 MENU_DYNAMIC gaslist_gastitle, 0 | |
244 MENU_DYNAMIC gaslist_MOD_END, 0 | |
245 MENU_CALL tO2Plus, gaslist_pO2 | |
246 MENU_CALL tO2Minus, gaslist_mO2 | |
247 MENU_CALL tHePlus, gaslist_pHe | |
248 MENU_CALL tHeMinus, gaslist_mHe | |
249 MENU_CALL tExit, do_return_edit_gas_menu | |
250 MENU_END | |
428 | 251 |
560 | 252 |
0 | 253 do_gas_depth_menu: |
582 | 254 movff gaslist_gas,WREG |
255 lfsr FSR1,opt_gas_type ; Read opt_gas_type[WREG] | |
256 movff PLUSW1,lo ; Used as temp | |
257 movlw .3 ; 3=Deco | |
258 btfsc ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") | |
259 movlw .2 ; 2=Normal | |
260 cpfseq lo | |
261 bra do_abort_gas_depth_menu ; Non-Deco gas or "Normal" Diluent, abort! | |
174
932e91074bdb
CHANGE: Clarify Travel Gases with "---" as change depth
heinrichsweikamp
parents:
155
diff
changeset
|
262 |
582 | 263 MENU_BEGIN tGasEdit, .7 |
264 MENU_DYNAMIC gaslist_gastitle, 0 | |
265 MENU_DYNAMIC gaslist_MOD_END, 0 | |
266 MENU_DYNAMIC gaslist_ppo2, 0 ; ppO2 at change depth | |
267 MENU_CALL tDepthPlus, gaslist_pDepth | |
268 MENU_CALL tDepthMinus, gaslist_mDepth | |
269 MENU_DYNAMIC gaslist_reset_mod_title, gaslist_reset_mod | |
270 MENU_CALL tExit, do_return_edit_gas_menu | |
271 MENU_END | |
0 | 272 |
582 | 273 |
0 | 274 ;============================================================================= |
275 ; Simulator menus | |
276 | |
582 | 277 do_return_planner_menu: |
278 call menu_processor_pop ; drop exit line and ... | |
0 | 279 |
582 | 280 global do_return_demo_planner |
281 do_return_demo_planner: | |
282 call menu_processor_pop ; back to last line | |
283 bra do_planner_common | |
0 | 284 |
285 do_planner_menu: | |
582 | 286 ; to have correct simulator results after mode changes without prior excursion to surfacemode |
287 call option_save_all | |
288 call restart_set_modes_and_flags | |
289 ; Reset dive time/depth to default values | |
290 lfsr FSR0,odiveInterval | |
291 call option_reset | |
292 lfsr FSR0,obottomTime | |
293 call option_reset | |
294 lfsr FSR0,obottomDepth | |
295 call option_reset | |
296 | |
297 do_planner_common: | |
298 MENU_BEGIN tPlan, .7 | |
299 MENU_OPTION tIntvl, odiveInterval, 0 | |
300 MENU_OPTION tBtDep, obottomDepth, 0 | |
301 MENU_CALL tInter, do_demo_divemode | |
302 MENU_OPTION tBtTm, obottomTime, 0 | |
303 MENU_CALL tDecoSetup, do_planner_config | |
304 MENU_CALL tDeco, do_demo_planner | |
305 MENU_CALL tExit, do_return_main_menu | |
306 MENU_END | |
0 | 307 |
560 | 308 |
298
2fe34fc0e2ae
new submenu for gas consumption, show actual mix instead of GAS1-GAS5 in deco planner
heinrichsweikamp
parents:
275
diff
changeset
|
309 do_planner_config: |
582 | 310 MENU_BEGIN tPlan, .3 |
311 MENU_OPTION tSelectSetpoint, oSimSetpoint, 0 | |
312 MENU_OPTION tuseAGF, oSimAGF, 0 | |
313 MENU_CALL tExit, do_return_planner_menu | |
314 MENU_END | |
524 | 315 |
298
2fe34fc0e2ae
new submenu for gas consumption, show actual mix instead of GAS1-GAS5 in deco planner
heinrichsweikamp
parents:
275
diff
changeset
|
316 |
0 | 317 ;============================================================================= |
318 ; Divemode menu | |
319 | |
320 do_return_divemode_menu: | |
582 | 321 call menu_processor_double_pop ; drop exit line and back to last line |
0 | 322 |
323 do_divemode_menu: | |
582 | 324 MENU_BEGIN tDiveModeMenu, .7 |
325 MENU_OPTION tDvMode, oDiveMode, 0 | |
326 MENU_OPTION tDkMode, oDecoMode, 0 | |
327 MENU_CALL tppO2settings, do_ppo2_menu | |
328 MENU_OPTION tsafetystopmenu, oSafetyStop, 0 | |
329 MENU_CALL t2ndDecoPlanMenu, do_2nd_deco_plan_menu | |
330 MENU_CALL tDecoparameters, do_decoparameters_menu | |
331 MENU_CALL tExit, do_return_main_menu | |
332 MENU_END | |
333 | |
0 | 334 |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
90
diff
changeset
|
335 do_ppo2_menu: |
582 | 336 MENU_BEGIN tppO2settings, .6 |
337 MENU_DYNAMIC divesets_ppo2_max, do_toggle_ppo2_max | |
338 MENU_DYNAMIC divesets_ppo2_max_deco, do_toggle_ppo2_max_deco | |
339 MENU_DYNAMIC divesets_ppo2_min, do_toggle_ppo2_min | |
340 MENU_DYNAMIC divesets_ppo2_min_cc, do_toggle_ppo2_min_cc | |
341 MENU_OPTION tShowppO2, oShowppO2, 0 | |
342 MENU_CALL tExit, do_return_divemode_menu | |
343 MENU_END | |
344 | |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
90
diff
changeset
|
345 |
0 | 346 do_return_decoparameters_menu: |
582 | 347 call menu_processor_double_pop ; drop exit line and back to last line |
348 | |
349 do_decoparameters_menu: | |
350 movff char_I_deco_model,lo ; 0 = ZH-L16, 1 = ZH-L16-GF | |
351 tstfsz lo | |
352 bra do_decoparameters_menugf ; <> 0 -> GF menu! | |
353 ; NON-GF menu | |
354 MENU_BEGIN tDecoparameters, .4 | |
355 MENU_OPTION tSaturationMult, osatmult, 0 | |
356 MENU_OPTION tDesaturationMult, odesatmult, 0 | |
357 MENU_OPTION tLastDecostop, oLastDeco, 0 | |
358 MENU_CALL tExit, do_return_divemode_menu | |
359 MENU_END | |
360 | |
562
8b7ea27ea1fa
seperate desat and sat multipliers for GF and Non-GF modes. Set to 100/100 as default in GF mode
heinrichsweikamp
parents:
560
diff
changeset
|
361 do_decoparameters_menugf: |
582 | 362 ; GF menu |
363 MENU_BEGIN tDecoparameters, .7 | |
364 MENU_OPTION tGF_low, oGF_low, 0 | |
365 MENU_OPTION tGF_high, oGF_high, 0 | |
366 MENU_CALL taGFMenu, do_aGF_menu | |
367 MENU_OPTION tSaturationMult, osatmultgf, 0 | |
368 MENU_OPTION tDesaturationMult, odesatmultgf, 0 | |
369 MENU_OPTION tLastDecostop, oLastDeco, 0 | |
370 MENU_CALL tExit, do_return_divemode_menu | |
371 MENU_END | |
0 | 372 |
560 | 373 |
374 do_return_2nd_deco_plan_menu: | |
582 | 375 call menu_processor_double_pop ; drop exit line and back to last line |
560 | 376 |
377 do_2nd_deco_plan_menu | |
582 | 378 MENU_BEGIN t2ndDecoPlanMenu, .7 |
379 MENU_OPTION tFTTSMenu, oExtraTime, 0 | |
380 MENU_OPTION tCalcAscGas, oCalcAscGas, 0 | |
381 MENU_OPTION tSetBotUse, obottom_usage, 0 | |
382 MENU_OPTION tSetDecoUse, odeco_usage, 0 | |
383 MENU_CALL tTankSizes, do_tank_sizes_menu | |
384 MENU_CALL tTankFillPress, do_tank_fill_press_menu | |
385 MENU_CALL tExit, do_return_divemode_menu | |
386 MENU_END | |
560 | 387 |
388 | |
389 do_tank_sizes_menu: | |
582 | 390 MENU_BEGIN tTankSizes, .6 |
391 MENU_OPTION tGas1, oTankSize1, 0 | |
392 MENU_OPTION tGas2, oTankSize2, 0 | |
393 MENU_OPTION tGas3, oTankSize3, 0 | |
394 MENU_OPTION tGas4, oTankSize4, 0 | |
395 MENU_OPTION tGas5, oTankSize5, 0 | |
396 MENU_CALL tExit, do_return_2nd_deco_plan_menu | |
397 MENU_END | |
560 | 398 |
399 | |
400 do_tank_fill_press_menu: | |
582 | 401 MENU_BEGIN tTankFillPress, .6 |
402 MENU_OPTION tGas1, oTankFillPres1, 0 | |
403 MENU_OPTION tGas2, oTankFillPres2, 0 | |
404 MENU_OPTION tGas3, oTankFillPres3, 0 | |
405 MENU_OPTION tGas4, oTankFillPres4, 0 | |
406 MENU_OPTION tGas5, oTankFillPres5, 0 | |
407 MENU_CALL tExit, do_return_2nd_deco_plan_menu | |
408 MENU_END | |
560 | 409 |
582 | 410 |
0 | 411 do_aGF_menu: |
582 | 412 MENU_BEGIN taGFMenu, .4 |
413 MENU_OPTION taGF_enable, oEnable_aGF, 0 | |
414 MENU_OPTION taGF_low, oaGF_low, 0 | |
415 MENU_OPTION taGF_high, oaGF_high, 0 | |
416 MENU_CALL tExit, do_return_decoparameters_menu | |
417 MENU_END | |
560 | 418 |
419 | |
0 | 420 ;============================================================================= |
421 ; Setup Menu | |
422 | |
582 | 423 do_return_settings_deeper: ; entry point for return from set time/date sub-menu |
424 bcf settime_setdate ; clear flag | |
425 call menu_processor_pop ; drop one more stack entry | |
426 | |
0 | 427 do_return_settings: |
582 | 428 call menu_processor_double_pop ; drop exit line and back to last line |
429 | |
0 | 430 do_settings_menu: |
582 | 431 btfsc ble_available ; ble available? |
432 bra do_settings_menu_ble ; YES | |
433 | |
434 MENU_BEGIN tSystSets, .6 | |
435 MENU_CALL tInfoMenu, do_info_menu | |
436 MENU_CALL tSetTimeDate, do_date_time_menu | |
437 MENU_CALL tDispSets, do_dispsets_menu | |
438 MENU_OPTION tLanguage, oLanguage, 0 | |
439 MENU_CALL tMore, do_settings_menu_more | |
440 MENU_CALL tExit, do_return_main_menu | |
441 MENU_END | |
155
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
442 |
345 | 443 do_settings_menu_ble: |
582 | 444 MENU_BEGIN tSystSets, .7 |
445 MENU_CALL tInfoMenu, do_info_menu | |
446 MENU_CALL tBleTitle, comm_mode0 | |
447 MENU_CALL tSetTimeDate, do_date_time_menu | |
448 MENU_CALL tDispSets, do_dispsets_menu | |
449 MENU_OPTION tLanguage, oLanguage, 0 | |
450 MENU_CALL tMore, do_settings_menu_more | |
451 MENU_CALL tExit, do_return_main_menu | |
452 MENU_END | |
453 | |
454 do_info_menu: | |
455 MENU_BEGIN tInfoMenu, .6 | |
456 MENU_DYNAMIC info_menu_serial, 0 | |
457 MENU_DYNAMIC info_menu_firmware, 0 | |
458 MENU_DYNAMIC info_menu_battery_volts, 0 | |
459 MENU_DYNAMIC info_menu_uptime, 0 | |
460 MENU_DYNAMIC info_menu_total_dives, 0 | |
461 MENU_CALL tExit, do_return_settings | |
462 MENU_END | |
463 | |
464 | |
465 do_return_settings_more_deeper: ; entry point for returns from reset sub-menu | |
466 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
|
467 |
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
|
468 do_return_settings_more: |
582 | 469 call menu_processor_double_pop ; drop exit line and back to last line |
470 | |
155
5f71e31bd5b3
CHANGE: Re-arranged Settings Menu, add 180? rotate to menu
heinrichsweikamp
parents:
154
diff
changeset
|
471 do_settings_menu_more: |
582 | 472 btfsc battery_gauge_available ; piezo buttons available |
473 bra do_settings_menu_more_piezo | |
474 btfsc ble_available ; ble available | |
475 bra do_settings_menu_more_ostc3p | |
476 ; All MENU_CALLs that are | |
477 MENU_BEGIN tSystSets, .6 ; in all of this 3 menus | |
478 MENU_CALL tCompassMenu, do_compass_menu ; need to stay together | |
479 MENU_CALL tLogOffset, do_log_offset_menu ; on this menu level in | |
480 MENU_OPTION tAltMode, oAltMode, 0 ; oder to not mass up the | |
481 MENU_OPTION tDvSalinity, oDiveSalinity, 0 ; menu stack on doing the | |
482 MENU_CALL tResetMenu, do_reset_menu ; do_return_settings ! | |
483 MENU_CALL tExit, do_return_settings | |
484 MENU_END | |
220
effd7259f5a5
make button sensitivity configurable (cR hardware)
heinrichsweikamp
parents:
218
diff
changeset
|
485 |
582 | 486 |
487 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
|
488 call TFT_ClearScreen |
582 | 489 call piezo_config ; Configure buttons |
490 call menu_processor_double_pop ; drop exit line and back to last line | |
524 | 491 |
269
1207cf9a9408
adjust menu for different hardware versions
heinrichsweikamp
parents:
243
diff
changeset
|
492 do_settings_menu_more_piezo: |
582 | 493 MENU_BEGIN tSystSets, .7 |
494 MENU_CALL tCompassMenu, do_compass_menu | |
495 MENU_CALL tLogOffset, do_log_offset_menu | |
496 MENU_OPTION tAltMode, oAltMode, 0 | |
497 MENU_OPTION tDvSalinity, oDiveSalinity, 0 | |
498 MENU_CALL tResetMenu, do_reset_menu | |
499 MENU_CALL tMore, do_settings_piezo_menu | |
500 MENU_CALL tExit, do_return_settings | |
501 MENU_END | |
0 | 502 |
582 | 503 do_settings_menu_more_ostc3p: ; Menu with BLE feature |
504 MENU_BEGIN tSystSets, .6 | |
505 MENU_CALL tCompassMenu, do_compass_menu | |
506 MENU_CALL tLogOffset, do_log_offset_menu | |
507 MENU_OPTION tAltMode, oAltMode, 0 | |
508 MENU_OPTION tDvSalinity, oDiveSalinity, 0 | |
509 MENU_CALL tResetMenu, do_reset_menu | |
510 MENU_CALL tExit, do_return_settings | |
511 MENU_END | |
512 | |
243 | 513 |
345 | 514 do_settings_piezo_menu: |
582 | 515 ; Menu with features only available in piezo button hardware |
516 MENU_BEGIN tSystSets, .3 | |
517 MENU_OPTION tButtonleft, ocR_button_left, 0 ; left button sensitivity | |
518 MENU_OPTION tButtonright, ocR_button_right, 0 ; right button sensitivity | |
519 MENU_CALL tExit, do_return_settings_menu_more_pz | |
520 MENU_END | |
220
effd7259f5a5
make button sensitivity configurable (cR hardware)
heinrichsweikamp
parents:
218
diff
changeset
|
521 |
effd7259f5a5
make button sensitivity configurable (cR hardware)
heinrichsweikamp
parents:
218
diff
changeset
|
522 |
18
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
523 do_compass_menu: |
582 | 524 MENU_BEGIN tSystSets, .5 |
525 MENU_CALL tCompassMenu, compass_calibration_loop ; exits to surfloop | |
526 ; MENU_OPTION tCompassGain, oCompassGain, 0 | |
527 MENU_DYNAMIC menu_cal_x, 0 | |
528 MENU_DYNAMIC menu_cal_y, 0 | |
529 MENU_DYNAMIC menu_cal_z, 0 | |
530 MENU_CALL tExit, do_return_settings_more | |
531 MENU_END | |
532 | |
18
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
533 |
0 | 534 ;============================================================================= |
535 ; Reset and confirmation menu. | |
536 | |
537 do_reset_menu: | |
582 | 538 MENU_BEGIN tResetMenu, .6 |
539 MENU_CALL tExit, do_return_settings_more | |
540 MENU_CALL tReboot, do_reset_menu2 ; Confirm | |
541 MENU_CALL tResetDeco, do_reset_menu3 ; Confirm | |
542 MENU_CALL tResetSettings, do_reset_menu4 ; Confirm | |
543 MENU_CALL tResetLogbook, do_reset_menu5 ; Confirm | |
544 MENU_CALL tResetBattery, do_new_battery_menu ; Confirm | |
545 MENU_END | |
0 | 546 |
547 do_reset_menu2: | |
582 | 548 MENU_BEGIN tResetMenu2, .2 |
549 MENU_CALL tAbort, do_return_settings_more_deeper | |
550 MENU_CALL tReboot, do_reboot ; Reboot | |
551 MENU_END | |
0 | 552 |
553 do_reset_menu3: | |
582 | 554 MENU_BEGIN tResetMenu2, .2 |
555 MENU_CALL tAbort, do_return_settings_more_deeper | |
556 MENU_CALL tResetDeco, do_reset_deco ; Reset Deco | |
557 MENU_END | |
0 | 558 |
559 do_reset_menu4: | |
582 | 560 MENU_BEGIN tResetMenu2, .2 |
561 MENU_CALL tAbort, do_return_settings_more_deeper | |
562 MENU_CALL tResetSettings, do_reset_settings ; Reset all settings | |
563 MENU_END | |
0 | 564 |
63 | 565 do_reset_menu5: |
582 | 566 MENU_BEGIN tResetMenu2, .2 |
567 MENU_CALL tAbort, do_return_settings_more_deeper | |
568 MENU_CALL tResetLogbook, do_reset_logbook ; Reset logbook | |
569 MENU_END | |
570 | |
63 | 571 |
572 do_reset_logbook: | |
582 | 573 clrf EEADRH ; Make sure to select EEPROM bank 0 |
574 clrf EEDATA | |
575 read_int_eeprom .2 | |
576 write_int_eeprom .16 | |
577 read_int_eeprom .3 | |
578 write_int_eeprom .17 ; Copy number of dives | |
63 | 579 clrf EEDATA |
582 | 580 write_int_eeprom .2 |
581 write_int_eeprom .3 ; Clear total dives | |
582 write_int_eeprom .4 | |
583 write_int_eeprom .5 | |
584 write_int_eeprom .6 ; Reset logbook pointers | |
63 | 585 call ext_flash_erase_logbook ; And complete logbook (!) |
582 | 586 |
587 goto do_return_settings_more_deeper | |
63 | 588 |
0 | 589 |
590 do_reset_deco: | |
560 | 591 SAFE_2BYTE_COPY last_surfpressure_30min,int_I_pres_respiration ; copy surface pressure to deco routine |
592 SAFE_2BYTE_COPY last_surfpressure_30min,int_I_pres_surface ; copy surface pressure to deco routine | |
582 | 593 |
594 call deco_clear_tissue ; set all tissues to Pamb * N2_ratio (C-Code) | |
595 call deco_calc_dive_interval_1min; calculate deco in surface mode | |
596 call deco_calc_desaturation_time ; calculate desaturation and no-fly time | |
597 banksel common | |
598 | |
599 goto do_return_settings_more_deeper | |
600 | |
0 | 601 |
602 do_reset_settings: | |
582 | 603 call TFT_ClearScreen ; Clear screen |
604 banksel common ; (probably not needed) | |
605 call option_reset_all ; Reset all options to factory default. | |
606 goto restart ; Restart into surfacemode | |
0 | 607 |
608 do_reboot: | |
582 | 609 call ext_flash_enable_protection ; Enables write protection |
0 | 610 reset |
611 | |
612 | |
613 do_date_time_menu: | |
582 | 614 MENU_BEGIN tSetTimeDate, .4 |
615 MENU_CALL tSetTime, do_time_menu | |
616 MENU_CALL tSetDate, do_date_menu | |
617 MENU_OPTION tDateFormat,oDateFormat, 0 | |
618 MENU_CALL tExit, do_return_settings | |
619 MENU_END | |
620 | |
0 | 621 |
622 do_date_menu: | |
623 bsf settime_setdate | |
582 | 624 |
625 MENU_BEGIN tSetDate, .4 | |
626 MENU_OPTION tSetDay, oSetDay, 0 | |
627 MENU_OPTION tSetMonth, oSetMonth, 0 | |
628 MENU_OPTION tSetYear, oSetYear, 0 | |
629 MENU_CALL tExit, do_return_settings_deeper | |
630 MENU_END | |
0 | 631 |
632 | |
633 do_reset_seconds: | |
634 clrf secs | |
582 | 635 call rtc_set_rtc ; writes mins, sec, hours, day, month and year to RTC module |
636 call menu_processor_pop ; clear the MENU_CALL for do_reset_seconds from the stack | |
637 ;bra do_time_menu ; direct jump-back into the menu | |
638 | |
0 | 639 do_time_menu: |
640 bsf settime_setdate | |
582 | 641 |
642 MENU_BEGIN tSetTime, .4 | |
643 MENU_OPTION tSetHours, oSetHours, 0 | |
644 MENU_OPTION tSetMinutes, oSetMinutes, 0 | |
645 MENU_CALL tSetSeconds, do_reset_seconds | |
646 MENU_CALL tExit, do_return_settings_deeper | |
647 MENU_END | |
0 | 648 |
649 | |
582 | 650 do_toggle_ppo2_max: ; add 0.1bar, with hard-coded max. |
651 movff char_I_ppO2_max,lo ; banksafe | |
652 movlw .10 | |
0 | 653 addwf lo,F |
582 | 654 movlw ppo2_warning_high_highest |
0 | 655 cpfsgt lo |
582 | 656 bra do_toggle_ppo2_max2 |
657 movlw ppo2_warning_high_lowest | |
0 | 658 movwf lo |
659 do_toggle_ppo2_max2: | |
582 | 660 movff lo,char_I_ppO2_max |
661 return | |
0 | 662 |
582 | 663 do_toggle_ppo2_max_deco: ; add 0.1bar, with hard-coded max. |
664 movff char_I_ppO2_max_deco,lo ; banksafe | |
665 movlw .10 | |
507
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
666 addwf lo,F |
582 | 667 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
|
668 cpfsgt lo |
582 | 669 bra do_toggle_ppo2_max_deco2 |
670 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
|
671 movwf lo |
4e6f5c36f4cc
NEW: Two ppO2 max settings. One for travel/bottom and one for deco gases
heinrichsweikamp
parents:
505
diff
changeset
|
672 do_toggle_ppo2_max_deco2: |
582 | 673 movff lo,char_I_ppO2_max_deco |
674 return | |
675 | |
676 do_toggle_ppo2_min: ; sub 0.1bar, with hard-coded min. | |
677 movff char_I_ppO2_min,lo ; banksafe | |
678 incf lo,F | |
679 movlw ppo2_warning_low_highest | |
0 | 680 cpfsgt lo |
582 | 681 bra do_toggle_ppo2_min2 |
682 movlw ppo2_warning_low_lowest | |
0 | 683 movwf lo |
684 do_toggle_ppo2_min2: | |
582 | 685 movff lo,char_I_ppO2_min |
686 return | |
0 | 687 |
582 | 688 do_toggle_ppo2_min_cc: ; sub 0.1bar, with hard-coded min. |
689 movff char_I_ppO2_min_loop,lo ; banksafe | |
690 incf lo,F | |
691 movlw ppo2_warning_loop_highest | |
560 | 692 cpfsgt lo |
582 | 693 bra do_toggle_ppo2_min_cc2 |
694 movlw ppo2_warning_loop_lowest | |
560 | 695 movwf lo |
696 do_toggle_ppo2_min_cc2: | |
582 | 697 movff lo,char_I_ppO2_min_loop |
698 return | |
699 | |
0 | 700 |
701 ; Logbook offset sub-menu | |
702 do_log_offset_menu: | |
582 | 703 MENU_BEGIN tLogOffset, .6 |
704 MENU_DYNAMIC TFT_LogOffset_Logtitle, 0 | |
705 MENU_CALL tLogOffsetp1, do_logoffset_plus1 | |
706 MENU_CALL tLogOffsetp10, do_logoffset_plus10 | |
707 MENU_CALL tLogOffsetm1, do_logoffset_minus1 | |
708 MENU_CALL tLogOffsetm10, do_logoffset_minus10 | |
709 MENU_CALL tExit, do_return_settings_more | |
710 MENU_END | |
0 | 711 |
712 | |
713 do_logoffset_minus1: | |
582 | 714 call do_logoffset_common_read ; Read into lo:hi |
715 movlw .1 | |
0 | 716 subwf lo |
582 | 717 movlw .0 |
0 | 718 subwfb hi |
582 | 719 btfss hi,7 ; <0? |
720 goto do_logoffset_common_write ; Store and return | |
0 | 721 clrf lo |
722 clrf hi | |
582 | 723 goto do_logoffset_common_write ; Store and return |
0 | 724 |
725 do_logoffset_minus10: | |
582 | 726 call do_logoffset_common_read ; Read into lo:hi |
727 movlw .10 | |
0 | 728 subwf lo |
582 | 729 movlw .0 |
0 | 730 subwfb hi |
582 | 731 btfss hi,7 ; <0? |
732 goto do_logoffset_common_write ; Store and return | |
0 | 733 clrf lo |
734 clrf hi | |
582 | 735 goto do_logoffset_common_write ; Store and return |
0 | 736 |
737 do_logoffset_plus1: | |
582 | 738 call do_logoffset_common_read ; Read into lo:hi |
739 infsnz lo,F | |
740 incf hi,F | |
741 goto do_logoffset_common_write ; Store and return | |
0 | 742 |
743 do_logoffset_plus10: | |
582 | 744 call do_logoffset_common_read ; Read into lo:hi |
745 movlw .10 | |
0 | 746 addwf lo |
582 | 747 movlw .0 |
0 | 748 addwfc hi |
582 | 749 goto do_logoffset_common_write ; Store and return |
0 | 750 |
582 | 751 do_return_dispsets_menu: |
752 bcf in_color_menu | |
753 call menu_processor_double_pop ; drop exit line and back to last line | |
0 | 754 |
755 do_dispsets_menu: | |
582 | 756 MENU_BEGIN tDispSets, .5 |
757 MENU_OPTION tBright, oBrightness, 0 | |
758 MENU_CALL tColorScheme, do_color_scheme | |
759 MENU_OPTION tFlip, oFlipScreen, 0 | |
760 MENU_CALL tMore, do_dispsets_menu_more | |
761 MENU_CALL tExit, do_return_settings | |
762 MENU_END | |
763 | |
335
3d43da7acfe1
Always show ppO2 (warning position, standard color) option
janos_kovacs <kovjanos@gmail.com>
parents:
333
diff
changeset
|
764 |
3d43da7acfe1
Always show ppO2 (warning position, standard color) option
janos_kovacs <kovjanos@gmail.com>
parents:
333
diff
changeset
|
765 do_dispsets_menu_more: |
582 | 766 MENU_BEGIN tDispSets, .7 |
767 MENU_OPTION tMODwarning, oMODwarning, 0 | |
768 MENU_OPTION tIBCDwarning, oEnable_IBCD, 0 | |
769 MENU_OPTION tVSItext2, oVSItextv2, 0 | |
770 MENU_OPTION tVSIgraph, oVSIgraph, 0 | |
771 MENU_OPTION tTimeoutDive, oDiveTimeout, 0 | |
772 MENU_OPTION tUnits, oUnits, 0 | |
773 MENU_CALL tExit, do_return_dispsets_menu | |
774 MENU_END | |
0 | 775 |
582 | 776 |
50 | 777 do_color_scheme: |
582 | 778 bsf in_color_menu |
779 | |
780 MENU_BEGIN tColorScheme, .2 | |
781 MENU_OPTION tColorSetDive, oColorSetDive, 0 | |
782 MENU_CALL tExit, do_return_dispsets_menu | |
783 MENU_END | |
50 | 784 |
785 | |
0 | 786 ;============================================================================= |
787 | |
582 | 788 do_new_battery_menu: |
789 MENU_BEGIN tNewBattTitle, .2 | |
790 MENU_CALL tAbort, do_return_settings_more_deeper | |
791 MENU_CALL tYes, do_new_battery_select | |
792 MENU_END | |
793 | |
794 global do_new_battery_select | |
795 do_new_battery_select: | |
796 bsf enable_screen_dumps ; To prevent exiting into COMM mode immediately | |
797 call TFT_boot ; Initialize TFT (includes clear screen) | |
798 call TFT_Display_FadeIn ; Show splash | |
799 movlw .100 | |
800 movwf batt_percent ; make sure to reset batt_percent | |
801 | |
802 ; Default (In cases of timeout or USB): Use old battery | |
0 | 803 clrf EEADRH |
804 read_int_eeprom 0x07 | |
805 movff EEDATA,battery_gauge+0 | |
806 read_int_eeprom 0x08 | |
807 movff EEDATA,battery_gauge+1 | |
808 read_int_eeprom 0x09 | |
809 movff EEDATA,battery_gauge+2 | |
810 read_int_eeprom 0x0A | |
811 movff EEDATA,battery_gauge+3 | |
812 read_int_eeprom 0x0B | |
813 movff EEDATA,battery_gauge+4 | |
814 read_int_eeprom 0x0C | |
815 movff EEDATA,battery_gauge+5 | |
816 | |
582 | 817 call menu_processor_reset ; restart from first icon. |
818 | |
819 ; hardware_flag: | |
820 ; 3: 0x0A or 0x13 (2016) | |
821 ; cR: 0x05 | |
822 ; 2 with BLE: 0x11 | |
823 ; Sport: 0x12 | |
824 ; 3 with BLE: 0x1A | |
76 | 825 |
582 | 826 movlw 0x0A |
827 cpfseq hardware_flag | |
828 bra $+4 | |
829 bra menu_new_battery_AA | |
830 movlw 0x13 | |
831 cpfseq hardware_flag | |
832 bra $+4 | |
833 bra menu_new_battery_AA_16650 | |
834 movlw 0x12 | |
835 cpfseq hardware_flag | |
836 bra $+4 | |
837 bra menu_new_battery_AA | |
838 movlw 0x1A | |
839 cpfseq hardware_flag | |
840 bra $+4 | |
841 bra menu_new_battery_AA | |
842 movlw 0x11 | |
843 cpfseq hardware_flag | |
844 bra $+4 | |
845 bra menu_new_battery_18650 | |
846 movlw 0x05 | |
847 cpfseq hardware_flag | |
848 bra $+4 | |
849 bra menu_new_battery_18650 | |
850 bra use_old_batteries ; any unsupported value | |
851 | |
852 | |
474 | 853 menu_new_battery_AA_16650: |
582 | 854 MENU_BEGIN tNewBattTitle, .5 |
855 MENU_CALL tNewBattOld, use_old_batteries | |
856 MENU_CALL tNewBattNew36, use_new_36V_batteries | |
857 MENU_CALL tNewBattNew15, use_new_15V_batteries | |
858 MENU_CALL tNewBattAccu, use_36V_rechargeable | |
859 MENU_CALL tNew16650, use_16650_battery | |
860 MENU_END | |
861 | |
862 | |
464
0491a84fd0b8
CHANGE: Easier to understand "New Battery" menu (OSTC model dependent)
heinrichsweikamp
parents:
457
diff
changeset
|
863 menu_new_battery_AA: |
582 | 864 MENU_BEGIN tNewBattTitle, .4 |
865 MENU_CALL tNewBattOld, use_old_batteries | |
866 MENU_CALL tNewBattNew36, use_new_36V_batteries | |
867 MENU_CALL tNewBattNew15, use_new_15V_batteries | |
868 MENU_CALL tNewBattAccu, use_36V_rechargeable | |
869 MENU_END | |
870 | |
464
0491a84fd0b8
CHANGE: Easier to understand "New Battery" menu (OSTC model dependent)
heinrichsweikamp
parents:
457
diff
changeset
|
871 |
0491a84fd0b8
CHANGE: Easier to understand "New Battery" menu (OSTC model dependent)
heinrichsweikamp
parents:
457
diff
changeset
|
872 menu_new_battery_18650: |
582 | 873 MENU_BEGIN tNewBattTitle, .2 |
874 MENU_CALL tNewBattOld, use_old_batteries | |
875 MENU_CALL tNew18650, use_18650_battery | |
876 MENU_END | |
0 | 877 |
582 | 878 |
457 | 879 global use_old_prior_209 |
880 use_old_prior_209: | |
881 clrf EEADRH | |
582 | 882 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 |
883 incfsz EEDATA,F ; Was 0xFF? | |
884 return ; No, done. | |
477
44b8a826b314
NEW: Show battery type in surface mode next to battery voltage
heinrichsweikamp
parents:
474
diff
changeset
|
885 |
582 | 886 call lt2942_get_status ; Check for gauge IC |
887 movlw .3 ; Assume a 18650 | |
888 btfss battery_gauge_available ; cR/2 hardware? | |
889 movlw .1 ; Assume a Saft | |
890 movwf EEDATA | |
891 write_int_eeprom 0x0F ; Store the new battery type into EEPROM | |
457 | 892 return |
582 | 893 |
894 | |
0 | 895 global use_old_batteries |
896 use_old_batteries: | |
897 clrf EEADRH | |
898 read_int_eeprom 0x07 | |
899 movff EEDATA,battery_gauge+0 | |
900 read_int_eeprom 0x08 | |
901 movff EEDATA,battery_gauge+1 | |
902 read_int_eeprom 0x09 | |
903 movff EEDATA,battery_gauge+2 | |
904 read_int_eeprom 0x0A | |
905 movff EEDATA,battery_gauge+3 | |
906 read_int_eeprom 0x0B | |
907 movff EEDATA,battery_gauge+4 | |
908 read_int_eeprom 0x0C | |
909 movff EEDATA,battery_gauge+5 | |
448 | 910 read_int_eeprom 0x0F |
582 | 911 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 | 912 |
582 | 913 rcall setup_new_saft ; Any other value |
914 incf EEDATA,F ; 1 ... 5 | |
450 | 915 dcfsnz EEDATA,F |
582 | 916 rcall setup_new_15v ;=0 |
450 | 917 dcfsnz EEDATA,F |
582 | 918 rcall setup_new_saft ;=1 |
450 | 919 dcfsnz EEDATA,F |
582 | 920 rcall setup_new_panasonic ;=2 |
921 dcfsnz EEDATA,F | |
922 rcall setup_new_18650 ;=3 | |
923 dcfsnz EEDATA,F | |
924 rcall setup_new_16650 ;=4 | |
925 | |
926 bcf use_old_batt_flag ; clear flag | |
927 goto surfloop ; Jump to Surfaceloop! | |
928 | |
0 | 929 |
472
4fdf6886004b
CHANGE: Show warnings either in Customview (If active) _or_ next to warning sign
heinrichsweikamp
parents:
470
diff
changeset
|
930 setup_new_15v: |
582 | 931 bsf charge_disable |
932 bcf TRISE,2 | |
933 movlw .100 | |
934 movwf batt_percent ; To have 1,5V batteries right after firmware update | |
935 movlw .0 | |
936 movff WREG,battery_type | |
937 return | |
938 | |
939 | |
448 | 940 setup_new_saft: |
582 | 941 banksel battery_capacity |
942 movlw LOW internal_saft_capacity | |
943 movwf internal_battery_capacity+0 | |
944 movlw HIGH internal_saft_capacity | |
945 movwf internal_battery_capacity+1 | |
946 movlw LOW saft_capacity | |
947 movwf battery_capacity+0 | |
948 movlw HIGH saft_capacity | |
949 movwf battery_capacity+1 | |
950 movlw LOW saft_offset | |
951 movwf battery_offset+0 | |
952 movlw HIGH saft_offset | |
953 movwf battery_offset+1 | |
954 banksel common | |
955 bsf charge_disable | |
956 bcf TRISE,2 | |
957 movlw .1 | |
958 movff WREG,battery_type | |
959 return | |
960 | |
448 | 961 |
582 | 962 setup_new_panasonic: |
963 banksel battery_capacity | |
964 movlw LOW internal_panasonic_capacity | |
965 movwf internal_battery_capacity+0 | |
966 movlw HIGH internal_panasonic_capacity | |
967 movwf internal_battery_capacity+1 | |
968 movlw LOW panasonic_capacity | |
969 movwf battery_capacity+0 | |
970 movlw HIGH panasonic_capacity | |
971 movwf battery_capacity+1 | |
972 movlw LOW panasonic_offset | |
973 movwf battery_offset+0 | |
974 movlw HIGH panasonic_offset | |
975 movwf battery_offset+1 | |
976 banksel common | |
977 bcf charge_disable | |
978 bsf TRISE,2 | |
979 movlw .2 | |
980 movff WREG,battery_type | |
981 return | |
472
4fdf6886004b
CHANGE: Show warnings either in Customview (If active) _or_ next to warning sign
heinrichsweikamp
parents:
470
diff
changeset
|
982 |
582 | 983 |
984 setup_new_18650: | |
985 banksel battery_capacity | |
986 clrf internal_battery_capacity+0 | |
987 clrf internal_battery_capacity+1 | |
988 movlw LOW ncr18650_capacity | |
989 movwf battery_capacity+0 | |
990 movlw HIGH ncr18650_capacity | |
991 movwf battery_capacity+1 | |
992 movlw LOW ncr18650_offset | |
993 movwf battery_offset+0 | |
994 movlw HIGH ncr18650_offset | |
995 movwf battery_offset+1 | |
996 banksel common | |
997 bcf charge_disable | |
998 bsf TRISE,2 | |
999 movlw .3 | |
1000 movff WREG,battery_type | |
1001 return | |
1002 | |
472
4fdf6886004b
CHANGE: Show warnings either in Customview (If active) _or_ next to warning sign
heinrichsweikamp
parents:
470
diff
changeset
|
1003 |
4fdf6886004b
CHANGE: Show warnings either in Customview (If active) _or_ next to warning sign
heinrichsweikamp
parents:
470
diff
changeset
|
1004 setup_new_16650: |
582 | 1005 banksel battery_capacity |
1006 clrf internal_battery_capacity+0 | |
1007 clrf internal_battery_capacity+1 | |
1008 movlw LOW ur16650_capacity | |
1009 movwf battery_capacity+0 | |
1010 movlw HIGH ur16650_capacity | |
1011 movwf battery_capacity+1 | |
1012 movlw LOW ur16650_offset | |
1013 movwf battery_offset+0 | |
1014 movlw HIGH ur16650_offset | |
1015 movwf battery_offset+1 | |
1016 banksel common | |
1017 bcf charge_disable | |
1018 bsf TRISE,2 | |
1019 movlw .4 | |
1020 movff WREG,battery_type | |
1021 return | |
1022 | |
472
4fdf6886004b
CHANGE: Show warnings either in Customview (If active) _or_ next to warning sign
heinrichsweikamp
parents:
470
diff
changeset
|
1023 |
474 | 1024 use_16650_battery: |
582 | 1025 rcall setup_new_16650 |
1026 bra use_new_36V_2 | |
448 | 1027 use_18650_battery: |
582 | 1028 rcall setup_new_18650 |
1029 bra use_new_36V_2 | |
0 | 1030 use_new_36V_batteries: |
582 | 1031 rcall setup_new_saft |
1032 bra use_new_36V_2 | |
448 | 1033 use_new_15V_batteries: |
582 | 1034 rcall setup_new_15v |
448 | 1035 use_new_36V_2: |
582 | 1036 call reset_battery_pointer ; Resets battery pointer 0x07-0x0C and battery_gauge:5 |
1037 goto surfloop ; Jump to Surface loop! | |
448 | 1038 use_36V_rechargeable: |
582 | 1039 rcall setup_new_panasonic |
1040 call reset_battery_internal_only | |
1041 goto surfloop ; Jump to Surface loop! | |
0 | 1042 |
582 | 1043 END |