Rev 1526 | Rev 1638 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1526 | Rev 1529 | ||
---|---|---|---|
Line 68... | Line 68... | ||
68 | // initialize capacity calculation |
68 | // initialize capacity calculation |
69 | void Capacity_Init(void) |
69 | void Capacity_Init(void) |
70 | { |
70 | { |
71 | Capacity.ActualCurrent = 0; |
71 | Capacity.ActualCurrent = 0; |
72 | Capacity.UsedCapacity = 0; |
72 | Capacity.UsedCapacity = 0; |
73 | - | ||
- | 73 | Capacity.ActualPower = 0; |
|
74 | update_timer = SetDelay(CAPACITY_UPDATE_INTERVAL); |
74 | update_timer = SetDelay(CAPACITY_UPDATE_INTERVAL); |
75 | } |
75 | } |
Line 76... | Line 76... | ||
76 | 76 | ||
Line 118... | Line 118... | ||
118 | } |
118 | } |
Line 119... | Line 119... | ||
119 | 119 | ||
120 | // update actual Current |
120 | // update actual Current |
121 | Capacity.ActualCurrent = Current; |
121 | Capacity.ActualCurrent = Current; |
- | 122 | // update actual Power |
|
122 | // update actual Power |
123 | if(Current < 255) Capacity.ActualPower = (UBat * Current) / 100; // in W higher resolution |
Line 123... | Line 124... | ||
123 | Capacity.ActualPower = (UBat * Current) / 10; // in 0.1W |
124 | else Capacity.ActualPower = (UBat * (Current/4)) / 25; // in W |
124 | 125 | ||
Line 125... | Line 126... | ||
125 | // update used capacity |
126 | // update used capacity |