Changeset 2179


Ignore:
Timestamp:
Mar 12, 2011, 1:04:51 AM (4 years ago)
Author:
rsmith
Message:
  • XO 1 and 1.5: Add bat-recover tool from batman.fth
  • This makes doing bat-recover on a lot of batteries that have charge

balance a lot easier since you don't have to reload batman.fth every
reboot.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dev/olpc/kb3700/battery.fth

    r2063 r2179  
    671671   ec-debugflag4 bat-b@
    672672   h# 10 invert and ec-debugflag4 bat-b!
     673;
     674
     675: bat-recover-info@ ( -- voltage ACR current temp )
     676   ds-bank-buf 6 h# 0c 1w-read                  ( )
     677   ds-bank-buf c@ 8 <<                          ( voltage_msb )
     678   ds-bank-buf 1 + c@ or d# 16 << d# 16 >>a     ( voltage )
     679   ds-bank-buf 4 + c@ 8 <<                      ( voltage ACR_msb )
     680   ds-bank-buf 5 + c@ or d# 16 << d# 16 >>a     ( voltage ACR )
     681   ds-bank-buf 4 h# 18 1w-read                  ( voltage ACR )
     682   ds-bank-buf 2 + c@ 8 <<                      ( voltage ACR current_msb )
     683   ds-bank-buf 3 + c@ or d# 16 << d# 16 >>a     ( voltage ACR current )
     684   swap                                         ( voltage current ACR )
     685   ds-bank-buf c@ 8 <<                          ( voltage ACR current temp_msb )
     686   ds-bank-buf 1 + c@ or d# 16 << d# 16 >>a     ( voltage ACR current temp )
     687;
     688
     6894 value bon
     6902 value boff
     691
     692: bat-recover ( -- )
     693   batman-init?
     694   bg-acr@
     695   begin
     696      bat-enable-charge
     697      bon ms
     698      bat-disable-charge
     699      bat-recover-info@
     700      bg-temp>degc >sd.dd type ."  C "
     701      to bg-last-acr
     702      bg-I>mA >sd.dd type ."  mA "
     703      bg-v_avg + 2 / dup to bg-v_avg
     704      bg-V>V >sd.ddd type ."  V "
     705      dup bg-last-acr swap -
     706      bg-acr>mAh >sd.dd type ."  mAh "
     707      cr
     708      boff ms
     709      false
     710   until
     711   drop
     712   bat-disable-charge
    673713;
    674714
Note: See TracChangeset for help on using the changeset viewer.