Mercurial > public > hwos_code
annotate src/menu_tree.asm @ 62:e7c7c7eeea58
show battery voltage in info menu
author | heinrichsweikamp |
---|---|
date | Fri, 10 Jan 2014 10:11:43 +0100 |
parents | ec4d8503ec45 |
children | 40a5cc0664ed |
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: | |
280 MENU_BEGIN tResetMenu, .5 | |
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 | |
285 MENU_CALL tResetBattery, new_battery_menu ; New Battery submenu | |
286 MENU_END | |
287 | |
288 do_reset_menu2: | |
289 MENU_BEGIN tResetMenu2, .2 | |
290 MENU_CALL tAbort, do_continue_menu_3stack | |
291 MENU_CALL tReboot, do_reboot ; Reboot | |
292 MENU_END | |
293 | |
294 do_reset_menu3: | |
295 MENU_BEGIN tResetMenu2, .2 | |
296 MENU_CALL tAbort, do_continue_menu_3stack | |
297 MENU_CALL tResetDeco, do_reset_deco ; Reset Deco | |
298 MENU_END | |
299 | |
300 do_reset_menu4: | |
301 MENU_BEGIN tResetMenu2, .2 | |
302 MENU_CALL tAbort, do_continue_menu_3stack | |
303 MENU_CALL tResetSettings, do_reset_settings ; Reset all settings | |
304 MENU_END | |
305 | |
306 | |
307 do_reset_deco: | |
308 movlw d'79' ; 79% N2 | |
309 movff WREG,char_I_N2_ratio | |
310 movlw d'0' | |
311 movff WREG,char_I_step_is_1min ; 2 second deco mode | |
312 SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; copy for deco routine | |
313 movff int_I_pres_respiration+0,int_I_pres_surface+0 ; copy for desat routine | |
314 movff int_I_pres_respiration+1,int_I_pres_surface+1 | |
315 | |
316 extern deco_reset | |
317 call deco_reset | |
318 call deco_calc_desaturation_time ; calculate desaturation time | |
319 banksel common | |
320 call deco_calc_wo_deco_step_1_min ; calculate deco in surface mode | |
321 banksel common | |
322 clrf nofly_time+0 ; Reset NoFly | |
323 clrf nofly_time+1 | |
324 clrf desaturation_time+0 ; Reset Desat | |
325 clrf desaturation_time+1 | |
326 goto do_return_settings ; back to menu | |
327 | |
328 do_reset_settings: | |
329 extern option_reset_all | |
330 call option_reset_all ; Reset all options to factory default. | |
331 goto do_continue_main_menu ; back to menu | |
332 | |
333 do_continue_menu_3stack: ; Return three levels deep | |
334 call menu_processor_pop | |
335 goto do_return_settings | |
336 | |
337 do_reboot: | |
338 call ext_flash_enable_protection ; Enables write protection | |
339 reset | |
340 | |
341 | |
342 do_date_time_menu: | |
343 MENU_BEGIN tSetTimeDate, .4 | |
344 MENU_CALL tSetTime, do_time_menu | |
345 MENU_CALL tSetDate, do_date_menu | |
346 MENU_OPTION tDateFormat,oDateFormat, 0 | |
347 MENU_CALL tExit, do_return_settings | |
348 MENU_END | |
349 | |
350 do_date_menu: | |
351 bsf settime_setdate | |
352 MENU_BEGIN tSetDate, .4 | |
353 MENU_OPTION tSetDay, oSetDay, 0 | |
50 | 354 MENU_OPTION tSetMonth, oSetMonth, 0 |
0 | 355 MENU_OPTION tSetYear, oSetYear, 0 |
356 MENU_CALL tExit, do_continue_menu_3stack | |
357 MENU_END | |
358 | |
359 | |
360 do_reset_seconds: | |
361 clrf secs | |
362 extern rtc_set_rtc | |
363 call rtc_set_rtc ; writes mins,sec,hours,day,month and year to rtc module | |
364 do_time_menu: | |
365 bsf settime_setdate | |
366 MENU_BEGIN tSetTime, .4 | |
367 MENU_OPTION tSetHours, oSetHours, 0 | |
368 MENU_OPTION tSetMinutes,oSetMinutes, 0 | |
369 MENU_CALL tSetSeconds, do_reset_seconds | |
370 MENU_CALL tExit, do_continue_menu_3stack | |
371 MENU_END | |
372 | |
373 | |
374 do_toggle_ppo2_max: ; add 0.1bar, with hard-coded max. | |
375 movff opt_ppO2_max,lo ; banksafe | |
376 movlw .10 | |
377 addwf lo,F | |
378 movlw ppo2_highest_setting | |
379 cpfsgt lo | |
380 bra do_toggle_ppo2_max2 | |
381 movlw .120 | |
382 movwf lo | |
383 do_toggle_ppo2_max2: | |
384 movff lo,opt_ppO2_max | |
385 return | |
386 | |
387 do_toggle_ppo2_min: ; sub 0.1bar, with hard-coded min. | |
388 movff opt_ppO2_min,lo ; banksafe | |
389 incf lo,F | |
390 movlw .21 | |
391 cpfsgt lo | |
392 bra do_toggle_ppo2_min2 | |
393 movlw ppo2_lowest_setting | |
394 movwf lo | |
395 do_toggle_ppo2_min2: | |
396 movff lo,opt_ppO2_min | |
397 return | |
398 | |
399 | |
400 ; Logbook offset sub-menu | |
401 do_log_offset_menu: | |
402 MENU_BEGIN tLogOffset, .6 | |
403 MENU_DYNAMIC TFT_LogOffset_Logtitle, 0 | |
404 MENU_CALL tLogOffsetp1, do_logoffset_plus1 | |
405 MENU_CALL tLogOffsetp10, do_logoffset_plus10 | |
406 MENU_CALL tLogOffsetm1, do_logoffset_minus1 | |
407 MENU_CALL tLogOffsetm10, do_logoffset_minus10 | |
408 MENU_CALL tExit, do_dispsets_menu_3stack | |
409 MENU_END | |
410 | |
411 | |
412 do_logoffset_minus1: | |
413 call do_logoffset_common_read ; Read into lo:hi | |
414 movlw d'1' | |
415 subwf lo | |
416 movlw d'0' | |
417 subwfb hi | |
418 btfss hi,7 ; <0? | |
419 goto do_logoffset_common_write ; Store and return | |
420 clrf lo | |
421 clrf hi | |
422 goto do_logoffset_common_write ; Store and return | |
423 | |
424 do_logoffset_minus10: | |
425 call do_logoffset_common_read ; Read into lo:hi | |
426 movlw d'10' | |
427 subwf lo | |
428 movlw d'0' | |
429 subwfb hi | |
430 btfss hi,7 ; <0? | |
431 goto do_logoffset_common_write ; Store and return | |
432 clrf lo | |
433 clrf hi | |
434 goto do_logoffset_common_write ; Store and return | |
435 | |
436 do_logoffset_plus1: | |
437 call do_logoffset_common_read ; Read into lo:hi | |
438 movlw d'1' | |
439 addwf lo | |
440 movlw d'0' | |
441 addwfc hi | |
442 goto do_logoffset_common_write ; Store and return | |
443 | |
444 do_logoffset_plus10: | |
445 call do_logoffset_common_read ; Read into lo:hi | |
446 movlw d'10' | |
447 addwf lo | |
448 movlw d'0' | |
449 addwfc hi | |
450 goto do_logoffset_common_write ; Store and return | |
451 | |
452 do_dispsets_menu_3stack: | |
50 | 453 bcf in_color_menu |
0 | 454 call menu_processor_pop |
455 call menu_processor_pop | |
456 | |
457 do_dispsets_menu: | |
50 | 458 MENU_BEGIN tDispSets, .7 |
0 | 459 MENU_OPTION tBright, oBrightness, 0 |
460 MENU_OPTION tUnits, oUnits, 0 | |
461 MENU_CALL tLogOffset, do_log_offset_menu | |
23
e402813343b6
new option to switch samplingrate between 10s and 2s
heinrichsweikamp
parents:
18
diff
changeset
|
462 MENU_OPTION tSamplingrate,oSamplingRate,0 |
0 | 463 MENU_OPTION tDvSalinity,oDiveSalinity, 0 |
50 | 464 MENU_CALL tColorScheme, do_color_scheme |
0 | 465 MENU_CALL tExit, do_return_settings |
466 MENU_END | |
467 | |
50 | 468 |
469 extern oColorSetDive | |
470 do_color_scheme: | |
471 bsf in_color_menu | |
472 MENU_BEGIN tColorScheme, .2 | |
473 MENU_OPTION tColorSetDive,oColorSetDive, 0 | |
474 MENU_CALL tExit, do_dispsets_menu_3stack | |
475 MENU_END | |
476 | |
477 | |
0 | 478 ;============================================================================= |
479 | |
480 global new_battery_menu | |
481 new_battery_menu: | |
482 bsf enable_screen_dumps ; To prevent exiting into COMM mode immediately | |
483 call TFT_boot ; Initialize TFT (includes clear screen) | |
484 call TFT_Display_FadeIn ; Show splash | |
485 movlw .100 | |
486 movwf batt_percent ; make sure to reset batt_percent | |
487 | |
488 ; Default (In cases of timeout or USB): Use old battery | |
489 clrf EEADRH | |
490 read_int_eeprom 0x07 | |
491 movff EEDATA,battery_gauge+0 | |
492 read_int_eeprom 0x08 | |
493 movff EEDATA,battery_gauge+1 | |
494 read_int_eeprom 0x09 | |
495 movff EEDATA,battery_gauge+2 | |
496 read_int_eeprom 0x0A | |
497 movff EEDATA,battery_gauge+3 | |
498 read_int_eeprom 0x0B | |
499 movff EEDATA,battery_gauge+4 | |
500 read_int_eeprom 0x0C | |
501 movff EEDATA,battery_gauge+5 | |
502 | |
503 MENU_BEGIN tNewBattTitle, .3 | |
504 MENU_CALL tNewBattOld, use_old_batteries | |
505 MENU_CALL tNewBattNew36, use_new_36V_batteries | |
506 MENU_CALL tNewBattNew15, use_new_15V_batteries | |
507 MENU_END | |
508 | |
509 global use_old_batteries | |
510 use_old_batteries: | |
511 clrf EEADRH | |
512 read_int_eeprom 0x07 | |
513 movff EEDATA,battery_gauge+0 | |
514 read_int_eeprom 0x08 | |
515 movff EEDATA,battery_gauge+1 | |
516 read_int_eeprom 0x09 | |
517 movff EEDATA,battery_gauge+2 | |
518 read_int_eeprom 0x0A | |
519 movff EEDATA,battery_gauge+3 | |
520 read_int_eeprom 0x0B | |
521 movff EEDATA,battery_gauge+4 | |
522 read_int_eeprom 0x0C | |
523 movff EEDATA,battery_gauge+5 | |
524 movlw .100 | |
525 movwf batt_percent ; To have 1,5V batteries right after firmware update | |
526 goto power_on_return | |
527 | |
528 use_new_15V_batteries: | |
529 use_new_36V_batteries: | |
530 call reset_battery_pointer ; Resets battery pointer 0x07-0x0C and battery_gauge:5 | |
531 goto power_on_return | |
532 | |
533 END |