Changeset 3400


Ignore:
Timestamp:
Oct 31, 2012, 12:26:46 AM (18 months ago)
Author:
rsmith
Message:

OLPC: Add tenths digit to battery temperature display

File:
1 edited

Legend:

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

    r2654 r3400  
    11: wextend  ( w -- n )  dup h# 8000 and  if  h# ffff.0000 or  then  ; 
    2 \ Base unit for temperature is 1/256 degrees C 
    3 : >degrees-c 7 rshift 1+ 2/  ;  \ Round to nearest degree  
     2\ Base unit for temperature is .125 degrees C 
     3: >milli-degrees-c 125 * 5 rshift ; 
    44: uvolt@ bat-voltage@ d# 9760 d# 32 */ ; 
    55: cur@ bat-current@ wextend  d# 15625 d# 120 */ ; 
    6 : pcb-temp ambient-temp@ >degrees-c  ; 
    7 : bat-temp bat-temp@ >degrees-c  ; 
     6\ : pcb-temp ambient-temp@ >milli-degrees-c  ; 
     7: bat-temp bat-temp@ >milli-degrees-c  ; 
    88: soc     bat-soc@  ; 
    99 
     
    8080; 
    8181 
     82: .bat-temp 
     83   push-decimal 
     84   bat-temp 
     85   dup abs d# 50 + d# 100 /  <# u# [char] . hold u#s swap sign u#> type 
     86   pop-base 
     87; 
     88 
    8289: .%  ( n -- )  push-decimal  <# [char] % hold u# u#s u#>  type  pop-base  ; 
    8390: .bat  ( -- ) 
     
    94101      uvolt@  .milli  ." V " 
    95102      cur@  .milli  ." A " 
    96       bat-temp 2.d ." C " 
     103      .bat-temp ." C " 
    97104      dup 2 and  if  ." full "  then 
    98105      dup 4 and  if  ." low "  then 
Note: See TracChangeset for help on using the changeset viewer.