mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Don't return battery level in percentage
This commit is contained in:
parent
219bd50c30
commit
7e8564867a
2 changed files with 2 additions and 5 deletions
|
@ -439,10 +439,7 @@ ControllerStatus Breakdown
|
||||||
ControllerStatus[controller] & 0x8000 // 0
|
ControllerStatus[controller] & 0x8000 // 0
|
||||||
*/
|
*/
|
||||||
uint8_t XBOXRECV::getBatteryLevel(uint8_t controller) {
|
uint8_t XBOXRECV::getBatteryLevel(uint8_t controller) {
|
||||||
uint8_t batteryLevel = ((controllerStatus[controller] & 0x00C0) >> 6) * 33;
|
return ((controllerStatus[controller] & 0x00C0) >> 6);
|
||||||
if (batteryLevel == 99)
|
|
||||||
batteryLevel = 100;
|
|
||||||
return batteryLevel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XBOXRECV::XboxCommand(uint8_t controller, uint8_t* data, uint16_t nbytes) {
|
void XBOXRECV::XboxCommand(uint8_t controller, uint8_t* data, uint16_t nbytes) {
|
||||||
|
|
|
@ -191,7 +191,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Used to get the battery level from the controller.
|
* Used to get the battery level from the controller.
|
||||||
* @param controller The controller to read from.
|
* @param controller The controller to read from.
|
||||||
* @return Returns the battery level in percentage in 33% steps.
|
* @return Returns the battery level as an integer in the range of 0-3.
|
||||||
*/
|
*/
|
||||||
uint8_t getBatteryLevel(uint8_t controller);
|
uint8_t getBatteryLevel(uint8_t controller);
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue