Mercurial > public > hwos_code
annotate src/menu_tree.asm @ 64:40a5cc0664ed
Merge
author | heinrichsweikamp |
---|---|
date | Fri, 10 Jan 2014 10:13:53 +0100 |
parents | e7c7c7eeea58 5c4d4a42e7a0 |
children | 00636132cca6 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
3 ; File menu_tree.asm | |
4 ; | |
5 ; OSTC3 menus | |
6 ; | |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
10 ; 2011-07-11 : [jDG] Creation. | |
11 | |
12 #include "ostc3.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 | |
26 gui CODE | |
27 ;============================================================================= | |
28 ; Main Menu | |
29 global do_main_menu | |
30 do_main_menu: | |
39
e4e91fe8b09d
remember last customview in dive and surface mode
mh@mh-THINK.fritz.box
parents:
23
diff
changeset
|
31 movff menupos3,customview_surfmode; save last customview |
0 | 32 bcf sleepmode ; for timeout |
33 call menu_processor_reset ; restart from first icon. | |
34 | |
35 do_continue_main_menu: | |
36 call menu_processor_pop ; drop exit line. | |
37 call menu_processor_pop ; back to last icon. | |
38 | |
39 extern do_demo_divemode, restart | |
40 MENU_BEGIN tMainMenu, .7 | |
41 MENU_CALL tLogbook, logbook | |
42 MENU_CALL tGasSetup, do_gas_menu | |
43 MENU_CALL tCCRSetup, do_ccr_menu | |
44 MENU_CALL tPlan, do_planner_menu_reset | |
45 MENU_CALL tDiveModeMenu, do_divemode_menu | |
46 MENU_CALL tSystSets, do_settings_menu | |
47 MENU_CALL tExit, restart | |
48 MENU_END | |
49 | |
50 do_info_menu: | |
62 | 51 MENU_BEGIN tInfoMenu, .5 |
0 | 52 MENU_DYNAMIC info_menu_serial, 0 |
53 MENU_DYNAMIC info_menu_firmware, 0 | |
54 MENU_DYNAMIC info_menu_total_dives, 0 | |
62 | 55 MENU_DYNAMIC info_menu_battery_volts,0 |
0 | 56 MENU_CALL tExit, do_return_settings |
57 MENU_END | |
58 | |
59 ;============================================================================= | |
60 ; CCR Setup | |
61 | |
62 return_ccr_menu: | |
63 call menu_processor_pop ; drop exit line. | |
64 call menu_processor_pop ; back to last gas. | |
65 | |
66 do_ccr_menu: | |
67 bcf menu_show_sensors ; Set flag | |
68 MENU_BEGIN tCCRSetup, .5 | |
69 MENU_OPTION tCCRMode, oCCRMode, 0 | |
70 MENU_CALL tCCRSensor, do_ccr_sensor | |
71 MENU_CALL tDiluentSetup, do_diluent_setup | |
72 MENU_CALL tFixedSetpoints, do_fixed_setpoints | |
73 MENU_CALL tExit, do_continue_main_menu | |
74 MENU_END | |
75 | |
76 do_ccr_sensor: | |
77 call enable_ir ; Enable IR-Port | |
78 bsf menu_show_sensors ; Set flag | |
79 MENU_BEGIN tCCRSensor, .4 | |
80 MENU_CALL tDiveHudMask1, 0 | |
81 MENU_CALL tDiveHudMask2, 0 | |
82 MENU_CALL tDiveHudMask3, 0 | |
83 MENU_CALL tExit, return_ccr_menu | |
84 MENU_END | |
85 | |
86 do_diluent_setup: | |
87 bsf ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") | |
88 call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth | |
89 MENU_BEGIN tDiluentSetup, .6 | |
90 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
91 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
92 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
93 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
94 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
95 MENU_CALL tExit, return_ccr_menu | |
96 MENU_END | |
97 | |
98 do_return_fixed_setpoints: | |
99 call menu_processor_pop ; drop exit line. | |
100 call menu_processor_pop ; back to last gas. | |
101 | |
102 do_fixed_setpoints: | |
103 MENU_BEGIN tFixedSetpoints, .6 | |
104 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
105 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
106 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
107 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
108 MENU_DYNAMIC gaslist_strcat_setpoint, do_edit_sp_menu | |
109 MENU_CALL tExit, return_ccr_menu | |
110 MENU_END | |
111 | |
112 do_edit_sp_menu: | |
113 call gaslist_setSP ; Save current item. | |
114 MENU_BEGIN tFixedSetpoints, .5 | |
115 MENU_DYNAMIC gaslist_strcat_setpoint_0,0 | |
116 MENU_CALL tSPPlus, gaslist_spplus | |
117 MENU_CALL tDepthPlus, gaslist_spdepthplus | |
118 MENU_CALL tDepthMinus, gaslist_spdepthminus | |
119 MENU_CALL tExit, do_return_fixed_setpoints | |
120 MENU_END | |
121 | |
122 ;============================================================================= | |
123 ; OC Gas Setup | |
124 | |
125 return_gas_menu: | |
126 call menu_processor_pop ; drop exit line. | |
127 call menu_processor_pop ; back to last gas. | |
128 | |
129 btfsc ccr_diluent_setup ; Return to CCR-Menu? | |
130 bra do_diluent_setup ; Yes. | |
131 do_gas_menu: | |
132 bcf ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") | |
133 call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth | |
134 MENU_BEGIN tGaslist, .6 | |
135 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
136 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
137 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
138 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
139 MENU_DYNAMIC gaslist_strcat_gas_mod, do_edit_gas_menu | |
140 MENU_CALL tExit, do_continue_main_menu | |
141 MENU_END | |
142 | |
143 return_gas_depth: | |
144 call menu_processor_pop ; drop exit line. | |
145 call menu_processor_pop ; back to last gas. | |
146 bra do_edit_gas_menu_1 | |
147 | |
148 do_edit_gas_menu: | |
149 call gaslist_setgas ; Save current item. | |
150 do_edit_gas_menu_1: ; Keep current gas. | |
151 MENU_BEGIN tGasEdit, .6 | |
152 MENU_DYNAMIC gaslist_gastitle, 0 | |
153 MENU_DYNAMIC gaslist_MOD_END, 0 | |
154 MENU_DYNAMIC gaslist_show_type, gaslist_toggle_type | |
155 MENU_CALL tSetup_mix, do_setup_mix | |
156 MENU_CALL tGasDepth, do_gas_depth_menu | |
157 MENU_CALL tExit, return_gas_menu | |
158 MENU_END | |
159 | |
160 do_setup_mix: | |
161 MENU_BEGIN tGasEdit, .7 | |
162 MENU_DYNAMIC gaslist_gastitle, 0 | |
163 MENU_DYNAMIC gaslist_MOD_END, 0 | |
164 MENU_CALL tO2Plus, gaslist_pO2 | |
165 MENU_CALL tO2Minus, gaslist_mO2 | |
166 MENU_CALL tHePlus, gaslist_pHe | |
167 MENU_CALL tHeMinus, gaslist_mHe | |
168 MENU_CALL tExit, return_gas_depth | |
169 MENU_END | |
170 | |
171 global do_gas_depth_menu | |
172 do_gas_depth_menu: | |
173 MENU_BEGIN tGasEdit, .6 | |
174 MENU_DYNAMIC gaslist_gastitle, 0 | |
175 MENU_DYNAMIC gaslist_MOD_END, 0 | |
176 MENU_CALL tDepthPlus, gaslist_pDepth | |
177 MENU_CALL tDepthMinus, gaslist_mDepth | |
178 MENU_DYNAMIC gaslist_reset_mod_title,gaslist_reset_mod | |
179 MENU_CALL tExit, return_gas_depth | |
180 MENU_END | |
181 | |
182 ;============================================================================= | |
183 ; Simulator menus | |
184 | |
185 global do_planner_menu | |
186 | |
187 do_planner_menu_reset: | |
188 extern option_save_all | |
189 call option_save_all | |
190 ;---- Reset dive time/depth to default values | |
191 extern option_reset | |
192 lfsr FSR0,odiveInterval | |
193 call option_reset | |
194 lfsr FSR0,obottomTime | |
195 call option_reset | |
196 lfsr FSR0,obottomDepth | |
197 call option_reset | |
198 | |
199 do_planner_menu: | |
200 extern do_demo_planner | |
201 MENU_BEGIN tPlan, .6 | |
202 MENU_CALL tInter, do_demo_divemode | |
203 MENU_OPTION tIntvl, odiveInterval, 0 | |
204 MENU_OPTION tBtTm, obottomTime, 0 | |
205 MENU_OPTION tMxDep, obottomDepth, 0 | |
206 MENU_CALL tDeco, do_demo_planner | |
207 MENU_CALL tExit, do_continue_main_menu | |
208 MENU_END | |
209 | |
210 ;============================================================================= | |
211 ; Divemode menu | |
212 | |
213 do_return_divemode_menu: | |
214 call menu_processor_pop ; drop exit line. | |
215 call menu_processor_pop ; back to last gas. | |
216 | |
217 do_divemode_menu: | |
218 MENU_BEGIN tDiveModeMenu, .7 | |
219 MENU_OPTION tDvMode, oDiveMode, 0 | |
220 MENU_OPTION tDkMode, oDecoMode, 0 | |
221 MENU_DYNAMIC divesets_ppo2_max, do_toggle_ppo2_max | |
222 MENU_DYNAMIC divesets_ppo2_min, do_toggle_ppo2_min | |
223 MENU_OPTION tFTTSMenu, oExtraTime,0 | |
224 MENU_CALL tDecoparameters, do_decoparameters_menu | |
225 MENU_CALL tExit, do_continue_main_menu | |
226 MENU_END | |
227 | |
228 do_return_decoparameters_menu: | |
229 call menu_processor_pop ; drop exit line. | |
230 call menu_processor_pop ; back to setting | |
231 do_decoparameters_menu: | |
232 MENU_BEGIN tDecoparameters, .7 | |
233 MENU_OPTION tGF_low, oGF_low, 0 | |
234 MENU_OPTION tGF_high, oGF_high, 0 | |
235 MENU_CALL taGFMenu, do_aGF_menu | |
236 MENU_OPTION tSaturationMult,osatmult, 0 | |
237 MENU_OPTION tDesaturationMult,odesatmult,0 | |
238 MENU_OPTION tLastDecostop,oLastDeco, 0 | |
239 MENU_CALL tExit, do_return_divemode_menu | |
240 MENU_END | |
241 | |
242 do_aGF_menu: | |
243 MENU_BEGIN taGFMenu, .4 | |
244 MENU_OPTION taGF_enable,oEnable_aGF, 0 | |
245 MENU_OPTION taGF_low, oaGF_low, 0 | |
246 MENU_OPTION taGF_high, oaGF_high, 0 | |
247 MENU_CALL tExit, do_return_decoparameters_menu | |
248 MENU_END | |
249 ;============================================================================= | |
250 ; Setup Menu | |
251 | |
252 do_return_settings: | |
253 bcf settime_setdate ; Clear flag | |
254 call menu_processor_pop ; Drop exit entry | |
255 call menu_processor_pop ; Pop return line. | |
256 | |
257 extern compass_calibration_loop | |
258 do_settings_menu: | |
259 MENU_BEGIN tSystSets, .7 | |
260 MENU_CALL tInfoMenu, do_info_menu | |
261 MENU_CALL tSetTimeDate, do_date_time_menu | |
262 MENU_CALL tDispSets, do_dispsets_menu | |
263 MENU_OPTION tLanguage, oLanguage, 0 | |
18
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
264 MENU_CALL tCompassMenu, do_compass_menu |
0 | 265 MENU_CALL tResetMenu, do_reset_menu |
266 MENU_CALL tExit, do_continue_main_menu | |
267 MENU_END | |
268 | |
18
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
269 do_compass_menu: |
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
270 MENU_BEGIN tSystSets, .3 |
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
271 MENU_CALL tCompassMenu, compass_calibration_loop |
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
272 MENU_OPTION tCompassGain, oCompassGain, 0 |
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
273 MENU_CALL tExit, do_return_settings |
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
274 MENU_END |
4e3f133dfbf4
add new opt_compass_gain option to work with more magnetic battery types
heinrichsweikamp
parents:
0
diff
changeset
|
275 |
0 | 276 ;============================================================================= |
277 ; Reset and confirmation menu. | |
278 | |
279 do_reset_menu: | |
63 | 280 MENU_BEGIN tResetMenu, .6 |
0 | 281 MENU_CALL tExit, do_return_settings |
282 MENU_CALL tReboot, do_reset_menu2 ; Confirm | |
283 MENU_CALL tResetDeco, do_reset_menu3 ; Confirm | |
284 MENU_CALL tResetSettings, do_reset_menu4 ; Confirm | |
63 | 285 MENU_CALL tResetLogbook, do_reset_menu5 ; Confirm |
0 | 286 MENU_CALL tResetBattery, new_battery_menu ; New Battery submenu |
287 MENU_END | |
288 | |
289 do_reset_menu2: | |
290 MENU_BEGIN tResetMenu2, .2 | |
291 MENU_CALL tAbort, do_continue_menu_3stack | |
292 MENU_CALL tReboot, do_reboot ; Reboot | |
293 MENU_END | |
294 | |
295 do_reset_menu3: | |
296 MENU_BEGIN tResetMenu2, .2 | |
297 MENU_CALL tAbort, do_continue_menu_3stack | |
298 MENU_CALL tResetDeco, do_reset_deco ; Reset Deco | |
299 MENU_END | |
300 | |
301 do_reset_menu4: | |
302 MENU_BEGIN tResetMenu2, .2 | |
303 MENU_CALL tAbort, do_continue_menu_3stack | |
304 MENU_CALL tResetSettings, do_reset_settings ; Reset all settings | |
305 MENU_END | |
306 | |
63 | 307 do_reset_menu5: |
308 MENU_BEGIN tResetMenu2, .2 | |
309 MENU_CALL tAbort, do_continue_menu_3stack | |
310 MENU_CALL tResetLogbook, do_reset_logbook ; Reset logbook | |
311 MENU_END | |
312 | |
313 do_reset_logbook: | |
314 clrf EEADRH ; Make sure to select eeprom bank 0 | |
315 clrf EEDATA | |
316 write_int_eeprom .4 | |
317 write_int_eeprom .5 | |
318 write_int_eeprom .6 ; Reset logbook pointers | |
319 call ext_flash_erase_logbook ; And complete logbook (!) | |
320 goto do_continue_main_menu ; back to menu | |
321 | |
0 | 322 |
323 do_reset_deco: | |
324 movlw d'79' ; 79% N2 | |
325 movff WREG,char_I_N2_ratio | |
326 movlw d'0' | |
327 movff WREG,char_I_step_is_1min ; 2 second deco mode | |
328 SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; copy for deco routine | |
329 movff int_I_pres_respiration+0,int_I_pres_surface+0 ; copy for desat routine | |
330 movff int_I_pres_respiration+1,int_I_pres_surface+1 | |
331 | |
332 extern deco_reset | |
333 call deco_reset | |
334 call deco_calc_desaturation_time ; calculate desaturation time | |
335 banksel common | |
336 call deco_calc_wo_deco_step_1_min ; calculate deco in surface mode | |
337 banksel common | |
338 clrf nofly_time+0 ; Reset NoFly | |
339 clrf nofly_time+1 | |
340 clrf desaturation_time+0 ; Reset Desat | |
341 clrf desaturation_time+1 | |
342 goto do_return_settings ; back to menu | |
343 | |
344 do_reset_settings: | |
345 extern option_reset_all | |
346 call option_reset_all ; Reset all options to factory default. | |
347 goto do_continue_main_menu ; back to menu | |
348 | |
349 do_continue_menu_3stack: ; Return three levels deep | |
350 call menu_processor_pop | |
351 goto do_return_settings | |
352 | |
353 do_reboot: | |
354 call ext_flash_enable_protection ; Enables write protection | |
355 reset | |
356 | |
357 | |
358 do_date_time_menu: | |
359 MENU_BEGIN tSetTimeDate, .4 | |
360 MENU_CALL tSetTime, do_time_menu | |
361 MENU_CALL tSetDate, do_date_menu | |
362 MENU_OPTION tDateFormat,oDateFormat, 0 | |
363 MENU_CALL tExit, do_return_settings | |
364 MENU_END | |
365 | |
366 do_date_menu: | |
367 bsf settime_setdate | |
368 MENU_BEGIN tSetDate, .4 | |
369 MENU_OPTION tSetDay, oSetDay, 0 | |
50 | 370 MENU_OPTION tSetMonth, oSetMonth, 0 |
0 | 371 MENU_OPTION tSetYear, oSetYear, 0 |
372 MENU_CALL tExit, do_continue_menu_3stack | |
373 MENU_END | |
374 | |
375 | |
376 do_reset_seconds: | |
377 clrf secs | |
378 extern rtc_set_rtc | |
379 call rtc_set_rtc ; writes mins,sec,hours,day,month and year to rtc module | |
380 do_time_menu: | |
381 bsf settime_setdate | |
382 MENU_BEGIN tSetTime, .4 | |
383 MENU_OPTION tSetHours, oSetHours, 0 | |
384 MENU_OPTION tSetMinutes,oSetMinutes, 0 | |
385 MENU_CALL tSetSeconds, do_reset_seconds | |
386 MENU_CALL tExit, do_continue_menu_3stack | |
387 MENU_END | |
388 | |
389 | |
390 do_toggle_ppo2_max: ; add 0.1bar, with hard-coded max. | |
391 movff opt_ppO2_max,lo ; banksafe | |
392 movlw .10 | |
393 addwf lo,F | |
394 movlw ppo2_highest_setting | |
395 cpfsgt lo | |
396 bra do_toggle_ppo2_max2 | |
397 movlw .120 | |
398 movwf lo | |
399 do_toggle_ppo2_max2: | |
400 movff lo,opt_ppO2_max | |
401 return | |
402 | |
403 do_toggle_ppo2_min: ; sub 0.1bar, with hard-coded min. | |
404 movff opt_ppO2_min,lo ; banksafe | |
405 incf lo,F | |
406 movlw .21 | |
407 cpfsgt lo | |
408 bra do_toggle_ppo2_min2 | |
409 movlw ppo2_lowest_setting | |
410 movwf lo | |
411 do_toggle_ppo2_min2: | |
412 movff lo,opt_ppO2_min | |
413 return | |
414 | |
415 | |
416 ; Logbook offset sub-menu | |
417 do_log_offset_menu: | |
418 MENU_BEGIN tLogOffset, .6 | |
419 MENU_DYNAMIC TFT_LogOffset_Logtitle, 0 | |
420 MENU_CALL tLogOffsetp1, do_logoffset_plus1 | |
421 MENU_CALL tLogOffsetp10, do_logoffset_plus10 | |
422 MENU_CALL tLogOffsetm1, do_logoffset_minus1 | |
423 MENU_CALL tLogOffsetm10, do_logoffset_minus10 | |
424 MENU_CALL tExit, do_dispsets_menu_3stack | |
425 MENU_END | |
426 | |
427 | |
428 do_logoffset_minus1: | |
429 call do_logoffset_common_read ; Read into lo:hi | |
430 movlw d'1' | |
431 subwf lo | |
432 movlw d'0' | |
433 subwfb hi | |
434 btfss hi,7 ; <0? | |
435 goto do_logoffset_common_write ; Store and return | |
436 clrf lo | |
437 clrf hi | |
438 goto do_logoffset_common_write ; Store and return | |
439 | |
440 do_logoffset_minus10: | |
441 call do_logoffset_common_read ; Read into lo:hi | |
442 movlw d'10' | |
443 subwf lo | |
444 movlw d'0' | |
445 subwfb hi | |
446 btfss hi,7 ; <0? | |
447 goto do_logoffset_common_write ; Store and return | |
448 clrf lo | |
449 clrf hi | |
450 goto do_logoffset_common_write ; Store and return | |
451 | |
452 do_logoffset_plus1: | |
453 call do_logoffset_common_read ; Read into lo:hi | |
454 movlw d'1' | |
455 addwf lo | |
456 movlw d'0' | |
457 addwfc hi | |
458 goto do_logoffset_common_write ; Store and return | |
459 | |
460 do_logoffset_plus10: | |
461 call do_logoffset_common_read ; Read into lo:hi | |
462 movlw d'10' | |
463 addwf lo | |
464 movlw d'0' | |
465 addwfc hi | |
466 goto do_logoffset_common_write ; Store and return | |
467 | |
468 do_dispsets_menu_3stack: | |
50 | 469 bcf in_color_menu |
0 | 470 call menu_processor_pop |
471 call menu_processor_pop | |
472 | |
473 do_dispsets_menu: | |
50 | 474 MENU_BEGIN tDispSets, .7 |
0 | 475 MENU_OPTION tBright, oBrightness, 0 |
476 MENU_OPTION tUnits, oUnits, 0 | |
477 MENU_CALL tLogOffset, do_log_offset_menu | |
23
e402813343b6
new option to switch samplingrate between 10s and 2s
heinrichsweikamp
parents:
18
diff
changeset
|
478 MENU_OPTION tSamplingrate,oSamplingRate,0 |
0 | 479 MENU_OPTION tDvSalinity,oDiveSalinity, 0 |
50 | 480 MENU_CALL tColorScheme, do_color_scheme |
0 | 481 MENU_CALL tExit, do_return_settings |
482 MENU_END | |
483 | |
50 | 484 |
485 extern oColorSetDive | |
486 do_color_scheme: | |
487 bsf in_color_menu | |
488 MENU_BEGIN tColorScheme, .2 | |
489 MENU_OPTION tColorSetDive,oColorSetDive, 0 | |
490 MENU_CALL tExit, do_dispsets_menu_3stack | |
491 MENU_END | |
492 | |
493 | |
0 | 494 ;============================================================================= |
495 | |
496 global new_battery_menu | |
497 new_battery_menu: | |
498 bsf enable_screen_dumps ; To prevent exiting into COMM mode immediately | |
499 call TFT_boot ; Initialize TFT (includes clear screen) | |
500 call TFT_Display_FadeIn ; Show splash | |
501 movlw .100 | |
502 movwf batt_percent ; make sure to reset batt_percent | |
503 | |
504 ; Default (In cases of timeout or USB): Use old battery | |
505 clrf EEADRH | |
506 read_int_eeprom 0x07 | |
507 movff EEDATA,battery_gauge+0 | |
508 read_int_eeprom 0x08 | |
509 movff EEDATA,battery_gauge+1 | |
510 read_int_eeprom 0x09 | |
511 movff EEDATA,battery_gauge+2 | |
512 read_int_eeprom 0x0A | |
513 movff EEDATA,battery_gauge+3 | |
514 read_int_eeprom 0x0B | |
515 movff EEDATA,battery_gauge+4 | |
516 read_int_eeprom 0x0C | |
517 movff EEDATA,battery_gauge+5 | |
518 | |
519 MENU_BEGIN tNewBattTitle, .3 | |
520 MENU_CALL tNewBattOld, use_old_batteries | |
521 MENU_CALL tNewBattNew36, use_new_36V_batteries | |
522 MENU_CALL tNewBattNew15, use_new_15V_batteries | |
523 MENU_END | |
524 | |
525 global use_old_batteries | |
526 use_old_batteries: | |
527 clrf EEADRH | |
528 read_int_eeprom 0x07 | |
529 movff EEDATA,battery_gauge+0 | |
530 read_int_eeprom 0x08 | |
531 movff EEDATA,battery_gauge+1 | |
532 read_int_eeprom 0x09 | |
533 movff EEDATA,battery_gauge+2 | |
534 read_int_eeprom 0x0A | |
535 movff EEDATA,battery_gauge+3 | |
536 read_int_eeprom 0x0B | |
537 movff EEDATA,battery_gauge+4 | |
538 read_int_eeprom 0x0C | |
539 movff EEDATA,battery_gauge+5 | |
540 movlw .100 | |
541 movwf batt_percent ; To have 1,5V batteries right after firmware update | |
542 goto power_on_return | |
543 | |
544 use_new_15V_batteries: | |
545 use_new_36V_batteries: | |
546 call reset_battery_pointer ; Resets battery pointer 0x07-0x0C and battery_gauge:5 | |
547 goto power_on_return | |
548 | |
549 END |