Skip to content

Commit ac53f35

Browse files
committed
Remove RunTimeToEmpty report to simplify.
1 parent a448444 commit ac53f35

File tree

3 files changed

+1
-15
lines changed

3 files changed

+1
-15
lines changed

examples/UPS/UPS.ino

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ byte bCapacityMode = 1; // unit: 0=mAh, 1=mWh, 2=%
2222
// Physical parameters
2323
const uint16_t iConfigVoltage = 1509; // centiVolt
2424
uint16_t iVoltage =1499; // centiVolt
25-
uint16_t iRunTimeToEmpty = 0, iPrevRunTimeToEmpty = 0;
2625
uint16_t iManufacturerDate = 0; // initialized in setup function
2726

2827
// Parameters for ACPI compliancy
@@ -52,8 +51,6 @@ void setup() {
5251

5352
PowerDevice.setFeature(HID_PD_PRESENTSTATUS, &iPresentStatus, sizeof(iPresentStatus));
5453

55-
PowerDevice.setFeature(HID_PD_RUNTIMETOEMPTY, &iRunTimeToEmpty, sizeof(iRunTimeToEmpty));
56-
5754
PowerDevice.setFeature(HID_PD_CAPACITYMODE, &bCapacityMode, sizeof(bCapacityMode));
5855
PowerDevice.setFeature(HID_PD_CONFIGVOLTAGE, &iConfigVoltage, sizeof(iConfigVoltage));
5956
PowerDevice.setFeature(HID_PD_VOLTAGE, &iVoltage, sizeof(iVoltage));
@@ -74,8 +71,6 @@ void loop() {
7471
int iBattSoc = analogRead(BATTSOCPIN); // potensiometer value in [0,1024)
7572

7673
iRemaining = (uint32_t)(round((float)iFullChargeCapacity*iBattSoc/1024));
77-
uint16_t iAvgTimeToEmpty = 7200;
78-
iRunTimeToEmpty = (uint16_t)round((float)iAvgTimeToEmpty*iRemaining/iFullChargeCapacity);
7974

8075
if (iRemaining > iPrevRemaining)
8176
bCharging = true;
@@ -114,10 +109,9 @@ void loop() {
114109

115110
//************ Bulk send or interrupt ***********************
116111

117-
if((iPresentStatus != iPreviousStatus) || (iRemaining != iPrevRemaining) || (iRunTimeToEmpty != iPrevRunTimeToEmpty) || (iIntTimer>MINUPDATEINTERVAL) ) {
112+
if((iPresentStatus != iPreviousStatus) || (iRemaining != iPrevRemaining) || (iIntTimer>MINUPDATEINTERVAL) ) {
118113

119114
PowerDevice.sendReport(HID_PD_REMAININGCAPACITY, &iRemaining, sizeof(iRemaining));
120-
if(!bCharging) PowerDevice.sendReport(HID_PD_RUNTIMETOEMPTY, &iRunTimeToEmpty, sizeof(iRunTimeToEmpty));
121115
iRes = PowerDevice.sendReport(HID_PD_PRESENTSTATUS, &iPresentStatus, sizeof(iPresentStatus));
122116

123117
if(iRes <0 ) {
@@ -130,12 +124,10 @@ void loop() {
130124
iPreviousStatus = iPresentStatus;
131125
if (abs(iPrevRemaining - iRemaining) > 1) // add a bit of hysteresis
132126
iPrevRemaining = iRemaining;
133-
iPrevRunTimeToEmpty = iRunTimeToEmpty;
134127
}
135128

136129

137130
Serial.println(iRemaining);
138-
Serial.println(iRunTimeToEmpty);
139131
Serial.println(iRes);
140132

141133
}

src/HIDPowerDevice.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ static const uint8_t _hidReportDescriptor[] PROGMEM = {
7777
0x75, 0x10, // REPORT_SIZE (16)
7878
0x27, 0xFF, 0xFF, 0x00, 0x00, // LOGICAL_MAXIMUM (65534)
7979
0xB1, 0xA3, // FEATURE (Constant, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Volatile, Bitfield)
80-
0x85, HID_PD_RUNTIMETOEMPTY, // REPORT_ID (13)
81-
0x09, 0x68, // USAGE (RunTimeToEmpty)
82-
0x81, 0xA3, // INPUT (Constant, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Bitfield)
83-
0x09, 0x68, // USAGE (RunTimeToEmpty)
84-
0xB1, 0xA3, // FEATURE (Constant, Variable, Absolute, No Wrap, Linear, No Preferred, No Null Position, Volatile, Bitfield)
8580
0x05, 0x84, // USAGE_PAGE (Power Device) ====================
8681
0x85, HID_PD_CONFIGVOLTAGE, // REPORT_ID (10)
8782
0x09, 0x40, // USAGE (ConfigVoltage)

src/HIDPowerDevice.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
#define HID_PD_CONFIGVOLTAGE 0x0A // 10 FEATURE ONLY
5050
#define HID_PD_VOLTAGE 0x0B // 11 INPUT (NA) OR FEATURE(implemented)
5151
#define HID_PD_REMAININGCAPACITY 0x0C // 12 INPUT OR FEATURE(required by Windows)
52-
#define HID_PD_RUNTIMETOEMPTY 0x0D
5352
#define HID_PD_FULLCHRGECAPACITY 0x0E // 14 FEATURE ONLY. Last Full Charge Capacity
5453
#define HID_PD_CURRENT 0x15 // 21 FEATURE ONLY
5554
#define HID_PD_CAPACITYMODE 0x16

0 commit comments

Comments
 (0)