Mercurial > public > hwos_code
comparison src/menu_tree.asm @ 560:b7eb98dbd800
bump to 2.96beta (REFACTORED VERSION)
author | heinrichsweikamp |
---|---|
date | Wed, 31 Jan 2018 19:39:37 +0100 |
parents | 7e6df19264b6 |
children | 8b7ea27ea1fa |
comparison
equal
deleted
inserted
replaced
559:9cb967d844f0 | 560:b7eb98dbd800 |
---|---|
1 ;============================================================================= | 1 ;============================================================================= |
2 ; | 2 ; |
3 ; File menu_tree.asm | 3 ; File menu_tree.asm REFACTORED VERSION V2.95 |
4 ; | 4 ; |
5 ; OSTC menus | 5 ; OSTC menus |
6 ; | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. |
8 ;============================================================================= | 8 ;============================================================================= |
9 ; HISTORY | 9 ; HISTORY |
10 ; 2011-07-11 : [jDG] Creation. | 10 ; 2011-07-11 : [jDG] Creation. |
11 | 11 |
12 #include "hwos.inc" ; Mandatory header | 12 #include "hwos.inc" ; Mandatory header |
13 #include "gaslist.inc" | 13 #include "gaslist.inc" |
14 #include "menu_processor.inc" | 14 #include "menu_processor.inc" |
15 #include "start.inc" | 15 #include "start.inc" |
16 #include "comm.inc" | 16 #include "comm.inc" |
17 #include "logbook.inc" | 17 #include "logbook.inc" |
18 #include "tft.inc" | 18 #include "tft.inc" |
19 #include "eeprom_rs232.inc" | 19 #include "eeprom_rs232.inc" |
20 #include "external_flash.inc" | 20 #include "external_flash.inc" |
21 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c | 21 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c |
22 #include "isr.inc" | 22 #include "isr.inc" |
23 #include "ghostwriter.inc" | 23 #include "ghostwriter.inc" |
24 #include "adc_lightsensor.inc" | 24 #include "adc_lightsensor.inc" |
25 #include "wait.inc" | 25 #include "wait.inc" |
26 #include "i2c.inc" | 26 #include "i2c.inc" |
27 | 27 |
28 CBLOCK tmp+0x40 ; Keep space for menu processor | 28 CBLOCK tmp+0x40 ; Keep space for menu processor |
29 gaslist_gas ; Check ram position in gaslist.asm, too! | 29 gaslist_gas ; Check ram position in gaslist.asm, too! |
30 ENDC | 30 ENDC |
31 | 31 |
32 gui CODE | 32 gui CODE |
33 ;============================================================================= | 33 ;============================================================================= |
34 ; Main Menu | 34 ; Main Menu |
35 global do_main_menu,do_main_menu2 | 35 global do_main_menu,do_main_menu2 |
36 do_main_menu: | 36 do_main_menu: |
37 movff menupos3,customview_surfmode; save last customview | 37 movff menupos3,customview_surfmode; save last customview |
56 | 56 |
57 do_info_menu: | 57 do_info_menu: |
58 MENU_BEGIN tInfoMenu, .6 | 58 MENU_BEGIN tInfoMenu, .6 |
59 MENU_DYNAMIC info_menu_serial, 0 | 59 MENU_DYNAMIC info_menu_serial, 0 |
60 MENU_DYNAMIC info_menu_firmware, 0 | 60 MENU_DYNAMIC info_menu_firmware, 0 |
61 MENU_DYNAMIC info_menu_total_dives, 0 | 61 MENU_DYNAMIC info_menu_battery_volts,0 |
62 MENU_DYNAMIC info_menu_battery_volts,0 | 62 MENU_DYNAMIC info_menu_uptime, 0 |
63 MENU_DYNAMIC info_menu_uptime,0 | 63 MENU_DYNAMIC info_menu_total_dives, 0 |
64 MENU_CALL tExit, do_return_settings | 64 MENU_CALL tExit, do_return_settings |
65 MENU_END | 65 MENU_END |
66 | 66 |
67 ;============================================================================= | 67 ;============================================================================= |
68 ; CCR Setup | 68 ; CCR Setup |
69 | 69 |
70 return_ccr_menu: | 70 return_ccr_menu: |
71 rcall menu_tree_double_pop ; drop exit line and back to last line | 71 rcall menu_tree_double_pop ; drop exit line and back to last line |
72 | 72 |
73 do_ccr_menu: | 73 do_ccr_menu: |
74 bcf menu_show_sensors ; Clear flag | |
75 bcf menu_show_sensors2 ; Clear flag | 74 bcf menu_show_sensors2 ; Clear flag |
76 btfsc analog_o2_input | 75 btfsc analog_o2_input |
77 bra do_ccr_menu_cR | 76 bra do_ccr_menu_cR |
78 btfss optical_input | 77 |
79 bra do_ccr_menu_ostc2 | 78 ; COMMENT OUT - currently there is no difference between the OSTC 2 and 3 regarding this menu |
80 | 79 ; btfss optical_input |
81 MENU_BEGIN tCCRSetup, .6 ; OSTC3 menu | 80 ; bra do_ccr_menu_ostc2 |
82 MENU_OPTION tCCRMode, oCCRMode, 0 | 81 |
83 MENU_CALL tCCRSensor, do_ccr_sensor | 82 MENU_BEGIN tCCRSetup, .6 ; OSTC3 menu (and currently also the OSTC2 menu) |
84 MENU_CALL tDiluentSetup, do_diluent_setup | 83 MENU_OPTION tCCRMode, oCCRMode, 0 |
85 MENU_CALL tFixedSetpoints, do_fixed_setpoints | 84 MENU_CALL tDiluentSetup, do_diluent_setup |
86 MENU_CALL tPSCRMenu, do_PSCR_menu | 85 MENU_CALL tFixedSetpoints, do_fixed_setpoints |
87 MENU_CALL tExit, do_continue_main_menu | 86 MENU_CALL tPSCRMenu, do_PSCR_menu |
87 MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 | |
88 MENU_CALL tExit, do_continue_main_menu | |
88 MENU_END | 89 MENU_END |
89 | 90 |
90 do_ccr_menu_cR: ; cR menu | 91 do_ccr_menu_cR: ; cR menu |
91 MENU_BEGIN tCCRSetup, .7 | 92 MENU_BEGIN tCCRSetup, .7 |
92 MENU_OPTION tCCRMode, oCCRMode, 0 | 93 MENU_OPTION tCCRMode, oCCRMode, 0 |
93 MENU_CALL tCCRSensor, do_ccr_sensor | 94 MENU_CALL tCalibrateMenu, do_calibrate_menu |
94 MENU_CALL tCalibrateMenu, do_calibrate_menu | 95 MENU_CALL tDiluentSetup, do_diluent_setup |
95 MENU_CALL tDiluentSetup, do_diluent_setup | 96 MENU_CALL tFixedSetpoints, do_fixed_setpoints |
96 MENU_CALL tFixedSetpoints, do_fixed_setpoints | 97 MENU_CALL tPSCRMenu, do_PSCR_menu |
97 MENU_CALL tPSCRMenu, do_PSCR_menu | 98 MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 |
98 MENU_CALL tExit, do_continue_main_menu | 99 MENU_CALL tExit, do_continue_main_menu |
99 MENU_END | 100 MENU_END |
100 | 101 |
101 do_ccr_menu_ostc2: | 102 ; COMMENT OUT - currently there is no difference between the OSTC 2 and 3 regarding this menu |
102 MENU_BEGIN tCCRSetup, .5 ; ostc2 menu | 103 ;do_ccr_menu_ostc2: |
103 MENU_OPTION tCCRMode, oCCRMode, 0 | 104 ; MENU_BEGIN tCCRSetup, .6 ; ostc2 menu |
104 MENU_CALL tDiluentSetup, do_diluent_setup | 105 ; MENU_OPTION tCCRMode, oCCRMode, 0 |
105 MENU_CALL tFixedSetpoints, do_fixed_setpoints | 106 ; MENU_CALL tDiluentSetup, do_diluent_setup |
106 MENU_CALL tPSCRMenu, do_PSCR_menu | 107 ; MENU_CALL tFixedSetpoints, do_fixed_setpoints |
107 MENU_CALL tExit, do_continue_main_menu | 108 ; MENU_CALL tPSCRMenu, do_PSCR_menu |
108 MENU_END | 109 ; MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 |
110 ; MENU_CALL tExit, do_continue_main_menu | |
111 ; MENU_END | |
109 | 112 |
110 do_PSCR_menu: | 113 do_PSCR_menu: |
111 MENU_BEGIN tPSCRMenu, .3 ; PSCR Menu | 114 MENU_BEGIN tPSCRMenu, .3 ; PSCR Menu |
112 MENU_OPTION tPSCR_O2_drop, oPSCR_drop, 0 | 115 MENU_OPTION tPSCR_O2_drop, oPSCR_drop, 0 |
113 MENU_OPTION tPSCR_lungratio,oPSCR_lungratio, 0 | 116 MENU_OPTION tPSCR_lungratio, oPSCR_lungratio, 0 |
114 MENU_CALL tExit, return_ccr_menu | 117 MENU_CALL tExit, return_ccr_menu |
115 MENU_END | 118 MENU_END |
116 | 119 |
117 do_calibrate_menu: | 120 do_calibrate_menu: |
118 call enable_ir_s8 ; Enable IR/S8-Port | 121 call enable_ir_s8 ; Enable IR/S8-Port |
119 bsf menu_show_sensors2 ; Set flag | 122 bsf menu_show_sensors2 ; Set flag |
120 do_calibrate_menu2: | 123 do_calibrate_menu2: |
121 MENU_BEGIN tCalibrateMenu, .6 | 124 MENU_BEGIN tCalibrateMenu, .6 |
122 MENU_CALL tDiveHudMask1, 0 | 125 MENU_CALL tDiveHudMask1, 0 |
123 MENU_CALL tDiveHudMask2, 0 | 126 MENU_CALL tDiveHudMask2, 0 |
124 MENU_CALL tDiveHudMask3, 0 | 127 MENU_CALL tDiveHudMask3, 0 |
125 MENU_OPTION tCalibrationGas,oCalGasO2, 0 | 128 MENU_OPTION tCalibrationGas,oCalGasO2, 0 |
126 MENU_CALL tCalibrate, do_calibrate_mix | 129 MENU_CALL tCalibrate, do_calibrate_mix |
127 MENU_CALL tExit, return_ccr_menu | 130 MENU_CALL tExit, return_ccr_menu |
128 MENU_END | 131 MENU_END |
129 | 132 |
130 do_calibrate_mix: | 133 do_calibrate_mix: |
131 extern calibrate_mix | 134 extern calibrate_mix |
132 call calibrate_mix ; Calibrate with opt_calibration_O2_ratio, also calibrate S8 HUD if connected | 135 call calibrate_mix ; Calibrate with opt_calibration_O2_ratio, also calibrate S8 HUD if connected |
133 WAITMS d'250' ; Wait for HUD v3 | 136 WAITMS d'250' ; Wait for HUD v3 |
134 movlw .9 | 137 movlw .9 |
135 movwf customview_surfmode ; show sensor mV custom view after restart | 138 movwf customview_surfmode ; show sensor mV custom view after restart |
136 goto restart ; Restart into surface mode | 139 goto restart ; Restart into surface mode |
137 | 140 |
138 do_ccr_sensor: | |
139 call enable_ir_s8 ; Enable IR/S8-Port | |
140 bsf menu_show_sensors ; Set flag | |
141 MENU_BEGIN tCCRSensor, .5 | |
142 MENU_CALL tDiveHudMask1, 0 | |
143 MENU_CALL tDiveHudMask2, 0 | |
144 MENU_CALL tDiveHudMask3, 0 | |
145 MENU_OPTION tSensorFallback,oSensorFallback, 0 | |
146 MENU_CALL tExit, return_ccr_menu | |
147 MENU_END | |
148 | 141 |
149 do_diluent_setup: | 142 do_diluent_setup: |
150 bsf ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") | 143 bsf ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") |
151 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | 144 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint |
152 call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth | 145 call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth |
162 do_return_fixed_setpoints: | 155 do_return_fixed_setpoints: |
163 rcall menu_tree_double_pop ; drop exit line and back to last line | 156 rcall menu_tree_double_pop ; drop exit line and back to last line |
164 | 157 |
165 do_fixed_setpoints: | 158 do_fixed_setpoints: |
166 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | 159 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint |
167 MENU_BEGIN tFixedSetpoints, .6 | 160 MENU_BEGIN tFixedSetpoints, .6 |
168 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | 161 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu |
169 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | 162 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu |
170 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | 163 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu |
171 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | 164 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu |
172 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | 165 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu |
209 bra do_edit_gas_menu_1 | 202 bra do_edit_gas_menu_1 |
210 | 203 |
211 do_edit_gas_menu: | 204 do_edit_gas_menu: |
212 call gaslist_setgas ; Save current item. | 205 call gaslist_setgas ; Save current item. |
213 do_edit_gas_menu_1: ; Keep current gas. | 206 do_edit_gas_menu_1: ; Keep current gas. |
214 MENU_BEGIN tGasEdit, .6 | 207 MENU_BEGIN tGasEdit, .6 |
215 MENU_DYNAMIC gaslist_gastitle, 0 | 208 MENU_DYNAMIC gaslist_gastitle, 0 |
216 MENU_DYNAMIC gaslist_MOD_END, 0 | 209 MENU_DYNAMIC gaslist_MOD_END, 0 |
217 MENU_DYNAMIC gaslist_show_type, gaslist_toggle_type | 210 MENU_DYNAMIC gaslist_show_type, gaslist_toggle_type |
218 MENU_CALL tSetup_mix, do_setup_mix | 211 MENU_CALL tSetup_mix, do_setup_mix |
219 MENU_CALL tGasDepth, do_gas_depth_menu | 212 MENU_CALL tGasDepth, do_gas_depth_menu |
233 | 226 |
234 menu_tree_double_pop: | 227 menu_tree_double_pop: |
235 call menu_processor_pop ; drop exit line. | 228 call menu_processor_pop ; drop exit line. |
236 goto menu_processor_pop ; back to last gas and return | 229 goto menu_processor_pop ; back to last gas and return |
237 | 230 |
238 | 231 |
239 global do_gas_depth_menu | 232 global do_gas_depth_menu |
240 do_gas_depth_menu: | 233 do_gas_depth_menu: |
241 movff gaslist_gas,WREG | 234 movff gaslist_gas,WREG |
242 lfsr FSR1,opt_gas_type ; Read opt_gas_type[WREG] | 235 lfsr FSR1,opt_gas_type ; Read opt_gas_type[WREG] |
243 movff PLUSW1,lo ; Used as temp | 236 movff PLUSW1,lo ; Used as temp |
255 MENU_CALL tDepthMinus, gaslist_mDepth | 248 MENU_CALL tDepthMinus, gaslist_mDepth |
256 MENU_DYNAMIC gaslist_reset_mod_title,gaslist_reset_mod | 249 MENU_DYNAMIC gaslist_reset_mod_title,gaslist_reset_mod |
257 MENU_CALL tExit, return_gas_depth | 250 MENU_CALL tExit, return_gas_depth |
258 MENU_END | 251 MENU_END |
259 | 252 |
253 | |
260 ;============================================================================= | 254 ;============================================================================= |
261 ; Simulator menus | 255 ; Simulator menus |
262 | 256 |
263 global do_planner_menu | 257 global do_planner_menu |
264 | 258 |
276 call option_reset | 270 call option_reset |
277 | 271 |
278 do_planner_menu: | 272 do_planner_menu: |
279 extern do_demo_planner | 273 extern do_demo_planner |
280 MENU_BEGIN tPlan, .7 | 274 MENU_BEGIN tPlan, .7 |
275 MENU_OPTION tIntvl, odiveInterval, 0 | |
276 MENU_OPTION tBtDep, obottomDepth, 0 | |
281 MENU_CALL tInter, do_demo_divemode | 277 MENU_CALL tInter, do_demo_divemode |
282 MENU_OPTION tIntvl, odiveInterval, 0 | |
283 MENU_OPTION tBtTm, obottomTime, 0 | 278 MENU_OPTION tBtTm, obottomTime, 0 |
284 MENU_OPTION tMxDep, obottomDepth, 0 | 279 MENU_CALL tDecoSetup, do_planner_config |
285 MENU_CALL tDeco, do_demo_planner | 280 MENU_CALL tDeco, do_demo_planner |
286 MENU_CALL tSystSets, do_planner_config | |
287 MENU_CALL tExit, do_continue_main_menu | 281 MENU_CALL tExit, do_continue_main_menu |
288 MENU_END | 282 MENU_END |
283 | |
289 | 284 |
290 do_planner_config: | 285 do_planner_config: |
291 MENU_BEGIN tPlan, .3 | 286 MENU_BEGIN tPlan, .3 |
292 MENU_OPTION tSetBotUse, obottom_usage, 0 | 287 MENU_OPTION tSelectSetpoint,oSimSetpoint, 0 |
293 MENU_OPTION tSetDecoUse, odeco_usage, 0 | 288 MENU_OPTION tuseAGF, oSimAGF, 0 |
294 MENU_CALL tExit, do_planner_menu | 289 MENU_CALL tExit, do_planner_menu |
295 MENU_END | 290 MENU_END |
296 | 291 |
297 | 292 |
298 ;============================================================================= | 293 ;============================================================================= |
299 ; Divemode menu | 294 ; Divemode menu |
304 do_divemode_menu: | 299 do_divemode_menu: |
305 MENU_BEGIN tDiveModeMenu, .7 | 300 MENU_BEGIN tDiveModeMenu, .7 |
306 MENU_OPTION tDvMode, oDiveMode, 0 | 301 MENU_OPTION tDvMode, oDiveMode, 0 |
307 MENU_OPTION tDkMode, oDecoMode, 0 | 302 MENU_OPTION tDkMode, oDecoMode, 0 |
308 MENU_CALL tppO2settings, do_ppo2_menu | 303 MENU_CALL tppO2settings, do_ppo2_menu |
309 MENU_OPTION tsafetystopmenu,oSafetyStop, 0 | 304 MENU_OPTION tsafetystopmenu,oSafetyStop, 0 |
310 MENU_OPTION tFTTSMenu, oExtraTime,0 | 305 MENU_CALL t2ndDecoPlanMenu, do_2nd_deco_plan_menu |
311 MENU_CALL tDecoparameters, do_decoparameters_menu | 306 MENU_CALL tDecoparameters, do_decoparameters_menu |
312 MENU_CALL tExit, do_continue_main_menu | 307 MENU_CALL tExit, do_continue_main_menu |
313 MENU_END | 308 MENU_END |
314 | 309 |
315 do_ppo2_menu: | 310 do_ppo2_menu: |
316 MENU_BEGIN tppO2settings, .5 | 311 MENU_BEGIN tppO2settings, .6 |
317 MENU_DYNAMIC divesets_ppo2_max, do_toggle_ppo2_max | 312 |
318 MENU_DYNAMIC divesets_ppo2_max_deco, do_toggle_ppo2_max_deco | 313 MENU_DYNAMIC divesets_ppo2_max, do_toggle_ppo2_max |
319 MENU_DYNAMIC divesets_ppo2_min, do_toggle_ppo2_min | 314 MENU_DYNAMIC divesets_ppo2_max_deco, do_toggle_ppo2_max_deco |
315 MENU_DYNAMIC divesets_ppo2_min, do_toggle_ppo2_min | |
316 MENU_DYNAMIC divesets_ppo2_min_cc, do_toggle_ppo2_min_cc | |
320 MENU_OPTION tShowppO2, oShowppO2, 0 | 317 MENU_OPTION tShowppO2, oShowppO2, 0 |
321 MENU_CALL tExit, do_return_divemode_menu | 318 MENU_CALL tExit, do_return_divemode_menu |
322 MENU_END | 319 MENU_END |
323 | 320 |
324 do_return_decoparameters_menu: | 321 do_return_decoparameters_menu: |
332 MENU_OPTION tDesaturationMult,odesatmult,0 | 329 MENU_OPTION tDesaturationMult,odesatmult,0 |
333 MENU_OPTION tLastDecostop,oLastDeco, 0 | 330 MENU_OPTION tLastDecostop,oLastDeco, 0 |
334 MENU_CALL tExit, do_return_divemode_menu | 331 MENU_CALL tExit, do_return_divemode_menu |
335 MENU_END | 332 MENU_END |
336 | 333 |
334 | |
335 do_return_2nd_deco_plan_menu: | |
336 rcall menu_tree_double_pop ; drop exit line and back to last line | |
337 | |
338 | |
339 do_2nd_deco_plan_menu | |
340 MENU_BEGIN t2ndDecoPlanMenu, .7 | |
341 MENU_OPTION tFTTSMenu, oExtraTime, 0 | |
342 MENU_OPTION tCalcAscGas, oCalcAscGas, 0 | |
343 MENU_OPTION tSetBotUse, obottom_usage, 0 | |
344 MENU_OPTION tSetDecoUse, odeco_usage, 0 | |
345 MENU_CALL tTankSizes, do_tank_sizes_menu | |
346 MENU_CALL tTankFillPress, do_tank_fill_press_menu | |
347 MENU_CALL tExit, do_return_divemode_menu | |
348 MENU_END | |
349 | |
350 | |
351 | |
352 do_tank_sizes_menu: | |
353 MENU_BEGIN tTankSizes, .6 | |
354 MENU_OPTION tGas1, oTankSize1, 0 | |
355 MENU_OPTION tGas2, oTankSize2, 0 | |
356 MENU_OPTION tGas3, oTankSize3, 0 | |
357 MENU_OPTION tGas4, oTankSize4, 0 | |
358 MENU_OPTION tGas5, oTankSize5, 0 | |
359 MENU_CALL tExit, do_return_2nd_deco_plan_menu | |
360 MENU_END | |
361 | |
362 | |
363 | |
364 do_tank_fill_press_menu: | |
365 MENU_BEGIN tTankFillPress, .6 | |
366 MENU_OPTION tGas1, oTankFillPres1, 0 | |
367 MENU_OPTION tGas2, oTankFillPres2, 0 | |
368 MENU_OPTION tGas3, oTankFillPres3, 0 | |
369 MENU_OPTION tGas4, oTankFillPres4, 0 | |
370 MENU_OPTION tGas5, oTankFillPres5, 0 | |
371 MENU_CALL tExit, do_return_2nd_deco_plan_menu | |
372 MENU_END | |
373 | |
374 | |
337 do_aGF_menu: | 375 do_aGF_menu: |
338 MENU_BEGIN taGFMenu, .4 | 376 MENU_BEGIN taGFMenu, .4 |
339 MENU_OPTION taGF_enable,oEnable_aGF, 0 | 377 MENU_OPTION taGF_enable,oEnable_aGF, 0 |
340 MENU_OPTION taGF_low, oaGF_low, 0 | 378 MENU_OPTION taGF_low, oaGF_low, 0 |
341 MENU_OPTION taGF_high, oaGF_high, 0 | 379 MENU_OPTION taGF_high, oaGF_high, 0 |
342 MENU_CALL tExit, do_return_decoparameters_menu | 380 MENU_CALL tExit, do_return_decoparameters_menu |
343 MENU_END | 381 MENU_END |
382 | |
383 | |
344 ;============================================================================= | 384 ;============================================================================= |
345 ; Setup Menu | 385 ; Setup Menu |
346 | 386 |
347 do_return_settings: | 387 do_return_settings: |
348 bcf settime_setdate ; Clear flag | 388 bcf settime_setdate ; Clear flag |
349 rcall menu_tree_double_pop ; drop exit line and back to last line | 389 rcall menu_tree_double_pop ; drop exit line and back to last line |
350 | 390 |
351 extern compass_calibration_loop | 391 extern compass_calibration_loop |
352 do_settings_menu: | 392 do_settings_menu: |
353 btfsc ble_available ; ble available | 393 btfsc ble_available ; ble available |
354 bra do_settings_menu_ble ; Yes. | 394 bra do_settings_menu_ble ; Yes. |
355 MENU_BEGIN tSystSets, .6 | 395 MENU_BEGIN tSystSets, .6 |
356 MENU_CALL tInfoMenu, do_info_menu | 396 MENU_CALL tInfoMenu, do_info_menu |
357 MENU_CALL tSetTimeDate, do_date_time_menu | 397 MENU_CALL tSetTimeDate, do_date_time_menu |
358 MENU_CALL tDispSets, do_dispsets_menu | 398 MENU_CALL tDispSets, do_dispsets_menu |
359 MENU_OPTION tLanguage, oLanguage, 0 | 399 MENU_OPTION tAltMode, oAltMode, 0 |
360 MENU_CALL tMore, do_settings_menu_more | 400 MENU_CALL tMore, do_settings_menu_more |
361 MENU_CALL tExit, do_continue_main_menu | 401 MENU_CALL tExit, do_continue_main_menu |
362 MENU_END | 402 MENU_END |
363 | 403 |
364 do_settings_menu_ble: | 404 do_settings_menu_ble: |
365 MENU_BEGIN tSystSets, .7 | 405 MENU_BEGIN tSystSets, .7 |
366 MENU_CALL tInfoMenu, do_info_menu | 406 MENU_CALL tInfoMenu, do_info_menu |
367 MENU_CALL tBleTitle, comm_mode0 | 407 MENU_CALL tBleTitle, comm_mode0 |
368 MENU_CALL tSetTimeDate, do_date_time_menu | 408 MENU_CALL tSetTimeDate, do_date_time_menu |
369 MENU_CALL tDispSets, do_dispsets_menu | 409 MENU_CALL tDispSets, do_dispsets_menu |
370 MENU_OPTION tLanguage, oLanguage, 0 | 410 MENU_OPTION tAltMode, oAltMode, 0 |
371 MENU_CALL tMore, do_settings_menu_more | 411 MENU_CALL tMore, do_settings_menu_more |
372 MENU_CALL tExit, do_continue_main_menu | 412 MENU_CALL tExit, do_continue_main_menu |
373 MENU_END | 413 MENU_END |
374 | 414 |
375 do_return_settings_more: | 415 do_return_settings_more: |
376 rcall menu_tree_double_pop ; drop exit line and back to last line | 416 rcall menu_tree_double_pop ; drop exit line and back to last line |
377 | 417 |
378 do_settings_menu_more: | 418 do_settings_menu_more: |
379 btfsc battery_gauge_available ; piezo buttons available | 419 btfsc battery_gauge_available ; piezo buttons available |
380 bra do_settings_menu_more_piezo | 420 bra do_settings_menu_more_piezo |
381 btfsc ble_available ; ble available | 421 btfsc ble_available ; ble available |
382 bra do_settings_menu_more_ostc3p | 422 bra do_settings_menu_more_ostc3p |
383 MENU_BEGIN tSystSets, .7 | 423 MENU_BEGIN tSystSets, .7 |
384 MENU_CALL tCompassMenu, do_compass_menu | 424 MENU_CALL tCompassMenu, do_compass_menu |
385 MENU_CALL tLogOffset, do_log_offset_menu | 425 MENU_CALL tLogOffset, do_log_offset_menu |
386 MENU_OPTION tUnits, oUnits, 0 | 426 MENU_OPTION tUnits, oUnits, 0 |
387 MENU_OPTION tSamplingrate,oSamplingRate,0 | 427 MENU_OPTION tLanguage, oLanguage, 0 |
388 MENU_OPTION tDvSalinity,oDiveSalinity, 0 | 428 MENU_OPTION tDvSalinity, oDiveSalinity, 0 |
389 MENU_CALL tResetMenu, do_reset_menu | 429 MENU_CALL tResetMenu, do_reset_menu |
390 MENU_CALL tExit, do_return_settings | 430 MENU_CALL tExit, do_return_settings |
391 MENU_END | 431 MENU_END |
392 | 432 |
393 do_settings_menu_more_piezo_exit: | 433 do_settings_menu_more_piezo_exit: |
394 call TFT_ClearScreen | 434 call TFT_ClearScreen |
395 extern piezo_config | 435 extern piezo_config |
396 call piezo_config ; Configure buttons | 436 call piezo_config ; Configure buttons |
397 | 437 |
398 do_settings_menu_more_piezo: | 438 do_settings_menu_more_piezo: |
399 MENU_BEGIN tSystSets, .7 | 439 MENU_BEGIN tSystSets, .7 |
400 MENU_CALL tCompassMenu, do_compass_menu | 440 MENU_CALL tCompassMenu, do_compass_menu |
401 MENU_CALL tLogOffset, do_log_offset_menu | 441 MENU_CALL tLogOffset, do_log_offset_menu |
402 MENU_OPTION tUnits, oUnits, 0 | 442 MENU_OPTION tUnits, oUnits, 0 |
403 MENU_OPTION tSamplingrate,oSamplingRate,0 | 443 MENU_OPTION tLanguage, oLanguage, 0 |
404 MENU_OPTION tDvSalinity,oDiveSalinity, 0 | 444 MENU_OPTION tDvSalinity, oDiveSalinity, 0 |
405 MENU_CALL tMore, do_settings_piezo_menu | 445 MENU_CALL tMore, do_settings_piezo_menu |
406 MENU_CALL tExit, do_return_settings | 446 MENU_CALL tExit, do_return_settings |
407 MENU_END | 447 MENU_END |
408 | 448 |
409 extern comm_mode0 | 449 extern comm_mode0 |
410 | 450 |
411 do_settings_piezo_menu: | 451 do_settings_piezo_menu: |
412 ; Menu with features only available in piezo button hardware | 452 ; Menu with features only available in piezo button hardware |
413 MENU_BEGIN tSystSets, .4 | 453 MENU_BEGIN tSystSets, .4 |
414 MENU_CALL tResetMenu, do_reset_menu | 454 MENU_CALL tResetMenu, do_reset_menu |
415 MENU_OPTION tButtonleft,ocR_button_left ,0 ; left button sensitivity | 455 MENU_OPTION tButtonleft, ocR_button_left, 0 ; left button sensitivity |
416 MENU_OPTION tButtonright,ocR_button_right,0 ; right button sensitivity | 456 MENU_OPTION tButtonright, ocR_button_right, 0 ; right button sensitivity |
417 MENU_CALL tExit, do_settings_menu_more_piezo_exit | 457 MENU_CALL tExit, do_settings_menu_more_piezo_exit |
418 MENU_END | 458 MENU_END |
419 | 459 |
420 do_settings_menu_more_ostc3p: ; Menu with BLE feature | 460 do_settings_menu_more_ostc3p: ; Menu with BLE feature |
421 MENU_BEGIN tSystSets, .7 | 461 MENU_BEGIN tSystSets, .7 |
422 MENU_CALL tCompassMenu, do_compass_menu | 462 MENU_CALL tCompassMenu, do_compass_menu |
423 MENU_CALL tLogOffset, do_log_offset_menu | 463 MENU_CALL tLogOffset, do_log_offset_menu |
424 MENU_OPTION tUnits, oUnits, 0 | 464 MENU_OPTION tUnits, oUnits, 0 |
425 MENU_OPTION tSamplingrate,oSamplingRate,0 | 465 MENU_OPTION tLanguage, oLanguage, 0 |
426 MENU_OPTION tDvSalinity,oDiveSalinity, 0 | 466 MENU_OPTION tDvSalinity, oDiveSalinity, 0 |
427 MENU_CALL tResetMenu, do_reset_menu | 467 MENU_CALL tResetMenu, do_reset_menu |
428 MENU_CALL tExit, do_return_settings | 468 MENU_CALL tExit, do_return_settings |
429 MENU_END | 469 MENU_END |
430 | 470 |
431 do_compass_menu: | 471 do_compass_menu: |
432 MENU_BEGIN tSystSets, .5 | 472 MENU_BEGIN tSystSets, .5 |
433 MENU_CALL tCompassMenu, compass_calibration_loop | 473 MENU_CALL tCompassMenu, compass_calibration_loop |
434 ; MENU_OPTION tCompassGain, oCompassGain, 0 | 474 ; MENU_OPTION tCompassGain, oCompassGain, 0 |
435 MENU_DYNAMIC menu_cal_x, 0 | 475 MENU_DYNAMIC menu_cal_x, 0 |
436 MENU_DYNAMIC menu_cal_y, 0 | 476 MENU_DYNAMIC menu_cal_y, 0 |
437 MENU_DYNAMIC menu_cal_z, 0 | 477 MENU_DYNAMIC menu_cal_z, 0 |
438 MENU_CALL tExit, do_return_settings_more | 478 MENU_CALL tExit, do_return_settings_more |
439 MENU_END | 479 MENU_END |
440 | 480 |
441 ;============================================================================= | 481 ;============================================================================= |
442 ; Reset and confirmation menu. | 482 ; Reset and confirmation menu. |
443 | 483 |
444 do_reset_menu: | 484 do_reset_menu: |
445 MENU_BEGIN tResetMenu, .6 | 485 MENU_BEGIN tResetMenu, .6 |
446 MENU_CALL tExit, do_return_settings | 486 MENU_CALL tExit, do_return_settings |
447 MENU_CALL tReboot, do_reset_menu2 ; Confirm | 487 MENU_CALL tReboot, do_reset_menu2 ; Confirm |
448 MENU_CALL tResetDeco, do_reset_menu3 ; Confirm | 488 MENU_CALL tResetDeco, do_reset_menu3 ; Confirm |
449 MENU_CALL tResetSettings, do_reset_menu4 ; Confirm | 489 MENU_CALL tResetSettings, do_reset_menu4 ; Confirm |
450 MENU_CALL tResetLogbook, do_reset_menu5 ; Confirm | 490 MENU_CALL tResetLogbook, do_reset_menu5 ; Confirm |
451 MENU_CALL tResetBattery, new_battery_menu ; New Battery submenu | 491 MENU_CALL tResetBattery, new_battery_menu ; New Battery sub menu |
452 MENU_END | 492 MENU_END |
453 | 493 |
454 do_reset_menu2: | 494 do_reset_menu2: |
455 MENU_BEGIN tResetMenu2, .2 | 495 MENU_BEGIN tResetMenu2, .2 |
456 MENU_CALL tAbort, do_continue_menu_3stack | 496 MENU_CALL tAbort, do_continue_menu_3stack |
457 MENU_CALL tReboot, do_reboot ; Reboot | 497 MENU_CALL tReboot, do_reboot ; Reboot |
458 MENU_END | 498 MENU_END |
459 | 499 |
460 do_reset_menu3: | 500 do_reset_menu3: |
461 MENU_BEGIN tResetMenu2, .2 | 501 MENU_BEGIN tResetMenu2, .2 |
462 MENU_CALL tAbort, do_continue_menu_3stack | 502 MENU_CALL tAbort, do_continue_menu_3stack |
463 MENU_CALL tResetDeco, do_reset_deco ; Reset Deco | 503 MENU_CALL tResetDeco, do_reset_deco ; Reset Deco |
464 MENU_END | 504 MENU_END |
465 | 505 |
466 do_reset_menu4: | 506 do_reset_menu4: |
467 MENU_BEGIN tResetMenu2, .2 | 507 MENU_BEGIN tResetMenu2, .2 |
468 MENU_CALL tAbort, do_continue_menu_3stack | 508 MENU_CALL tAbort, do_continue_menu_3stack |
469 MENU_CALL tResetSettings, do_reset_settings ; Reset all settings | 509 MENU_CALL tResetSettings, do_reset_settings ; Reset all settings |
470 MENU_END | 510 MENU_END |
471 | 511 |
472 do_reset_menu5: | 512 do_reset_menu5: |
473 MENU_BEGIN tResetMenu2, .2 | 513 MENU_BEGIN tResetMenu2, .2 |
474 MENU_CALL tAbort, do_continue_menu_3stack | 514 MENU_CALL tAbort, do_continue_menu_3stack |
475 MENU_CALL tResetLogbook, do_reset_logbook ; Reset logbook | 515 MENU_CALL tResetLogbook, do_reset_logbook ; Reset logbook |
476 MENU_END | 516 MENU_END |
477 | 517 |
478 do_reset_logbook: | 518 do_reset_logbook: |
479 clrf EEADRH ; Make sure to select eeprom bank 0 | 519 clrf EEADRH ; Make sure to select eeprom bank 0 |
480 clrf EEDATA | 520 clrf EEDATA |
491 call ext_flash_erase_logbook ; And complete logbook (!) | 531 call ext_flash_erase_logbook ; And complete logbook (!) |
492 goto do_continue_main_menu ; back to menu | 532 goto do_continue_main_menu ; back to menu |
493 | 533 |
494 | 534 |
495 do_reset_deco: | 535 do_reset_deco: |
496 movlw d'79' ; 79% N2 | 536 SAFE_2BYTE_COPY last_surfpressure_30min,int_I_pres_respiration ; copy surface pressure to deco routine |
497 movff WREG,char_I_N2_ratio | 537 SAFE_2BYTE_COPY last_surfpressure_30min,int_I_pres_surface ; copy surface pressure to deco routine |
498 movlw d'0' | 538 |
499 movff WREG,char_I_step_is_1min ; 2 second deco mode | 539 call deco_clear_tissue ; set all tissues to Pamb * N2_ratio (C-Code) |
500 SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; copy for deco routine | 540 banksel common ; back to bank 1, needed after every return from C code |
501 movff int_I_pres_respiration+0,int_I_pres_surface+0 ; copy for desat routine | 541 |
502 movff int_I_pres_respiration+1,int_I_pres_surface+1 | 542 call deco_calc_wo_deco_step_1_min ; calculate deco in surface mode |
503 | 543 call deco_calc_desaturation_time ; calculate desaturation and no-fly time |
504 extern deco_reset | 544 banksel common |
505 call deco_reset | 545 |
506 call deco_calc_desaturation_time ; calculate desaturation time | |
507 banksel common | |
508 call deco_calc_wo_deco_step_1_min ; calculate deco in surface mode | |
509 banksel common | |
510 clrf nofly_time+0 ; Reset NoFly | |
511 clrf nofly_time+1 | |
512 clrf desaturation_time+0 ; Reset Desat | |
513 clrf desaturation_time+1 | |
514 goto do_return_settings ; back to menu | 546 goto do_return_settings ; back to menu |
515 | 547 |
516 do_reset_settings: | 548 do_reset_settings: |
517 call TFT_ClearScreen ; Clear screen | 549 call TFT_ClearScreen ; Clear screen |
518 banksel common | 550 banksel common |
519 extern option_reset_all | 551 extern option_reset_all |
520 call option_reset_all ; Reset all options to factory default. | 552 call option_reset_all ; Reset all options to factory default. |
521 goto restart ; Restart into surfacemode | 553 goto restart ; Restart into surfacemode |
522 | 554 |
523 do_continue_menu_3stack: ; Return three levels deep | 555 do_continue_menu_3stack: ; Return three levels deep |
524 call menu_processor_pop | 556 call menu_processor_pop |
525 goto do_return_settings | 557 goto do_return_settings |
526 | 558 |
527 do_reboot: | 559 do_reboot: |
528 call ext_flash_enable_protection ; Enables write protection | 560 call ext_flash_enable_protection ; Enables write protection |
529 reset | 561 reset |
530 | 562 |
531 | 563 |
532 do_date_time_menu: | 564 do_date_time_menu: |
533 MENU_BEGIN tSetTimeDate, .4 | 565 MENU_BEGIN tSetTimeDate, .4 |
541 bsf settime_setdate | 573 bsf settime_setdate |
542 MENU_BEGIN tSetDate, .4 | 574 MENU_BEGIN tSetDate, .4 |
543 MENU_OPTION tSetDay, oSetDay, 0 | 575 MENU_OPTION tSetDay, oSetDay, 0 |
544 MENU_OPTION tSetMonth, oSetMonth, 0 | 576 MENU_OPTION tSetMonth, oSetMonth, 0 |
545 MENU_OPTION tSetYear, oSetYear, 0 | 577 MENU_OPTION tSetYear, oSetYear, 0 |
546 MENU_CALL tExit, do_continue_menu_3stack | 578 MENU_CALL tExit, do_continue_menu_3stack |
547 MENU_END | 579 MENU_END |
548 | 580 |
549 | 581 |
550 do_reset_seconds: | 582 do_reset_seconds: |
551 clrf secs | 583 clrf secs |
552 extern rtc_set_rtc | 584 extern rtc_set_rtc |
553 call rtc_set_rtc ; writes mins,sec,hours,day,month and year to rtc module | 585 call rtc_set_rtc ; writes mins,sec,hours,day,month and year to rtc module |
554 do_time_menu: | 586 do_time_menu: |
555 bsf settime_setdate | 587 bsf settime_setdate |
556 MENU_BEGIN tSetTime, .4 | 588 MENU_BEGIN tSetTime, .4 |
557 MENU_OPTION tSetHours, oSetHours, 0 | 589 MENU_OPTION tSetHours, oSetHours, 0 |
558 MENU_OPTION tSetMinutes,oSetMinutes, 0 | 590 MENU_OPTION tSetMinutes,oSetMinutes, 0 |
559 MENU_CALL tSetSeconds, do_reset_seconds | 591 MENU_CALL tSetSeconds, do_reset_seconds |
560 MENU_CALL tExit, do_continue_menu_3stack | 592 MENU_CALL tExit, do_continue_menu_3stack |
561 MENU_END | 593 MENU_END |
562 | 594 |
563 | 595 |
564 do_toggle_ppo2_max: ; add 0.1bar, with hard-coded max. | 596 do_toggle_ppo2_max: ; add 0.1bar, with hard-coded max. |
565 movff opt_ppO2_max,lo ; banksafe | 597 movff char_I_ppO2_max,lo ; banksafe |
566 movlw .10 | 598 movlw .10 |
567 addwf lo,F | 599 addwf lo,F |
568 movlw ppo2_highest_setting | 600 movlw ppo2_highest_setting |
569 cpfsgt lo | 601 cpfsgt lo |
570 bra do_toggle_ppo2_max2 | 602 bra do_toggle_ppo2_max2 |
571 movlw .120 | 603 movlw .120 |
572 movwf lo | 604 movwf lo |
573 do_toggle_ppo2_max2: | 605 do_toggle_ppo2_max2: |
574 movff lo,opt_ppO2_max | 606 movff lo,char_I_ppO2_max |
575 return | 607 return |
576 | 608 |
577 do_toggle_ppo2_max_deco: ; add 0.1bar, with hard-coded max. | 609 do_toggle_ppo2_max_deco: ; add 0.1bar, with hard-coded max. |
578 movff opt_ppO2_max_deco,lo ; banksafe | 610 movff char_I_ppO2_max_deco,lo ; banksafe |
579 movlw .10 | 611 movlw .10 |
580 addwf lo,F | 612 addwf lo,F |
581 movlw ppo2_highest_setting_deco | 613 movlw ppo2_highest_setting_deco |
582 cpfsgt lo | 614 cpfsgt lo |
583 bra do_toggle_ppo2_max_deco2 | 615 bra do_toggle_ppo2_max_deco2 |
584 movlw .120 | 616 movlw .120 |
585 movwf lo | 617 movwf lo |
586 do_toggle_ppo2_max_deco2: | 618 do_toggle_ppo2_max_deco2: |
587 movff lo,opt_ppO2_max_deco | 619 movff lo,char_I_ppO2_max_deco |
588 return | 620 return |
589 | 621 |
590 do_toggle_ppo2_min: ; sub 0.1bar, with hard-coded min. | 622 do_toggle_ppo2_min: ; sub 0.1bar, with hard-coded min. |
591 movff opt_ppO2_min,lo ; banksafe | 623 movff char_I_ppO2_min,lo ; banksafe |
592 incf lo,F | 624 incf lo,F |
593 movlw .21 | 625 movlw .21 |
594 cpfsgt lo | 626 cpfsgt lo |
595 bra do_toggle_ppo2_min2 | 627 bra do_toggle_ppo2_min2 |
596 movlw ppo2_lowest_setting | 628 movlw ppo2_lowest_setting |
597 movwf lo | 629 movwf lo |
598 do_toggle_ppo2_min2: | 630 do_toggle_ppo2_min2: |
599 movff lo,opt_ppO2_min | 631 movff lo,char_I_ppO2_min |
600 return | 632 return |
601 | 633 |
634 do_toggle_ppo2_min_cc: ; sub 0.1bar, with hard-coded min. | |
635 movff char_I_ppO2_min_loop,lo ; banksafe | |
636 incf lo,F | |
637 movlw ppo2_warning_low_cc_max | |
638 cpfsgt lo | |
639 bra do_toggle_ppo2_min_cc2 | |
640 movlw ppo2_warning_low_cc_min | |
641 movwf lo | |
642 do_toggle_ppo2_min_cc2: | |
643 movff lo,char_I_ppO2_min_loop | |
644 return | |
645 | |
602 | 646 |
603 ; Logbook offset sub-menu | 647 ; Logbook offset sub-menu |
604 do_log_offset_menu: | 648 do_log_offset_menu: |
605 MENU_BEGIN tLogOffset, .6 | 649 MENU_BEGIN tLogOffset, .6 |
606 MENU_DYNAMIC TFT_LogOffset_Logtitle, 0 | 650 MENU_DYNAMIC TFT_LogOffset_Logtitle, 0 |
650 addwfc hi | 694 addwfc hi |
651 goto do_logoffset_common_write ; Store and return | 695 goto do_logoffset_common_write ; Store and return |
652 | 696 |
653 do_dispsets_menu_3stack: | 697 do_dispsets_menu_3stack: |
654 bcf in_color_menu | 698 bcf in_color_menu |
655 rcall menu_tree_double_pop ; drop exit line and back to last line | 699 call menu_tree_double_pop ; drop exit line and back to last line |
656 | 700 |
657 do_dispsets_menu: | 701 do_dispsets_menu: |
658 MENU_BEGIN tDispSets, .5 | 702 MENU_BEGIN tDispSets, .6 |
659 MENU_OPTION tBright, oBrightness, 0 | 703 MENU_OPTION tBright, oBrightness, 0 |
660 MENU_CALL tColorScheme, do_color_scheme | 704 MENU_CALL tColorScheme, do_color_scheme |
705 MENU_OPTION tLanguage, oLanguage, 0 | |
661 MENU_OPTION tFlip, oFlipScreen, 0 | 706 MENU_OPTION tFlip, oFlipScreen, 0 |
662 MENU_CALL tMore, do_dispsets_menu_more | 707 MENU_CALL tMore, do_dispsets_menu_more |
663 MENU_CALL tExit, do_return_settings | 708 MENU_CALL tExit, do_return_settings |
664 MENU_END | 709 MENU_END |
665 | 710 |
666 do_dispsets_menu_more: | 711 do_dispsets_menu_more: |
667 MENU_BEGIN tDispSets, .5 | 712 MENU_BEGIN tDispSets, .6 |
668 MENU_OPTION tMODwarning, oMODwarning, 0 | 713 MENU_OPTION tMODwarning, oMODwarning, 0 |
669 MENU_OPTION tVSItext2, oVSItextv2, 0 | 714 MENU_OPTION tIBCDwarning, oEnable_IBCD, 0 |
670 MENU_OPTION tVSIgraph, oVSIgraph, 0 | 715 MENU_OPTION tVSItext2, oVSItextv2, 0 |
671 MENU_OPTION tTimeoutDive, oDiveTimeout, 0 | 716 MENU_OPTION tVSIgraph, oVSIgraph, 0 |
717 MENU_OPTION tTimeoutDive, oDiveTimeout, 0 | |
672 MENU_CALL tExit, do_dispsets_menu_3stack | 718 MENU_CALL tExit, do_dispsets_menu_3stack |
673 MENU_END | 719 MENU_END |
674 | 720 |
675 extern oColorSetDive | 721 extern oColorSetDive |
676 do_color_scheme: | 722 do_color_scheme: |
747 bra menu_new_battery_18650 | 793 bra menu_new_battery_18650 |
748 bra use_old_batteries ; any unsupported value | 794 bra use_old_batteries ; any unsupported value |
749 | 795 |
750 menu_new_battery_AA_16650: | 796 menu_new_battery_AA_16650: |
751 MENU_BEGIN tNewBattTitle, .5 | 797 MENU_BEGIN tNewBattTitle, .5 |
752 MENU_CALL tNewBattOld, use_old_batteries | 798 MENU_CALL tNewBattOld, use_old_batteries |
753 MENU_CALL tNewBattNew36, use_new_36V_batteries | 799 MENU_CALL tNewBattNew36, use_new_36V_batteries |
754 MENU_CALL tNewBattNew15, use_new_15V_batteries | 800 MENU_CALL tNewBattNew15, use_new_15V_batteries |
755 MENU_CALL tNewBattAccu, use_36V_rechargeable | 801 MENU_CALL tNewBattAccu, use_36V_rechargeable |
756 MENU_CALL tNew16650, use_16650_battery | 802 MENU_CALL tNew16650, use_16650_battery |
757 MENU_END | 803 MENU_END |
758 | 804 |
759 menu_new_battery_AA: | 805 menu_new_battery_AA: |
760 MENU_BEGIN tNewBattTitle, .4 | 806 MENU_BEGIN tNewBattTitle, .4 |
761 MENU_CALL tNewBattOld, use_old_batteries | 807 MENU_CALL tNewBattOld, use_old_batteries |
762 MENU_CALL tNewBattNew36, use_new_36V_batteries | 808 MENU_CALL tNewBattNew36, use_new_36V_batteries |
763 MENU_CALL tNewBattNew15, use_new_15V_batteries | 809 MENU_CALL tNewBattNew15, use_new_15V_batteries |
764 MENU_CALL tNewBattAccu, use_36V_rechargeable | 810 MENU_CALL tNewBattAccu, use_36V_rechargeable |
765 MENU_END | 811 MENU_END |
766 | 812 |
767 menu_new_battery_18650: | 813 menu_new_battery_18650: |
768 MENU_BEGIN tNewBattTitle, .2 | 814 MENU_BEGIN tNewBattTitle, .2 |
769 MENU_CALL tNewBattOld, use_old_batteries | 815 MENU_CALL tNewBattOld, use_old_batteries |
770 MENU_CALL tNew18650, use_18650_battery | 816 MENU_CALL tNew18650, use_18650_battery |
771 MENU_END | 817 MENU_END |
772 | 818 |
773 | 819 |
774 global use_old_prior_209 | 820 global use_old_prior_209 |
775 use_old_prior_209: | 821 use_old_prior_209: |
776 clrf EEADRH | 822 clrf EEADRH |
777 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 | 823 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 |
778 incfsz EEDATA,F ; Was 0xFF? | 824 incfsz EEDATA,F ; Was 0xFF? |
779 return ; No, done. | 825 return ; No, done. |
780 | 826 |
781 call lt2942_get_status ; Check for gauge IC | 827 call lt2942_get_status ; Check for gauge IC |
782 movlw .3 ; Assume a 18650 | 828 movlw .3 ; Assume a 18650 |
783 btfss battery_gauge_available ; cR/2 hardware? | 829 btfss battery_gauge_available ; cR/2 hardware? |
784 movlw .1 ; Assume a Saft | 830 movlw .1 ; Assume a Saft |
785 movwf EEDATA | 831 movwf EEDATA |
786 write_int_eeprom 0x0F ; Store the new battery type into EEPROM | 832 write_int_eeprom 0x0F ; Store the new battery type into EEPROM |
787 return | 833 return |
788 | 834 |
789 global use_old_batteries | 835 global use_old_batteries |
790 use_old_batteries: | 836 use_old_batteries: |
791 clrf EEADRH | 837 clrf EEADRH |
800 read_int_eeprom 0x0B | 846 read_int_eeprom 0x0B |
801 movff EEDATA,battery_gauge+4 | 847 movff EEDATA,battery_gauge+4 |
802 read_int_eeprom 0x0C | 848 read_int_eeprom 0x0C |
803 movff EEDATA,battery_gauge+5 | 849 movff EEDATA,battery_gauge+5 |
804 read_int_eeprom 0x0F | 850 read_int_eeprom 0x0F |
805 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 | 851 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 |
806 | 852 |
807 rcall setup_new_saft ; Any other value | 853 rcall setup_new_saft ; Any other value |
808 incf EEDATA,F ; 1 ... 5 | 854 incf EEDATA,F ; 1 ... 5 |
809 dcfsnz EEDATA,F | 855 dcfsnz EEDATA,F |
810 rcall setup_new_15v ;=0 | 856 rcall setup_new_15v ;=0 |
811 dcfsnz EEDATA,F | 857 dcfsnz EEDATA,F |
812 rcall setup_new_saft ;=1 | 858 rcall setup_new_saft ;=1 |
813 dcfsnz EEDATA,F | 859 dcfsnz EEDATA,F |
822 | 868 |
823 setup_new_15v: | 869 setup_new_15v: |
824 bsf charge_disable | 870 bsf charge_disable |
825 bcf TRISE,2 | 871 bcf TRISE,2 |
826 movlw .100 | 872 movlw .100 |
827 movwf batt_percent ; To have 1,5V batteries right after firmware update | 873 movwf batt_percent ; To have 1,5V batteries right after firmware update |
828 movlw .0 | 874 movlw .0 |
829 movff WREG,battery_type | 875 movff WREG,battery_type |
830 return | 876 return |
831 | 877 |
832 setup_new_saft: | 878 setup_new_saft: |
919 rcall setup_new_saft | 965 rcall setup_new_saft |
920 bra use_new_36V_2 | 966 bra use_new_36V_2 |
921 use_new_15V_batteries: | 967 use_new_15V_batteries: |
922 rcall setup_new_15v | 968 rcall setup_new_15v |
923 use_new_36V_2: | 969 use_new_36V_2: |
924 call reset_battery_pointer ; Resets battery pointer 0x07-0x0C and battery_gauge:5 | 970 call reset_battery_pointer ; Resets battery pointer 0x07-0x0C and battery_gauge:5 |
925 goto surfloop ; Jump to Surfaceloop! | 971 goto surfloop ; Jump to Surface loop! |
926 use_36V_rechargeable: | 972 use_36V_rechargeable: |
927 rcall setup_new_panasonic | 973 rcall setup_new_panasonic |
928 call reset_battery_internal_only | 974 call reset_battery_internal_only |
929 goto surfloop ; Jump to Surfaceloop! | 975 goto surfloop ; Jump to Surface loop! |
930 | 976 |
931 END | 977 END |