Skip to content

Commit cee369f

Browse files
committed
Cleanup ARM-gcc compiler warnings.
1 parent bbed8d1 commit cee369f

File tree

7 files changed

+17
-22
lines changed

7 files changed

+17
-22
lines changed

src/HIDTypes.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,8 @@
4545
/* of data as per HID Class standard */
4646

4747
/* Main items */
48-
#ifdef ARDUINO_ARCH_ESP32
49-
#define HIDINPUT(size) (0x80 | size)
50-
#define HIDOUTPUT(size) (0x90 | size)
51-
#else
52-
#define INPUT(size) (0x80 | size)
53-
#define OUTPUT(size) (0x90 | size)
54-
#endif
48+
#define HIDINPUT(size) (0x80 | size)
49+
#define HIDOUTPUT(size) (0x90 | size)
5550
#define FEATURE(size) (0xb0 | size)
5651
#define COLLECTION(size) (0xa0 | size)
5752
#define END_COLLECTION(size) (0xc0 | size)

src/NimBLEClient.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ void NimBLEClient::updateConnParams(uint16_t minInterval, uint16_t maxInterval,
465465
*/
466466
void NimBLEClient::setDataLen(uint16_t tx_octets) {
467467
#if defined(CONFIG_NIMBLE_CPP_IDF) && defined(ESP_IDF_VERSION) && \
468-
ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(4,3,2)
468+
ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 3 && ESP_IDF_VERSION_PATCH >= 2
469469
return;
470470
#else
471471
uint16_t tx_time = (tx_octets + 14) * 8;
@@ -1084,7 +1084,7 @@ uint16_t NimBLEClient::getMTU() {
10841084
NIMBLE_LOGD(LOG_TAG, "ble_sm_inject_io result: %d", rc);
10851085

10861086
} else if (event->passkey.params.action == BLE_SM_IOACT_NUMCMP) {
1087-
NIMBLE_LOGD(LOG_TAG, "Passkey on device's display: %d", event->passkey.params.numcmp);
1087+
NIMBLE_LOGD(LOG_TAG, "Passkey on device's display: %" PRIu32, event->passkey.params.numcmp);
10881088
pkey.action = event->passkey.params.action;
10891089
// Compatibility only - Do not use, should be removed the in future
10901090
if(NimBLEDevice::m_securityCallbacks != nullptr) {

src/NimBLELog.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,26 @@
5050
# endif
5151

5252
# if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 4
53-
# define NIMBLE_LOGD( tag, format, ... ) console_printf("D %s: "#format"\n",tag,##__VA_ARGS__)
53+
# define NIMBLE_LOGD( tag, format, ... ) console_printf("D %s: " format "\n", tag, ##__VA_ARGS__)
5454
# else
5555
# define NIMBLE_LOGD( tag, format, ... ) (void)tag
5656
# endif
5757

5858
# if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 3
59-
# define NIMBLE_LOGI( tag, format, ... ) console_printf("I %s: "#format"\n",tag,##__VA_ARGS__)
59+
# define NIMBLE_LOGI( tag, format, ... ) console_printf("I %s: " format "\n", tag, ##__VA_ARGS__)
6060
# else
6161
# define NIMBLE_LOGI( tag, format, ... ) (void)tag
6262
# endif
6363

6464
# if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 2
65-
# define NIMBLE_LOGW( tag, format, ... ) console_printf("W %s: "#format"\n",tag,##__VA_ARGS__)
65+
# define NIMBLE_LOGW( tag, format, ... ) console_printf("W %s: " format "\n", tag, ##__VA_ARGS__)
6666
# else
6767
# define NIMBLE_LOGW( tag, format, ... ) (void)tag
6868
# endif
6969

7070
# if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 1
71-
# define NIMBLE_LOGE( tag, format, ... ) console_printf("E %s: "#format"\n",tag,##__VA_ARGS__)
72-
# define NIMBLE_LOGC( tag, format, ... ) console_printf("CRIT %s: "#format"\n",tag,##__VA_ARGS__)
71+
# define NIMBLE_LOGE( tag, format, ... ) console_printf("E %s: " format "\n", tag, ##__VA_ARGS__)
72+
# define NIMBLE_LOGC( tag, format, ... ) console_printf("CRIT %s: " format "\n", tag, ##__VA_ARGS__)
7373
# else
7474
# define NIMBLE_LOGE( tag, format, ... ) (void)tag
7575
# define NIMBLE_LOGC( tag, format, ... ) (void)tag

src/NimBLERemoteCharacteristic.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,11 +563,11 @@ int NimBLERemoteCharacteristic::onReadCB(uint16_t conn_handle,
563563

564564
if(rc == 0) {
565565
if(attr) {
566-
uint32_t data_len = OS_MBUF_PKTLEN(attr->om);
566+
uint16_t data_len = OS_MBUF_PKTLEN(attr->om);
567567
if(((*strBuf).length() + data_len) > BLE_ATT_ATTR_MAX_LEN) {
568568
rc = BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
569569
} else {
570-
NIMBLE_LOGD(LOG_TAG, "Got %d bytes", data_len);
570+
NIMBLE_LOGD(LOG_TAG, "Got %u bytes", data_len);
571571
(*strBuf) += std::string((char*) attr->om->om_data, data_len);
572572
return 0;
573573
}

src/NimBLERemoteDescriptor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ std::string NimBLERemoteDescriptor::readValue() {
180180
}
181181
} while(rc != 0 && retryCount--);
182182

183-
NIMBLE_LOGD(LOG_TAG, "<< Descriptor readValue(): length: %d rc=%d", value.length(), rc);
183+
NIMBLE_LOGD(LOG_TAG, "<< Descriptor readValue(): length: %u rc=%d", value.length(), rc);
184184
return value;
185185
} // readValue
186186

@@ -209,11 +209,11 @@ int NimBLERemoteDescriptor::onReadCB(uint16_t conn_handle,
209209

210210
if(rc == 0) {
211211
if(attr) {
212-
uint32_t data_len = OS_MBUF_PKTLEN(attr->om);
212+
uint16_t data_len = OS_MBUF_PKTLEN(attr->om);
213213
if(((*strBuf).length() + data_len) > BLE_ATT_ATTR_MAX_LEN) {
214214
rc = BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
215215
} else {
216-
NIMBLE_LOGD(LOG_TAG, "Got %d bytes", data_len);
216+
NIMBLE_LOGD(LOG_TAG, "Got %u bytes", data_len);
217217
(*strBuf) += std::string((char*) attr->om->om_data, data_len);
218218
return 0;
219219
}

src/NimBLEScan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ bool NimBLEScan::isScanning() {
283283
* @return True if scan started or false if there was an error.
284284
*/
285285
bool NimBLEScan::start(uint32_t duration, void (*scanCompleteCB)(NimBLEScanResults), bool is_continue) {
286-
NIMBLE_LOGD(LOG_TAG, ">> start(duration=%d)", duration);
286+
NIMBLE_LOGD(LOG_TAG, ">> start: duration=%" PRIu32, duration);
287287

288288
// Save the callback to be invoked when the scan completes.
289289
m_scanCompleteCB = scanCompleteCB;

src/NimBLEServer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ NimBLEConnInfo NimBLEServer::getPeerIDInfo(uint16_t id) {
537537
NIMBLE_LOGD(LOG_TAG, "BLE_SM_IOACT_DISP; ble_sm_inject_io result: %d", rc);
538538

539539
} else if (event->passkey.params.action == BLE_SM_IOACT_NUMCMP) {
540-
NIMBLE_LOGD(LOG_TAG, "Passkey on device's display: %d", event->passkey.params.numcmp);
540+
NIMBLE_LOGD(LOG_TAG, "Passkey on device's display: %" PRIu32, event->passkey.params.numcmp);
541541
pkey.action = event->passkey.params.action;
542542
// Compatibility only - Do not use, should be removed the in future
543543
if(NimBLEDevice::m_securityCallbacks != nullptr) {
@@ -786,7 +786,7 @@ void NimBLEServer::updateConnParams(uint16_t conn_handle,
786786
*/
787787
void NimBLEServer::setDataLen(uint16_t conn_handle, uint16_t tx_octets) {
788788
#if defined(CONFIG_NIMBLE_CPP_IDF) && defined(ESP_IDF_VERSION) && \
789-
ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(4,3,2)
789+
ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 3 && ESP_IDF_VERSION_PATCH >= 2
790790
return;
791791
#else
792792
uint16_t tx_time = (tx_octets + 14) * 8;

0 commit comments

Comments
 (0)