Cleanup ARM-gcc compiler warnings.

This commit is contained in:
h2zero 2022-01-15 12:43:17 -07:00
parent bbed8d1d4b
commit cee369fd92
7 changed files with 17 additions and 22 deletions

View file

@ -45,13 +45,8 @@
/* of data as per HID Class standard */ /* of data as per HID Class standard */
/* Main items */ /* Main items */
#ifdef ARDUINO_ARCH_ESP32
#define HIDINPUT(size) (0x80 | size) #define HIDINPUT(size) (0x80 | size)
#define HIDOUTPUT(size) (0x90 | size) #define HIDOUTPUT(size) (0x90 | size)
#else
#define INPUT(size) (0x80 | size)
#define OUTPUT(size) (0x90 | size)
#endif
#define FEATURE(size) (0xb0 | size) #define FEATURE(size) (0xb0 | size)
#define COLLECTION(size) (0xa0 | size) #define COLLECTION(size) (0xa0 | size)
#define END_COLLECTION(size) (0xc0 | size) #define END_COLLECTION(size) (0xc0 | size)

View file

@ -465,7 +465,7 @@ void NimBLEClient::updateConnParams(uint16_t minInterval, uint16_t maxInterval,
*/ */
void NimBLEClient::setDataLen(uint16_t tx_octets) { void NimBLEClient::setDataLen(uint16_t tx_octets) {
#if defined(CONFIG_NIMBLE_CPP_IDF) && defined(ESP_IDF_VERSION) && \ #if defined(CONFIG_NIMBLE_CPP_IDF) && defined(ESP_IDF_VERSION) && \
ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(4,3,2) ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 3 && ESP_IDF_VERSION_PATCH >= 2
return; return;
#else #else
uint16_t tx_time = (tx_octets + 14) * 8; uint16_t tx_time = (tx_octets + 14) * 8;
@ -1084,7 +1084,7 @@ uint16_t NimBLEClient::getMTU() {
NIMBLE_LOGD(LOG_TAG, "ble_sm_inject_io result: %d", rc); NIMBLE_LOGD(LOG_TAG, "ble_sm_inject_io result: %d", rc);
} else if (event->passkey.params.action == BLE_SM_IOACT_NUMCMP) { } else if (event->passkey.params.action == BLE_SM_IOACT_NUMCMP) {
NIMBLE_LOGD(LOG_TAG, "Passkey on device's display: %d", event->passkey.params.numcmp); NIMBLE_LOGD(LOG_TAG, "Passkey on device's display: %" PRIu32, event->passkey.params.numcmp);
pkey.action = event->passkey.params.action; pkey.action = event->passkey.params.action;
// Compatibility only - Do not use, should be removed the in future // Compatibility only - Do not use, should be removed the in future
if(NimBLEDevice::m_securityCallbacks != nullptr) { if(NimBLEDevice::m_securityCallbacks != nullptr) {

View file

@ -50,26 +50,26 @@
# endif # endif
# if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 4 # if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 4
# define NIMBLE_LOGD( tag, format, ... ) console_printf("D %s: "#format"\n",tag,##__VA_ARGS__) # define NIMBLE_LOGD( tag, format, ... ) console_printf("D %s: " format "\n", tag, ##__VA_ARGS__)
# else # else
# define NIMBLE_LOGD( tag, format, ... ) (void)tag # define NIMBLE_LOGD( tag, format, ... ) (void)tag
# endif # endif
# if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 3 # if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 3
# define NIMBLE_LOGI( tag, format, ... ) console_printf("I %s: "#format"\n",tag,##__VA_ARGS__) # define NIMBLE_LOGI( tag, format, ... ) console_printf("I %s: " format "\n", tag, ##__VA_ARGS__)
# else # else
# define NIMBLE_LOGI( tag, format, ... ) (void)tag # define NIMBLE_LOGI( tag, format, ... ) (void)tag
# endif # endif
# if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 2 # if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 2
# define NIMBLE_LOGW( tag, format, ... ) console_printf("W %s: "#format"\n",tag,##__VA_ARGS__) # define NIMBLE_LOGW( tag, format, ... ) console_printf("W %s: " format "\n", tag, ##__VA_ARGS__)
# else # else
# define NIMBLE_LOGW( tag, format, ... ) (void)tag # define NIMBLE_LOGW( tag, format, ... ) (void)tag
# endif # endif
# if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 1 # if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 1
# define NIMBLE_LOGE( tag, format, ... ) console_printf("E %s: "#format"\n",tag,##__VA_ARGS__) # define NIMBLE_LOGE( tag, format, ... ) console_printf("E %s: " format "\n", tag, ##__VA_ARGS__)
# define NIMBLE_LOGC( tag, format, ... ) console_printf("CRIT %s: "#format"\n",tag,##__VA_ARGS__) # define NIMBLE_LOGC( tag, format, ... ) console_printf("CRIT %s: " format "\n", tag, ##__VA_ARGS__)
# else # else
# define NIMBLE_LOGE( tag, format, ... ) (void)tag # define NIMBLE_LOGE( tag, format, ... ) (void)tag
# define NIMBLE_LOGC( tag, format, ... ) (void)tag # define NIMBLE_LOGC( tag, format, ... ) (void)tag

View file

@ -563,11 +563,11 @@ int NimBLERemoteCharacteristic::onReadCB(uint16_t conn_handle,
if(rc == 0) { if(rc == 0) {
if(attr) { if(attr) {
uint32_t data_len = OS_MBUF_PKTLEN(attr->om); uint16_t data_len = OS_MBUF_PKTLEN(attr->om);
if(((*strBuf).length() + data_len) > BLE_ATT_ATTR_MAX_LEN) { if(((*strBuf).length() + data_len) > BLE_ATT_ATTR_MAX_LEN) {
rc = BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN; rc = BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
} else { } else {
NIMBLE_LOGD(LOG_TAG, "Got %d bytes", data_len); NIMBLE_LOGD(LOG_TAG, "Got %u bytes", data_len);
(*strBuf) += std::string((char*) attr->om->om_data, data_len); (*strBuf) += std::string((char*) attr->om->om_data, data_len);
return 0; return 0;
} }

View file

@ -180,7 +180,7 @@ std::string NimBLERemoteDescriptor::readValue() {
} }
} while(rc != 0 && retryCount--); } while(rc != 0 && retryCount--);
NIMBLE_LOGD(LOG_TAG, "<< Descriptor readValue(): length: %d rc=%d", value.length(), rc); NIMBLE_LOGD(LOG_TAG, "<< Descriptor readValue(): length: %u rc=%d", value.length(), rc);
return value; return value;
} // readValue } // readValue
@ -209,11 +209,11 @@ int NimBLERemoteDescriptor::onReadCB(uint16_t conn_handle,
if(rc == 0) { if(rc == 0) {
if(attr) { if(attr) {
uint32_t data_len = OS_MBUF_PKTLEN(attr->om); uint16_t data_len = OS_MBUF_PKTLEN(attr->om);
if(((*strBuf).length() + data_len) > BLE_ATT_ATTR_MAX_LEN) { if(((*strBuf).length() + data_len) > BLE_ATT_ATTR_MAX_LEN) {
rc = BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN; rc = BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
} else { } else {
NIMBLE_LOGD(LOG_TAG, "Got %d bytes", data_len); NIMBLE_LOGD(LOG_TAG, "Got %u bytes", data_len);
(*strBuf) += std::string((char*) attr->om->om_data, data_len); (*strBuf) += std::string((char*) attr->om->om_data, data_len);
return 0; return 0;
} }

View file

@ -283,7 +283,7 @@ bool NimBLEScan::isScanning() {
* @return True if scan started or false if there was an error. * @return True if scan started or false if there was an error.
*/ */
bool NimBLEScan::start(uint32_t duration, void (*scanCompleteCB)(NimBLEScanResults), bool is_continue) { bool NimBLEScan::start(uint32_t duration, void (*scanCompleteCB)(NimBLEScanResults), bool is_continue) {
NIMBLE_LOGD(LOG_TAG, ">> start(duration=%d)", duration); NIMBLE_LOGD(LOG_TAG, ">> start: duration=%" PRIu32, duration);
// Save the callback to be invoked when the scan completes. // Save the callback to be invoked when the scan completes.
m_scanCompleteCB = scanCompleteCB; m_scanCompleteCB = scanCompleteCB;

View file

@ -537,7 +537,7 @@ NimBLEConnInfo NimBLEServer::getPeerIDInfo(uint16_t id) {
NIMBLE_LOGD(LOG_TAG, "BLE_SM_IOACT_DISP; ble_sm_inject_io result: %d", rc); NIMBLE_LOGD(LOG_TAG, "BLE_SM_IOACT_DISP; ble_sm_inject_io result: %d", rc);
} else if (event->passkey.params.action == BLE_SM_IOACT_NUMCMP) { } else if (event->passkey.params.action == BLE_SM_IOACT_NUMCMP) {
NIMBLE_LOGD(LOG_TAG, "Passkey on device's display: %d", event->passkey.params.numcmp); NIMBLE_LOGD(LOG_TAG, "Passkey on device's display: %" PRIu32, event->passkey.params.numcmp);
pkey.action = event->passkey.params.action; pkey.action = event->passkey.params.action;
// Compatibility only - Do not use, should be removed the in future // Compatibility only - Do not use, should be removed the in future
if(NimBLEDevice::m_securityCallbacks != nullptr) { if(NimBLEDevice::m_securityCallbacks != nullptr) {
@ -786,7 +786,7 @@ void NimBLEServer::updateConnParams(uint16_t conn_handle,
*/ */
void NimBLEServer::setDataLen(uint16_t conn_handle, uint16_t tx_octets) { void NimBLEServer::setDataLen(uint16_t conn_handle, uint16_t tx_octets) {
#if defined(CONFIG_NIMBLE_CPP_IDF) && defined(ESP_IDF_VERSION) && \ #if defined(CONFIG_NIMBLE_CPP_IDF) && defined(ESP_IDF_VERSION) && \
ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(4,3,2) ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 3 && ESP_IDF_VERSION_PATCH >= 2
return; return;
#else #else
uint16_t tx_time = (tx_octets + 14) * 8; uint16_t tx_time = (tx_octets + 14) * 8;