Skip to content

Commit 7a35a86

Browse files
authored
Fix compiler binary number formatting warnings
1 parent 62e8597 commit 7a35a86

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

BleGamepad.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -1927,18 +1927,18 @@ void BleGamepad::setMotionControls(int16_t gX, int16_t gY, int16_t gZ, int16_t a
19271927

19281928
void BleGamepad::setPowerStateAll(uint8_t batteryPowerInformation, uint8_t dischargingState, uint8_t chargingState, uint8_t powerLevel)
19291929
{
1930-
uint8_t powerStateBits = B00000000;
1930+
uint8_t powerStateBits = 0b00000000;
19311931

19321932
_batteryPowerInformation = batteryPowerInformation;
19331933
_dischargingState = dischargingState;
19341934
_chargingState = chargingState;
19351935
_powerLevel = powerLevel;
19361936

19371937
// HID Battery Power State Bits:
1938-
// Bits 0 and 1: Battery Power Information : 0(B00) = Unknown, 1(B01) = Not Supported, 2(B10) = Not Present, 3(B11) = Present
1939-
// Bits 2 and 3: Discharging State : 0(B00) = Unknown, 1(B01) = Not Supported, 2(B10) = Not Discharging, 3(B11) = Discharging
1940-
// Bits 4 and 5: Charging State : 0(B00) = Unknown, 1(B01) = Not Chargeable, 2(B10) = Not Charging (Chargeable), 3(B11) = Charging (Chargeable)
1941-
// Bits 6 and 7: Power Level : 0(B00) = Unknown, 1(B01) = Not Supported, 2(B10) = Good Level, 3(B11) = Critically Low Level
1938+
// Bits 0 and 1: Battery Power Information : 0(0b00) = Unknown, 1(0b01) = Not Supported, 2(0b10) = Not Present, 3(0b11) = Present
1939+
// Bits 2 and 3: Discharging State : 0(0b00) = Unknown, 1(0b01) = Not Supported, 2(0b10) = Not Discharging, 3(0b11) = Discharging
1940+
// Bits 4 and 5: Charging State : 0(0b00) = Unknown, 1(0b01) = Not Chargeable, 2(0b10) = Not Charging (Chargeable), 3(0b11) = Charging (Chargeable)
1941+
// Bits 6 and 7: Power Level : 0(0b00) = Unknown, 1(0b01) = Not Supported, 2(0b10) = Good Level, 3(0b11) = Critically Low Level
19421942

19431943
powerStateBits |= (_batteryPowerInformation << 0); // Populate first 2 bits with data
19441944
powerStateBits |= (_dischargingState << 2); // Populate second 2 bits with data
@@ -2039,7 +2039,7 @@ void BleGamepad::taskServer(void *pvParameter)
20392039
NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::NOTIFY
20402040
);
20412041
BleGamepadInstance->pCharacteristic_Power_State = pCharacteristic_Power_State; // Assign the created characteristic
2042-
BleGamepadInstance->pCharacteristic_Power_State->setValue(B00000000); // Now it's safe to call setValue <- Set all to unknown by default
2042+
BleGamepadInstance->pCharacteristic_Power_State->setValue(0b00000000); // Now it's safe to call setValue <- Set all to unknown by default
20432043

20442044
BleGamepadInstance->hid->setPnp(0x01, vid, pid, guidVersion);
20452045
BleGamepadInstance->hid->setHidInfo(0x00, 0x01);

BleGamepadConfiguration.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -199,16 +199,16 @@
199199
#define VOLUME_DEC_BUTTON 6
200200
#define VOLUME_MUTE_BUTTON 7
201201

202-
#define POWER_STATE_UNKNOWN 0 // B00
203-
#define POWER_STATE_NOT_SUPPORTED 1 // B01
204-
#define POWER_STATE_NOT_PRESENT 2 // B10
205-
#define POWER_STATE_NOT_DISCHARGING 2 // B10
206-
#define POWER_STATE_NOT_CHARGING 2 // B10
207-
#define POWER_STATE_GOOD 2 // B10
208-
#define POWER_STATE_PRESENT 3 // B11
209-
#define POWER_STATE_DISCHARGING 3 // B11
210-
#define POWER_STATE_CHARGING 3 // B11
211-
#define POWER_STATE_CRITICAL 3 // B11
202+
#define POWER_STATE_UNKNOWN 0 // 0b00
203+
#define POWER_STATE_NOT_SUPPORTED 1 // 0b01
204+
#define POWER_STATE_NOT_PRESENT 2 // 0b10
205+
#define POWER_STATE_NOT_DISCHARGING 2 // 0b10
206+
#define POWER_STATE_NOT_CHARGING 2 // 0b10
207+
#define POWER_STATE_GOOD 2 // 0b10
208+
#define POWER_STATE_PRESENT 3 // 0b11
209+
#define POWER_STATE_DISCHARGING 3 // 0b11
210+
#define POWER_STATE_CHARGING 3 // 0b11
211+
#define POWER_STATE_CRITICAL 3 // 0b11
212212

213213
class BleGamepadConfiguration
214214
{

examples/SetBatteryPowerState/SetBatteryPowerState.ino

+10-10
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
1414
You can use the definitions as shown below, or direct values
1515
16-
#define POWER_STATE_UNKNOWN 0 // B00
17-
#define POWER_STATE_NOT_SUPPORTED 1 // B01
18-
#define POWER_STATE_NOT_PRESENT 2 // B10
19-
#define POWER_STATE_NOT_DISCHARGING 2 // B10
20-
#define POWER_STATE_NOT_CHARGING 2 // B10
21-
#define POWER_STATE_GOOD 2 // B10
22-
#define POWER_STATE_PRESENT 3 // B11
23-
#define POWER_STATE_DISCHARGING 3 // B11
24-
#define POWER_STATE_CHARGING 3 // B11
25-
#define POWER_STATE_CRITICAL 3 // B11
16+
#define POWER_STATE_UNKNOWN 0 // 0b00
17+
#define POWER_STATE_NOT_SUPPORTED 1 // 0b01
18+
#define POWER_STATE_NOT_PRESENT 2 // 0b10
19+
#define POWER_STATE_NOT_DISCHARGING 2 // 0b10
20+
#define POWER_STATE_NOT_CHARGING 2 // 0b10
21+
#define POWER_STATE_GOOD 2 // 0b10
22+
#define POWER_STATE_PRESENT 3 // 0b11
23+
#define POWER_STATE_DISCHARGING 3 // 0b11
24+
#define POWER_STATE_CHARGING 3 // 0b11
25+
#define POWER_STATE_CRITICAL 3 // 0b11
2626
2727
*/
2828

0 commit comments

Comments
 (0)