Skip to content

Commit d14071a

Browse files
committed
Fix line mangling on merge
Force gcc to ignore unused-but-set-parameter Fix line misplacement by merge Cast string data to uint8_t pointer Fix line mangling on merge Fix line mangling on merge Fix line mangling on merge
1 parent 4cfef4d commit d14071a

7 files changed

+32
-36
lines changed

cpp_utils/BLECharacteristicMap.cpp

+4-10
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,9 @@ BLECharacteristic* BLECharacteristicMap::getNext() {
8181
* @param [in] gatts_if
8282
* @param [in] param
8383
*/
84-
void BLECharacteristicMap::handleGATTServerEvent(
85-
esp_gatts_cb_event_t event,
86-
esp_gatt_if_t gatts_if,
87-
esp_ble_gatts_cb_param_t* param) {
84+
void BLECharacteristicMap::handleGATTServerEvent(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t* param) {
8885
// Invoke the handler for every Service we have.
89-
for (auto &myPair : m_uuidMap) {
86+
for (auto& myPair : m_uuidMap) {
9087
myPair.first->handleGATTServerEvent(event, gatts_if, param);
9188
}
9289
} // handleGATTServerEvent
@@ -98,8 +95,7 @@ void BLECharacteristicMap::handleGATTServerEvent(
9895
* @param [in] characteristic The characteristic to cache.
9996
* @return N/A.
10097
*/
101-
void BLECharacteristicMap::setByHandle(uint16_t handle,
102-
BLECharacteristic* characteristic) {
98+
void BLECharacteristicMap::setByHandle(uint16_t handle, BLECharacteristic* characteristic) {
10399
m_handleMap.insert(std::pair<uint16_t, BLECharacteristic*>(handle, characteristic));
104100
} // setByHandle
105101

@@ -110,9 +106,7 @@ void BLECharacteristicMap::setByHandle(uint16_t handle,
110106
* @param [in] characteristic The characteristic to cache.
111107
* @return N/A.
112108
*/
113-
void BLECharacteristicMap::setByUUID(
114-
BLEUUID uuid) {
115-
BLECharacteristic* pCharacteristic,
109+
void BLECharacteristicMap::setByUUID(BLECharacteristic* pCharacteristic, BLEUUID uuid) {
116110
m_uuidMap.insert(std::pair<BLECharacteristic*, std::string>(pCharacteristic, uuid.toString()));
117111
} // setByUUID
118112

cpp_utils/BLERemoteDescriptor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ void BLERemoteDescriptor::writeValue(uint8_t* data, size_t length, bool response
161161
* @param [in] response True if we expect a response.
162162
*/
163163
void BLERemoteDescriptor::writeValue(std::string newValue, bool response) {
164-
writeValue(newValue.data(), newValue.length(), response);
164+
writeValue((uint8_t*) newValue.data(), newValue.length(), response);
165165
} // writeValue
166166

167167

cpp_utils/BLERemoteService.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ std::map<std::string, BLERemoteCharacteristic*>* BLERemoteService::getCharacteri
233233
* @brief This function is designed to get characteristics map when we have multiple characteristics with the same UUID
234234
*/
235235
void BLERemoteService::getCharacteristics(std::map<uint16_t, BLERemoteCharacteristic*>* pCharacteristicMap) {
236+
#pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
236237
pCharacteristicMap = &m_characteristicMapByHandle;
237238
} // Get the characteristics map.
238239

cpp_utils/MFRC522.cpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void MFRC522::PCD_ClearRegisterBitMask(PCD_Register reg, byte mask) {
146146
* @param result Out: Pointer to result buffer. Result is written to result[0..1], low byte first.
147147
* @return STATUS_OK on success, STATUS_??? otherwise.
148148
*/
149-
MFRC522::StatusCode MFRC522::PCD_CalculateCRC(byte *data, byte length, byte *result) {
149+
MFRC522::StatusCode MFRC522::PCD_CalculateCRC(byte* data, byte length, byte* result) {
150150
PCD_WriteRegister(CommandReg, PCD_Idle); // Stop any active command.
151151
PCD_WriteRegister(DivIrqReg, 0x04); // Clear the CRCIRq interrupt request bit
152152
PCD_WriteRegister(FIFOLevelReg, 0x80); // FlushBuffer = 1, FIFO initialization
@@ -160,7 +160,6 @@ MFRC522::StatusCode MFRC522::PCD_CalculateCRC(byte *data, byte length, byte *res
160160
for (uint16_t i = 5000; i > 0; i--) {
161161
// DivIrqReg[7..0] bits are: Set2 reserved reserved MfinActIRq reserved CRCIRq reserved reserved
162162
byte n = PCD_ReadRegister(DivIrqReg);
163-
if (n & 0x04) { // CRCIRq bit set - calculation done
164163
if (n & 0x04) { // CRCIRq bit set - calculation done
165164
PCD_WriteRegister(CommandReg, PCD_Idle); // Stop calculating CRC for new content in the FIFO.
166165
// Transfer the result from the registers to the result buffer
@@ -403,8 +402,8 @@ bool MFRC522::PCD_PerformSelfTest() {
403402
* @param checkCRC In: True => The last two bytes of the response is assumed to be a CRC_A that must be validated.
404403
* @return STATUS_OK on success, STATUS_??? otherwise.
405404
*/
406-
byte waitIRq = 0x30; // RxIRq and IdleIRq
407405
MFRC522::StatusCode MFRC522::PCD_TransceiveData(byte* sendData, byte sendLen, byte* backData, byte* backLen, byte* validBits, byte rxAlign, bool checkCRC) {
406+
byte waitIRq = 0x30; // RxIRq and IdleIRq
408407
return PCD_CommunicateWithPICC(PCD_Transceive, waitIRq, sendData, sendLen, backData, backLen, validBits, rxAlign, checkCRC);
409408
} // End PCD_TransceiveData()
410409

@@ -426,8 +425,8 @@ MFRC522::StatusCode MFRC522::PCD_TransceiveData(byte* sendData, byte sendLen, by
426425
*/
427426
MFRC522::StatusCode MFRC522::PCD_CommunicateWithPICC(byte command, byte waitIRq, byte* sendData, byte sendLen, byte* backData, byte* backLen, byte* validBits, byte rxAlign, bool checkCRC) {
428427
// Prepare values for BitFramingReg
429-
byte bitFraming = (rxAlign << 4) + txLastBits; // RxAlign = BitFramingReg[6..4]. TxLastBits = BitFramingReg[2..0]
430428
byte txLastBits = validBits ? *validBits : (byte) 0;
429+
byte bitFraming = (rxAlign << 4) + txLastBits; // RxAlign = BitFramingReg[6..4]. TxLastBits = BitFramingReg[2..0]
431430

432431
PCD_WriteRegister(CommandReg, PCD_Idle); // Stop any active command.
433432
PCD_WriteRegister(ComIrqReg, 0x7F); // Clear all seven interrupt request bits
@@ -808,8 +807,8 @@ MFRC522::StatusCode MFRC522::PICC_HaltA() {
808807
* @param uid Pointer to Uid struct. The first 4 bytes of the UID is used.
809808
* @return STATUS_OK on success, STATUS_??? otherwise. Probably STATUS_TIMEOUT if you supply the wrong key.
810809
*/
811-
byte waitIRq = 0x10; // IdleIRq
812810
MFRC522::StatusCode MFRC522::PCD_Authenticate(byte command, byte blockAddr, MIFARE_Key* key, Uid* uid) {
811+
byte waitIRq = 0x10; // IdleIRq
813812

814813
// Build command buffer
815814
byte sendData[12];

cpp_utils/SockServ.cpp

+15-15
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ static const char* LOG_TAG = "SockServ";
3030
*/
3131
SockServ::SockServ(uint16_t port) : SockServ() {
3232
this->m_port = port;
33-
3433
} // SockServ
3534

3635

@@ -62,20 +61,21 @@ SockServ::~SockServ() {
6261
*/
6362
/* static */ void SockServ::acceptTask(void* data) {
6463
SockServ* pSockServ = (SockServ*) data;
65-
try {
66-
while (true) {
64+
while (true) {
65+
try {
6766
ESP_LOGD(LOG_TAG, "Waiting on accept");
6867
Socket tempSock = pSockServ->m_serverSocket.accept();
6968
if (!tempSock.isValid()) continue;
7069

7170
pSockServ->m_clientSet.insert(tempSock);
7271
xQueueSendToBack(pSockServ->m_acceptQueue, &tempSock, portMAX_DELAY);
7372
pSockServ->m_clientSemaphore.give();
73+
} catch (std::exception e) {
74+
ESP_LOGD(LOG_TAG, "acceptTask ending");
75+
pSockServ->m_clientSemaphore.give(); // Wake up any waiting clients.
76+
FreeRTOS::deleteTask();
77+
break;
7478
}
75-
} catch(std::exception e) {
76-
ESP_LOGD(LOG_TAG, "acceptTask ending");
77-
pSockServ->m_clientSemaphore.give(); // Wake up any waiting clients.
78-
FreeRTOS::deleteTask();
7979
}
8080
} // acceptTask
8181

@@ -114,12 +114,12 @@ bool SockServ::getSSL() {
114114
* @return The amount of data returned or 0 if there was an error.
115115
*/
116116
size_t SockServ::receiveData(Socket s, void* pData, size_t maxData) {
117-
int rc = s.receive((uint8_t*) pData, maxData);
117+
size_t rc = s.receive((uint8_t*) pData, maxData);
118118
if (rc == -1) {
119119
ESP_LOGE(LOG_TAG, "recv(): %s", strerror(errno));
120120
return 0;
121121
}
122-
return (size_t) rc;
122+
return rc;
123123
} // receiveData
124124

125125

@@ -190,19 +190,19 @@ Socket SockServ::waitForData(std::set<Socket>& socketSet) {
190190
fd_set readSet;
191191
int maxFd = -1;
192192

193-
for ( auto it = socketSet.begin(); it != socketSet.end(); ++it) {
193+
for (auto it = socketSet.begin(); it != socketSet.end(); ++it) {
194194
FD_SET(it->getFD(), &readSet);
195195
if (it->getFD() > maxFd) {
196196
maxFd = it->getFD();
197197
}
198198
} // End for
199199

200200
int rc = ::select(
201-
&readSet, // Set of read sockets
202-
nullptr, // Set of write sockets
203-
nullptr, // Set of exception sockets
204-
nullptr // Timeout
205-
maxFd + 1, // Number of sockets to scan
201+
maxFd+1, // Number of sockets to scan
202+
&readSet, // Set of read sockets
203+
nullptr, // Set of write sockets
204+
nullptr, // Set of exception sockets
205+
nullptr // Timeout
206206
);
207207
if (rc == -1) {
208208
ESP_LOGE(LOG_TAG, "Error with select");

cpp_utils/System.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ typedef volatile struct {
4747
} pin_ctrl;
4848

4949
// The 36 exposed pads.
50+
io_mux_reg_t pad_gpio36; // GPIO36
51+
io_mux_reg_t pad_gpio37; // GPIO37
52+
io_mux_reg_t pad_gpio38; // GPIO38
5053
io_mux_reg_t pad_gpio39; // GPIO39
5154
io_mux_reg_t pad_gpio34; // GPIO34
5255
io_mux_reg_t pad_gpio35; // GPIO35
@@ -64,7 +67,6 @@ typedef volatile struct {
6467
io_mux_reg_t pad_gpio4; // GPIO4
6568
io_mux_reg_t pad_gpio16; // GPIO16
6669
io_mux_reg_t pad_gpio17; // GPIO17
67-
io_mux_reg_t pad_gpio37; // GPIO37
6870
io_mux_reg_t pad_sd_data2; // GPIO9
6971
io_mux_reg_t pad_sd_data3; // GPIO10
7072
io_mux_reg_t pad_sd_cmd; // GPIO11
@@ -406,16 +408,16 @@ const static char* outSignalStrings[] = {
406408
for (uint8_t i = 0; i < numPins; i++) {
407409
const char *signal;
408410
if (GPIO.func_out_sel_cfg[i].func_sel == 256) {
409-
signal = (char *)"[GPIO]";
411+
signal = (char*) "[GPIO]";
410412
} else if (GPIO.func_out_sel_cfg[i].func_sel == 257) {
411-
signal = (char *)"N/A";
413+
signal = (char*) "N/A";
412414
} else {
413415
signal = outSignalStrings[GPIO.func_out_sel_cfg[i].func_sel];
414416
}
415417
printf("%2d %4d %s\n", i, GPIO.func_out_sel_cfg[i].func_sel, signal);
416418
const io_mux_reg_t* io_mux = gpioToIoMux(i);
417419
if (GPIO.func_out_sel_cfg[i].func_sel == 256 && io_mux != nullptr) {
418-
printf("0x%x - function: %d, ie: %d\n", (uint32_t)io_mux, io_mux->mcu_sel + 1, io_mux->func_ie);
420+
printf("0x%x - function: %d, ie: %d\n", (uint32_t) io_mux, io_mux->mcu_sel + 1, io_mux->func_ie);
419421
}
420422
}
421423

cpp_utils/WS2812.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ void WS2812::show() {
158158
(getChannelValueByType(this->colorOrder[2], this->pixels[i]));
159159

160160
ESP_LOGD(LOG_TAG, "Pixel value: %x", currentPixel);
161-
for (uint8_t j = 23; j > =0; j--) {
161+
for (uint8_t j = 23; j >= 0; j--) {
162162
// We have 24 bits of data representing the red, green amd blue channels. The value of the
163163
// 24 bits to output is in the variable current_pixel. We now need to stream this value
164164
// through RMT in most significant bit first. To do this, we iterate through each of the 24

0 commit comments

Comments
 (0)