Skip to content

Commit c44beb9

Browse files
authored
Merge pull request #474 from brentru/fix-esp8266-warnings
Fix ESP8266 Compiler Warnings
2 parents d5e9a70 + ece56dd commit c44beb9

10 files changed

+110
-34
lines changed

.github/workflows/build-clang-doxy.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags)
100100
- uses: actions/checkout@v2
101101
with:
102-
repository: adafruit/ci-arduino
102+
repository: brentru/ci-arduino
103103
path: ci
104104
- name: Checkout Board Definitions
105105
uses: actions/checkout@v2
@@ -305,7 +305,7 @@ jobs:
305305
echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags)
306306
- uses: actions/checkout@v2
307307
with:
308-
repository: adafruit/ci-arduino
308+
repository: brentru/ci-arduino
309309
path: ci
310310
- name: Install CI-Arduino
311311
run: bash ci/actions_install.sh

src/Wippersnapper.cpp

+19-9
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ bool Wippersnapper::configureDigitalPinReq(
346346
/*****************************************************************************/
347347
bool cbDecodePinConfigMsg(pb_istream_t *stream, const pb_field_t *field,
348348
void **arg) {
349+
(void)field; // marking unused parameters to avoid compiler warning
350+
(void)arg; // marking unused parameters to avoid compiler warning
349351
bool is_success = true;
350352
WS_DEBUG_PRINTLN("cbDecodePinConfigMsg");
351353

@@ -386,6 +388,8 @@ bool cbDecodePinConfigMsg(pb_istream_t *stream, const pb_field_t *field,
386388
bool cbDecodeDigitalPinWriteMsg(pb_istream_t *stream, const pb_field_t *field,
387389
void **arg) {
388390
bool is_success = true;
391+
(void)field; // marking unused parameters to avoid compiler warning
392+
(void)arg; // marking unused parameters to avoid compiler warning
389393
WS_DEBUG_PRINTLN("cbDecodeDigitalPinWriteMsg");
390394

391395
// Decode stream into a PinEvent
@@ -417,6 +421,7 @@ bool cbDecodeDigitalPinWriteMsg(pb_istream_t *stream, const pb_field_t *field,
417421
*/
418422
/**************************************************************************/
419423
bool cbSignalMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) {
424+
(void)arg; // marking unused parameters to avoid compiler warning
420425
bool is_success = true;
421426
WS_DEBUG_PRINTLN("cbSignalMsg");
422427

@@ -567,15 +572,11 @@ bool encodeI2CResponse(wippersnapper_signal_v1_I2CResponse *msgi2cResponse) {
567572
@brief Initializes an I2C bus component
568573
@param msgInitRequest
569574
A pointer to an i2c bus initialization message.
570-
@param i2cPort
571-
Desired I2C port to initialize.
572575
@return True if initialized successfully, False otherwise.
573576
*/
574577
/******************************************************************************************/
575-
bool initializeI2CBus(wippersnapper_i2c_v1_I2CBusInitRequest msgInitRequest,
576-
int i2cPort) {
577-
// TODO: i2cPort is not handled right now, we should add support for multiple
578-
// i2c ports!
578+
bool initializeI2CBus(wippersnapper_i2c_v1_I2CBusInitRequest msgInitRequest) {
579+
// FUTURE TODO:we should add support for multiple i2c ports!
579580
if (WS._isI2CPort0Init)
580581
return true;
581582
// Initialize bus
@@ -599,6 +600,8 @@ bool initializeI2CBus(wippersnapper_i2c_v1_I2CBusInitRequest msgInitRequest,
599600
/******************************************************************************************/
600601
bool cbDecodeI2CDeviceInitRequestList(pb_istream_t *stream,
601602
const pb_field_t *field, void **arg) {
603+
(void)field; // marking unused parameters to avoid compiler warning
604+
(void)arg; // marking unused parameters to avoid compiler warning
602605
WS_DEBUG_PRINTLN("EXEC: cbDecodeI2CDeviceInitRequestList");
603606
// Decode stream into individual msgI2CDeviceInitRequest messages
604607
wippersnapper_i2c_v1_I2CDeviceInitRequest msgI2CDeviceInitRequest =
@@ -616,7 +619,7 @@ bool cbDecodeI2CDeviceInitRequestList(pb_istream_t *stream,
616619
wippersnapper_signal_v1_I2CResponse_resp_i2c_device_init_tag;
617620

618621
// Check I2C bus
619-
if (!initializeI2CBus(msgI2CDeviceInitRequest.i2c_bus_init_req, 0)) {
622+
if (!initializeI2CBus(msgI2CDeviceInitRequest.i2c_bus_init_req)) {
620623
WS_DEBUG_PRINTLN("ERROR: Failed to initialize I2C Bus");
621624
msgi2cResponse.payload.resp_i2c_device_init.bus_response =
622625
WS._i2cPort0->getBusStatus();
@@ -664,6 +667,7 @@ bool cbDecodeI2CDeviceInitRequestList(pb_istream_t *stream,
664667
bool cbDecodeSignalRequestI2C(pb_istream_t *stream, const pb_field_t *field,
665668
void **arg) {
666669
bool is_success = true;
670+
(void)arg; // marking unused parameter to avoid compiler warning
667671
WS_DEBUG_PRINTLN("cbDecodeSignalRequestI2C");
668672
// Create I2C Response
669673
wippersnapper_signal_v1_I2CResponse msgi2cResponse =
@@ -687,7 +691,7 @@ bool cbDecodeSignalRequestI2C(pb_istream_t *stream, const pb_field_t *field,
687691
wippersnapper_i2c_v1_I2CBusScanResponse_init_zero;
688692

689693
// Check I2C bus
690-
if (!initializeI2CBus(msgScanReq.bus_init_request, 0)) {
694+
if (!initializeI2CBus(msgScanReq.bus_init_request)) {
691695
WS_DEBUG_PRINTLN("ERROR: Failed to initialize I2C Bus");
692696
msgi2cResponse.payload.resp_i2c_scan.bus_response =
693697
WS._i2cPort0->getBusStatus();
@@ -756,7 +760,7 @@ bool cbDecodeSignalRequestI2C(pb_istream_t *stream, const pb_field_t *field,
756760
wippersnapper_signal_v1_I2CResponse_resp_i2c_device_init_tag;
757761

758762
// Check I2C bus
759-
if (!initializeI2CBus(msgI2CDeviceInitRequest.i2c_bus_init_req, 0)) {
763+
if (!initializeI2CBus(msgI2CDeviceInitRequest.i2c_bus_init_req)) {
760764
WS_DEBUG_PRINTLN("ERROR: Failed to initialize I2C Bus");
761765
msgi2cResponse.payload.resp_i2c_device_init.bus_response =
762766
WS._i2cPort0->getBusStatus();
@@ -904,6 +908,7 @@ void cbSignalI2CReq(char *data, uint16_t len) {
904908
bool cbDecodeServoMsg(pb_istream_t *stream, const pb_field_t *field,
905909
void **arg) {
906910
WS_DEBUG_PRINTLN("Decoding Servo Message...");
911+
(void)arg; // marking unused parameter to avoid compiler warning
907912
if (field->tag == wippersnapper_signal_v1_ServoRequest_servo_attach_tag) {
908913
WS_DEBUG_PRINTLN("GOT: Servo Attach");
909914
// Attempt to decode contents of servo_attach message
@@ -1082,6 +1087,7 @@ void cbServoMsg(char *data, uint16_t len) {
10821087
/******************************************************************************************/
10831088
bool cbPWMDecodeMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) {
10841089
WS_DEBUG_PRINTLN("Decoding PWM Message...");
1090+
(void)arg; // marking unused parameter to avoid compiler warning
10851091
if (field->tag == wippersnapper_signal_v1_PWMRequest_attach_request_tag) {
10861092
WS_DEBUG_PRINTLN("GOT: PWM Pin Attach");
10871093
// Attempt to decode contents of PWM attach message
@@ -1286,6 +1292,7 @@ void cbPWMMsg(char *data, uint16_t len) {
12861292
/******************************************************************************************/
12871293
bool cbDecodeDs18x20Msg(pb_istream_t *stream, const pb_field_t *field,
12881294
void **arg) {
1295+
(void)arg; // marking unused parameter to avoid compiler warning
12891296
if (field->tag ==
12901297
wippersnapper_signal_v1_Ds18x20Request_req_ds18x20_init_tag) {
12911298
WS_DEBUG_PRINTLN("[Message Type] Init. DS Sensor");
@@ -1373,6 +1380,7 @@ void cbSignalDSReq(char *data, uint16_t len) {
13731380
/******************************************************************************************/
13741381
bool cbDecodePixelsMsg(pb_istream_t *stream, const pb_field_t *field,
13751382
void **arg) {
1383+
(void)arg; // marking unused parameter to avoid compiler warning
13761384
if (field->tag ==
13771385
wippersnapper_signal_v1_PixelsRequest_req_pixels_create_tag) {
13781386
WS_DEBUG_PRINTLN(
@@ -1528,6 +1536,7 @@ void cbRegistrationStatus(char *data, uint16_t len) {
15281536
*/
15291537
/**************************************************************************/
15301538
void cbErrorTopic(char *errorData, uint16_t len) {
1539+
(void)len; // marking unused parameter to avoid compiler warning
15311540
WS_DEBUG_PRINT("IO Ban Error: ");
15321541
WS_DEBUG_PRINTLN(errorData);
15331542
// Disconnect client from broker
@@ -1558,6 +1567,7 @@ void cbErrorTopic(char *errorData, uint16_t len) {
15581567
*/
15591568
/**************************************************************************/
15601569
void cbThrottleTopic(char *throttleData, uint16_t len) {
1570+
(void)len; // marking unused parameter to avoid compiler warning
15611571
WS_DEBUG_PRINT("IO Throttle Error: ");
15621572
WS_DEBUG_PRINTLN(throttleData);
15631573
char *throttleMessage;

src/components/analogIO/Wippersnapper_AnalogIO.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ void Wippersnapper_AnalogIO::update() {
329329
if (_analog_input_pins[i].enabled == true) {
330330

331331
// Does the pin execute on-period?
332-
if (millis() - _analog_input_pins[i].prvPeriod >
332+
if ((long)millis() - _analog_input_pins[i].prvPeriod >
333333
_analog_input_pins[i].period &&
334334
_analog_input_pins[i].period != 0L) {
335335
WS_DEBUG_PRINT("Executing periodic event on A");

src/components/ds18x20/ws_ds18x20.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ws_ds18x20::ws_ds18x20() {}
3030
/*************************************************************/
3131
ws_ds18x20::~ws_ds18x20() {
3232
// delete DallasTemp sensors and release onewire buses
33-
for (int idx = 0; idx < _ds18xDrivers.size(); idx++) {
33+
for (size_t idx = 0; idx < _ds18xDrivers.size(); idx++) {
3434
delete _ds18xDrivers[idx]->dallasTempObj;
3535
delete _ds18xDrivers[idx]->oneWire;
3636
}
@@ -135,7 +135,7 @@ bool ws_ds18x20::addDS18x20(
135135
void ws_ds18x20::deleteDS18x20(
136136
wippersnapper_ds18x20_v1_Ds18x20DeInitRequest *msgDS18x20DeinitReq) {
137137
// Loop thru vector of drivers to find the unique address
138-
for (int idx = 0; idx < _ds18xDrivers.size(); idx++) {
138+
for (size_t idx = 0; idx < _ds18xDrivers.size(); idx++) {
139139
if (strcmp(_ds18xDrivers[idx]->onewire_pin,
140140
msgDS18x20DeinitReq->onewire_pin) == 0) {
141141
WS_DEBUG_PRINT("Deleting OneWire instance on pin ");
@@ -185,7 +185,7 @@ void ws_ds18x20::update() {
185185
for (int i = 0; i < (*iter)->sensorPropertiesCount; i++) {
186186
// has sensor_period elapsed?
187187
if (curTime - (*iter)->sensorPeriodPrv >
188-
(*iter)->sensorProperties[i].sensor_period) {
188+
(long)(*iter)->sensorProperties[i].sensor_period) {
189189
// issue global temperature request to all DS sensors
190190
WS_DEBUG_PRINTLN("Requesting temperature..");
191191
(*iter)->dallasTempObj->requestTemperatures();

src/components/i2c/WipperSnapper_I2C.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ void WipperSnapper_Component_I2C::updateI2CDeviceProperties(
560560
uint16_t i2cAddress = (uint16_t)msgDeviceUpdateReq->i2c_device_address;
561561

562562
// Loop thru vector of drivers to find the unique address
563-
for (int i = 0; i < drivers.size(); i++) {
563+
for (size_t i = 0; i < drivers.size(); i++) {
564564
if (drivers[i]->getI2CAddress() == i2cAddress) {
565565
// Update the properties of each driver
566566
for (int j = 0; j < msgDeviceUpdateReq->i2c_device_properties_count;

0 commit comments

Comments
 (0)