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