@@ -22,7 +22,6 @@ byte bCapacityMode = 1; // unit: 0=mAh, 1=mWh, 2=%
22
22
// Physical parameters
23
23
const uint16_t iConfigVoltage = 1509 ; // centiVolt
24
24
uint16_t iVoltage =1499 ; // centiVolt
25
- uint16_t iRunTimeToEmpty = 0 , iPrevRunTimeToEmpty = 0 ;
26
25
uint16_t iManufacturerDate = 0 ; // initialized in setup function
27
26
28
27
// Parameters for ACPI compliancy
@@ -52,8 +51,6 @@ void setup() {
52
51
53
52
PowerDevice.setFeature (HID_PD_PRESENTSTATUS, &iPresentStatus, sizeof (iPresentStatus));
54
53
55
- PowerDevice.setFeature (HID_PD_RUNTIMETOEMPTY, &iRunTimeToEmpty, sizeof (iRunTimeToEmpty));
56
-
57
54
PowerDevice.setFeature (HID_PD_CAPACITYMODE, &bCapacityMode, sizeof (bCapacityMode));
58
55
PowerDevice.setFeature (HID_PD_CONFIGVOLTAGE, &iConfigVoltage, sizeof (iConfigVoltage));
59
56
PowerDevice.setFeature (HID_PD_VOLTAGE, &iVoltage, sizeof (iVoltage));
@@ -74,8 +71,6 @@ void loop() {
74
71
int iBattSoc = analogRead (BATTSOCPIN); // potensiometer value in [0,1024)
75
72
76
73
iRemaining = (uint32_t )(round ((float )iFullChargeCapacity*iBattSoc/1024 ));
77
- uint16_t iAvgTimeToEmpty = 7200 ;
78
- iRunTimeToEmpty = (uint16_t )round ((float )iAvgTimeToEmpty*iRemaining/iFullChargeCapacity);
79
74
80
75
if (iRemaining > iPrevRemaining)
81
76
bCharging = true ;
@@ -114,10 +109,9 @@ void loop() {
114
109
115
110
// ************ Bulk send or interrupt ***********************
116
111
117
- if ((iPresentStatus != iPreviousStatus) || (iRemaining != iPrevRemaining) || (iRunTimeToEmpty != iPrevRunTimeToEmpty) || ( iIntTimer>MINUPDATEINTERVAL) ) {
112
+ if ((iPresentStatus != iPreviousStatus) || (iRemaining != iPrevRemaining) || (iIntTimer>MINUPDATEINTERVAL) ) {
118
113
119
114
PowerDevice.sendReport (HID_PD_REMAININGCAPACITY, &iRemaining, sizeof (iRemaining));
120
- if (!bCharging) PowerDevice.sendReport (HID_PD_RUNTIMETOEMPTY, &iRunTimeToEmpty, sizeof (iRunTimeToEmpty));
121
115
iRes = PowerDevice.sendReport (HID_PD_PRESENTSTATUS, &iPresentStatus, sizeof (iPresentStatus));
122
116
123
117
if (iRes <0 ) {
@@ -130,12 +124,10 @@ void loop() {
130
124
iPreviousStatus = iPresentStatus;
131
125
if (abs (iPrevRemaining - iRemaining) > 1 ) // add a bit of hysteresis
132
126
iPrevRemaining = iRemaining;
133
- iPrevRunTimeToEmpty = iRunTimeToEmpty;
134
127
}
135
128
136
129
137
130
Serial.println (iRemaining);
138
- Serial.println (iRunTimeToEmpty);
139
131
Serial.println (iRes);
140
132
141
133
}
0 commit comments