Mercurial > public > hwos_code
comparison src/menu_tree.asm @ 457:b4417044a042
recover old battery status prior 2.09
| author | heinrichsweikamp |
|---|---|
| date | Wed, 28 Sep 2016 11:16:31 +0200 |
| parents | b4f28ab23b87 |
| children | 0491a84fd0b8 |
comparison
equal
deleted
inserted
replaced
| 456:e56c45ec309a | 457:b4417044a042 |
|---|---|
| 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 | 27 |
| 27 CBLOCK tmp+0x40 ; Keep space for menu processor | 28 CBLOCK tmp+0x40 ; Keep space for menu processor |
| 28 gaslist_gas ; Check ram position in gaslist.asm, too! | 29 gaslist_gas ; Check ram position in gaslist.asm, too! |
| 29 ENDC | 30 ENDC |
| 30 | 31 |
| 682 MENU_CALL tNewBattNew15, use_new_15V_batteries | 683 MENU_CALL tNewBattNew15, use_new_15V_batteries |
| 683 MENU_CALL tNewBattAccu, use_36V_rechargeable | 684 MENU_CALL tNewBattAccu, use_36V_rechargeable |
| 684 MENU_CALL tNew18650, use_18650_battery | 685 MENU_CALL tNew18650, use_18650_battery |
| 685 MENU_END | 686 MENU_END |
| 686 | 687 |
| 688 global use_old_prior_209 | |
| 689 use_old_prior_209: | |
| 690 clrf EEADRH | |
| 691 read_int_eeprom 0x0F ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah | |
| 692 tstfsz EEDATA ; Was 0x00? | |
| 693 return ; Yes, return | |
| 694 incfsz EEDATA,F ; Was 0xFF? | |
| 695 return | |
| 696 | |
| 697 call lt2942_get_status ; Check for gauge IC | |
| 698 movlw .3 ; Assume a 18650 | |
| 699 btfss battery_gauge_available ; cR/2 hardware? | |
| 700 movlw .1 ; Assume a Saft | |
| 701 movwf EEDATA | |
| 702 write_int_eeprom 0x0F ; Store the new battery type into EEPROM | |
| 703 return | |
| 704 | |
| 687 global use_old_batteries | 705 global use_old_batteries |
| 688 use_old_batteries: | 706 use_old_batteries: |
| 689 clrf EEADRH | 707 clrf EEADRH |
| 690 read_int_eeprom 0x07 | 708 read_int_eeprom 0x07 |
| 691 movff EEDATA,battery_gauge+0 | 709 movff EEDATA,battery_gauge+0 |
