From e6dc536dfb65b16d70e5fc3d0162b3d79c4b53d7 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 16 Aug 2023 15:17:21 -0400 Subject: [PATCH 1/9] wunusedparamter and dtor warning removal --- .../i2c/drivers/WipperSnapper_I2C_Driver.h | 84 ++++++++++++++++--- ...perSnapper_I2C_Driver_STEMMA_Soil_Sensor.h | 4 +- 2 files changed, 74 insertions(+), 14 deletions(-) diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver.h index ad71b15ca..c48283c8f 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver.h @@ -46,7 +46,7 @@ class WipperSnapper_I2C_Driver { @brief Destructor for an I2C sensor. */ /*******************************************************************************/ - ~WipperSnapper_I2C_Driver() { _sensorAddress = 0; } + virtual ~WipperSnapper_I2C_Driver() {} /*******************************************************************************/ /*! @@ -206,7 +206,11 @@ class WipperSnapper_I2C_Driver { otherwise. */ /*******************************************************************************/ - virtual bool getEventCO2(sensors_event_t *co2Event) { return false; } + virtual bool getEventCO2(sensors_event_t *co2Event) { + (void) + co2Event; // Parameter is intentionally unused in this virtual function. + return false; + } /****************************** SENSOR_TYPE: ECO2 * *******************************/ @@ -248,7 +252,11 @@ class WipperSnapper_I2C_Driver { otherwise. */ /*******************************************************************************/ - virtual bool getEventECO2(sensors_event_t *eco2Event) { return false; } + virtual bool getEventECO2(sensors_event_t *eco2Event) { + (void)eco2Event; // Parameter is intentionally unused in this virtual + // function. + return false; + } /****************************** SENSOR_TYPE: TVOC * *******************************/ @@ -290,7 +298,11 @@ class WipperSnapper_I2C_Driver { otherwise. */ /*******************************************************************************/ - virtual bool getEventTVOC(sensors_event_t *tvocEvent) { return false; } + virtual bool getEventTVOC(sensors_event_t *tvocEvent) { + (void)tvocEvent; // Parameter is intentionally unused in this virtual + // function. + return false; + } /********************** SENSOR_TYPE: AMBIENT TEMPERATURE (°C) * ***********************/ @@ -336,7 +348,11 @@ class WipperSnapper_I2C_Driver { otherwise. */ /*******************************************************************************/ - virtual bool getEventAmbientTemp(sensors_event_t *tempEvent) { return false; } + virtual bool getEventAmbientTemp(sensors_event_t *tempEvent) { + (void)tempEvent; // Parameter is intentionally unused in this virtual + // function. + return false; + } /************************* SENSOR_TYPE: RELATIVE_HUMIDITY * ***********************/ @@ -382,6 +398,8 @@ class WipperSnapper_I2C_Driver { */ /*******************************************************************************/ virtual bool getEventRelativeHumidity(sensors_event_t *humidEvent) { + (void)humidEvent; // Parameter is intentionally unused in this virtual + // function. return false; } @@ -427,6 +445,8 @@ class WipperSnapper_I2C_Driver { */ /*******************************************************************************/ virtual bool getEventPressure(sensors_event_t *pressureEvent) { + (void)pressureEvent; // Parameter is intentionally unused in this virtual + // function. return false; } @@ -472,6 +492,8 @@ class WipperSnapper_I2C_Driver { */ /*******************************************************************************/ virtual bool getEventAltitude(sensors_event_t *altitudeEvent) { + (void)altitudeEvent; // Parameter is intentionally unused in this virtual + // function. return false; } @@ -522,6 +544,8 @@ class WipperSnapper_I2C_Driver { */ /*******************************************************************************/ virtual bool getEventObjectTemp(sensors_event_t *objectTempEvent) { + (void)objectTempEvent; // Parameter is intentionally unused in this virtual + // function. return false; } @@ -569,7 +593,11 @@ class WipperSnapper_I2C_Driver { otherwise. */ /*******************************************************************************/ - virtual bool getEventLight(sensors_event_t *lightEvent) { return false; } + virtual bool getEventLight(sensors_event_t *lightEvent) { + (void)lightEvent; // Parameter is intentionally unused in this virtual + // function. + return false; + } /**************************** SENSOR_TYPE: PM10_STD * ****************************/ @@ -615,7 +643,11 @@ class WipperSnapper_I2C_Driver { otherwise. */ /*******************************************************************************/ - virtual bool getEventPM10_STD(sensors_event_t *pm10StdEvent) { return false; } + virtual bool getEventPM10_STD(sensors_event_t *pm10StdEvent) { + (void)pm10StdEvent; // Parameter is intentionally unused in this virtual + // function. + return false; + } /**************************** SENSOR_TYPE: PM25_STD * ****************************/ @@ -661,7 +693,11 @@ class WipperSnapper_I2C_Driver { otherwise. */ /*******************************************************************************/ - virtual bool getEventPM25_STD(sensors_event_t *pm25StdEvent) { return false; } + virtual bool getEventPM25_STD(sensors_event_t *pm25StdEvent) { + (void)pm25StdEvent; // Parameter is intentionally unused in this virtual + // function. + return false; + } /**************************** SENSOR_TYPE: PM100_STD * ****************************/ @@ -708,6 +744,8 @@ class WipperSnapper_I2C_Driver { */ /*******************************************************************************/ virtual bool getEventPM100_STD(sensors_event_t *pm100StdEvent) { + (void)pm100StdEvent; // Parameter is intentionally unused in this virtual + // function. return false; } @@ -760,6 +798,8 @@ class WipperSnapper_I2C_Driver { */ /*******************************************************************************/ virtual bool getEventUnitlessPercent(sensors_event_t *unitlessPercentEvent) { + (void)unitlessPercentEvent; // Parameter is intentionally unused in this + // virtual function. return false; } @@ -804,7 +844,11 @@ class WipperSnapper_I2C_Driver { otherwise. */ /*******************************************************************************/ - virtual bool getEventVoltage(sensors_event_t *voltageEvent) { return false; } + virtual bool getEventVoltage(sensors_event_t *voltageEvent) { + (void)voltageEvent; // Parameter is intentionally unused in this virtual + // function. + return false; + } /****************************** SENSOR_TYPE: Raw * *******************************/ @@ -846,7 +890,11 @@ class WipperSnapper_I2C_Driver { otherwise. */ /*******************************************************************************/ - virtual bool getEventRaw(sensors_event_t *rawEvent) { return false; } + virtual bool getEventRaw(sensors_event_t *rawEvent) { + (void) + rawEvent; // Parameter is intentionally unused in this virtual function. + return false; + } /****************************** SENSOR_TYPE: Ambient Temp (°F) * *******************************/ @@ -1019,6 +1067,8 @@ class WipperSnapper_I2C_Driver { */ /*******************************************************************************/ virtual bool getEventGasResistance(sensors_event_t *gasEvent) { + (void) + gasEvent; // Parameter is intentionally unused in this virtual function. return false; } @@ -1067,7 +1117,11 @@ class WipperSnapper_I2C_Driver { otherwise. */ /*******************************************************************************/ - virtual bool getEventNOxIndex(sensors_event_t *gasEvent) { return false; } + virtual bool getEventNOxIndex(sensors_event_t *gasEvent) { + (void) + gasEvent; // Parameter is intentionally unused in this virtual function. + return false; + } /****************************** SENSOR_TYPE: VOC Index (index) * *******************************/ @@ -1114,7 +1168,11 @@ class WipperSnapper_I2C_Driver { otherwise. */ /*******************************************************************************/ - virtual bool getEventVOCIndex(sensors_event_t *gasEvent) { return false; } + virtual bool getEventVOCIndex(sensors_event_t *gasEvent) { + (void) + gasEvent; // Parameter is intentionally unused in this virtual function. + return false; + } /**************************** SENSOR_TYPE: PROXIMITY * ****************************/ @@ -1189,6 +1247,8 @@ class WipperSnapper_I2C_Driver { */ /*******************************************************************************/ virtual bool getEventProximity(sensors_event_t *proximityEvent) { + (void)proximityEvent; // Parameter is intentionally unused in this virtual + // function. return false; } diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_STEMMA_Soil_Sensor.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_STEMMA_Soil_Sensor.h index 0d733f778..5e69b4b33 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_STEMMA_Soil_Sensor.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_STEMMA_Soil_Sensor.h @@ -49,7 +49,7 @@ class WipperSnapper_I2C_Driver_STEMMA_Soil_Sensor @brief Destructor for a STEMMA soil sensor. */ /*******************************************************************************/ - ~WipperSnapper_I2C_Driver_STEMMA_Soil_Sensor() { delete _seesaw; } + ~WipperSnapper_I2C_Driver_STEMMA_Soil_Sensor() { _seesaw = nullptr; } /*******************************************************************************/ /*! @@ -99,7 +99,7 @@ class WipperSnapper_I2C_Driver_STEMMA_Soil_Sensor } protected: - Adafruit_seesaw *_seesaw; ///< Seesaw object + Adafruit_seesaw *_seesaw = nullptr; ///< Seesaw object }; #endif // WipperSnapper_I2C_Driver_STEMMA_Soil_Sensor_H \ No newline at end of file From d1277ffddeb23970ee3ca5fc09315cfa1c6850f2 Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 16 Aug 2023 15:47:17 -0400 Subject: [PATCH 2/9] fix warning: comparison of integer expressions of different signedness: 'long unsigned int' and 'long int' [-Wsign-compare] --- src/components/pixels/ws_pixels.cpp | 2 +- src/components/servo/ws_servo.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/pixels/ws_pixels.cpp b/src/components/pixels/ws_pixels.cpp index dcc782b29..2d21ac836 100644 --- a/src/components/pixels/ws_pixels.cpp +++ b/src/components/pixels/ws_pixels.cpp @@ -46,7 +46,7 @@ ws_pixels::~ws_pixels() { */ /******************************************************************************/ int16_t ws_pixels::allocateStrand() { - for (int16_t strandIdx = 0; strandIdx < sizeof(strands) / sizeof(strands[0]); + for (size_t strandIdx = 0; strandIdx < sizeof(strands) / sizeof(strands[0]); strandIdx++) { if (strands[strandIdx].type == wippersnapper_pixels_v1_PixelsType_PIXELS_TYPE_UNSPECIFIED) { diff --git a/src/components/servo/ws_servo.cpp b/src/components/servo/ws_servo.cpp index 5223ed9be..23db82a97 100644 --- a/src/components/servo/ws_servo.cpp +++ b/src/components/servo/ws_servo.cpp @@ -36,7 +36,7 @@ ws_servo::~ws_servo() { */ /**************************************************************************/ servoComponent *ws_servo::getServoComponent(uint8_t pin) { - for (int i = 0; i < sizeof(_servos) / sizeof(_servos[0]); i++) { + for (size_t i = 0; i < sizeof(_servos) / sizeof(_servos[0]); i++) { WS_DEBUG_PRINTLN(_servos[i].pin); if (_servos[i].pin == pin) return &_servos[i]; @@ -72,6 +72,7 @@ bool ws_servo::servo_attach(int pin, int minPulseWidth, int maxPulseWidth, #ifdef ARDUINO_ARCH_ESP32 rc = servo->attach(pin, minPulseWidth, maxPulseWidth, freq); #else + (void)freq; // supress warning when we don't use the frequency parameter rc = servo->attach(pin, minPulseWidth, maxPulseWidth); #endif if (rc == ERR_SERVO_ATTACH) From a4968770e4f2276edc074abda1849c10a38ac0ab Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 16 Aug 2023 16:14:37 -0400 Subject: [PATCH 3/9] add brentru fork --- .github/workflows/build-clang-doxy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-clang-doxy.yml b/.github/workflows/build-clang-doxy.yml index 9018a7203..43f0b9ea1 100644 --- a/.github/workflows/build-clang-doxy.yml +++ b/.github/workflows/build-clang-doxy.yml @@ -99,7 +99,7 @@ jobs: echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags) - uses: actions/checkout@v2 with: - repository: adafruit/ci-arduino + repository: brentru/ci-arduino path: ci - name: Checkout Board Definitions uses: actions/checkout@v2 From 7beba0297a75051d91a2dd7f4cfa44cf156335df Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 16 Aug 2023 16:30:34 -0400 Subject: [PATCH 4/9] fix more warnings --- src/Wippersnapper.cpp | 18 +++++++++--------- src/components/pixels/ws_pixels.cpp | 4 ++-- src/components/pwm/ws_pwm.cpp | 2 ++ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/Wippersnapper.cpp b/src/Wippersnapper.cpp index 82756259c..aaef4dd11 100644 --- a/src/Wippersnapper.cpp +++ b/src/Wippersnapper.cpp @@ -346,6 +346,7 @@ bool Wippersnapper::configureDigitalPinReq( /*****************************************************************************/ bool cbDecodePinConfigMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) { + (void) field, arg; // marking unused parameters to avoid compiler warning bool is_success = true; WS_DEBUG_PRINTLN("cbDecodePinConfigMsg"); @@ -386,6 +387,7 @@ bool cbDecodePinConfigMsg(pb_istream_t *stream, const pb_field_t *field, bool cbDecodeDigitalPinWriteMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) { bool is_success = true; + (void) field, arg; // marking unused parameters to avoid compiler warning WS_DEBUG_PRINTLN("cbDecodeDigitalPinWriteMsg"); // Decode stream into a PinEvent @@ -417,6 +419,7 @@ bool cbDecodeDigitalPinWriteMsg(pb_istream_t *stream, const pb_field_t *field, */ /**************************************************************************/ bool cbSignalMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) { + (void) arg; // marking unused parameters to avoid compiler warning bool is_success = true; WS_DEBUG_PRINTLN("cbSignalMsg"); @@ -567,15 +570,11 @@ bool encodeI2CResponse(wippersnapper_signal_v1_I2CResponse *msgi2cResponse) { @brief Initializes an I2C bus component @param msgInitRequest A pointer to an i2c bus initialization message. - @param i2cPort - Desired I2C port to initialize. @return True if initialized successfully, False otherwise. */ /******************************************************************************************/ -bool initializeI2CBus(wippersnapper_i2c_v1_I2CBusInitRequest msgInitRequest, - int i2cPort) { - // TODO: i2cPort is not handled right now, we should add support for multiple - // i2c ports! +bool initializeI2CBus(wippersnapper_i2c_v1_I2CBusInitRequest msgInitRequest) { + // FUTURE TODO:we should add support for multiple i2c ports! if (WS._isI2CPort0Init) return true; // Initialize bus @@ -599,6 +598,7 @@ bool initializeI2CBus(wippersnapper_i2c_v1_I2CBusInitRequest msgInitRequest, /******************************************************************************************/ bool cbDecodeI2CDeviceInitRequestList(pb_istream_t *stream, const pb_field_t *field, void **arg) { + (void) field, arg; // marking unused parameters to avoid compiler warning WS_DEBUG_PRINTLN("EXEC: cbDecodeI2CDeviceInitRequestList"); // Decode stream into individual msgI2CDeviceInitRequest messages wippersnapper_i2c_v1_I2CDeviceInitRequest msgI2CDeviceInitRequest = @@ -616,7 +616,7 @@ bool cbDecodeI2CDeviceInitRequestList(pb_istream_t *stream, wippersnapper_signal_v1_I2CResponse_resp_i2c_device_init_tag; // Check I2C bus - if (!initializeI2CBus(msgI2CDeviceInitRequest.i2c_bus_init_req, 0)) { + if (!initializeI2CBus(msgI2CDeviceInitRequest.i2c_bus_init_req)) { WS_DEBUG_PRINTLN("ERROR: Failed to initialize I2C Bus"); msgi2cResponse.payload.resp_i2c_device_init.bus_response = WS._i2cPort0->getBusStatus(); @@ -687,7 +687,7 @@ bool cbDecodeSignalRequestI2C(pb_istream_t *stream, const pb_field_t *field, wippersnapper_i2c_v1_I2CBusScanResponse_init_zero; // Check I2C bus - if (!initializeI2CBus(msgScanReq.bus_init_request, 0)) { + if (!initializeI2CBus(msgScanReq.bus_init_request)) { WS_DEBUG_PRINTLN("ERROR: Failed to initialize I2C Bus"); msgi2cResponse.payload.resp_i2c_scan.bus_response = WS._i2cPort0->getBusStatus(); @@ -756,7 +756,7 @@ bool cbDecodeSignalRequestI2C(pb_istream_t *stream, const pb_field_t *field, wippersnapper_signal_v1_I2CResponse_resp_i2c_device_init_tag; // Check I2C bus - if (!initializeI2CBus(msgI2CDeviceInitRequest.i2c_bus_init_req, 0)) { + if (!initializeI2CBus(msgI2CDeviceInitRequest.i2c_bus_init_req)) { WS_DEBUG_PRINTLN("ERROR: Failed to initialize I2C Bus"); msgi2cResponse.payload.resp_i2c_device_init.bus_response = WS._i2cPort0->getBusStatus(); diff --git a/src/components/pixels/ws_pixels.cpp b/src/components/pixels/ws_pixels.cpp index 2d21ac836..daf663f49 100644 --- a/src/components/pixels/ws_pixels.cpp +++ b/src/components/pixels/ws_pixels.cpp @@ -34,7 +34,7 @@ strand_s strands[MAX_PIXEL_STRANDS]{ /**************************************************************************/ ws_pixels::~ws_pixels() { // de-allocate all strands - for (int i = 0; i < sizeof(strands) / sizeof(strands[0]); i++) + for (size_t i = 0; i < sizeof(strands) / sizeof(strands[0]); i++) deallocateStrand(i); } @@ -338,7 +338,7 @@ bool ws_pixels::addStrand( /**************************************************************************/ int ws_pixels::getStrandIdx(int16_t dataPin, wippersnapper_pixels_v1_PixelsType type) { - for (int16_t strandIdx = 0; strandIdx < sizeof(strands) / sizeof(strands[0]); + for (size_t strandIdx = 0; strandIdx < sizeof(strands) / sizeof(strands[0]); strandIdx++) { if (type == wippersnapper_pixels_v1_PixelsType_PIXELS_TYPE_NEOPIXEL && strands[strandIdx].pinNeoPixel == dataPin) diff --git a/src/components/pwm/ws_pwm.cpp b/src/components/pwm/ws_pwm.cpp index ce6f3c074..ef7203f32 100644 --- a/src/components/pwm/ws_pwm.cpp +++ b/src/components/pwm/ws_pwm.cpp @@ -53,6 +53,8 @@ bool ws_pwm::attach(uint8_t pin, double freq, uint8_t resolution) { uint8_t rc = _ledcMgr->attachPin(pin, freq, resolution); if (rc == LEDC_CH_ERR) is_attached = false; +#else +(void) pin; // marking as unused parameter to avoid compiler warning #endif return is_attached; // always true on non-esp32 } From ba2ce0ac9be5e95d7759e4bf7f9d26f8a8e185fc Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 16 Aug 2023 16:34:32 -0400 Subject: [PATCH 5/9] revert --- src/Wippersnapper.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Wippersnapper.cpp b/src/Wippersnapper.cpp index aaef4dd11..ad0cd98b4 100644 --- a/src/Wippersnapper.cpp +++ b/src/Wippersnapper.cpp @@ -346,7 +346,7 @@ bool Wippersnapper::configureDigitalPinReq( /*****************************************************************************/ bool cbDecodePinConfigMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) { - (void) field, arg; // marking unused parameters to avoid compiler warning + (void) field; // marking unused parameters to avoid compiler warning bool is_success = true; WS_DEBUG_PRINTLN("cbDecodePinConfigMsg"); @@ -387,7 +387,7 @@ bool cbDecodePinConfigMsg(pb_istream_t *stream, const pb_field_t *field, bool cbDecodeDigitalPinWriteMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) { bool is_success = true; - (void) field, arg; // marking unused parameters to avoid compiler warning + (void) field; // marking unused parameters to avoid compiler warning WS_DEBUG_PRINTLN("cbDecodeDigitalPinWriteMsg"); // Decode stream into a PinEvent @@ -598,7 +598,7 @@ bool initializeI2CBus(wippersnapper_i2c_v1_I2CBusInitRequest msgInitRequest) { /******************************************************************************************/ bool cbDecodeI2CDeviceInitRequestList(pb_istream_t *stream, const pb_field_t *field, void **arg) { - (void) field, arg; // marking unused parameters to avoid compiler warning + (void) field; // marking unused parameters to avoid compiler warning WS_DEBUG_PRINTLN("EXEC: cbDecodeI2CDeviceInitRequestList"); // Decode stream into individual msgI2CDeviceInitRequest messages wippersnapper_i2c_v1_I2CDeviceInitRequest msgI2CDeviceInitRequest = From a8bd7c4aeb49a189769b184a590720a3253f904d Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 16 Aug 2023 16:55:43 -0400 Subject: [PATCH 6/9] marking more --- src/Wippersnapper.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Wippersnapper.cpp b/src/Wippersnapper.cpp index ad0cd98b4..afe9119c2 100644 --- a/src/Wippersnapper.cpp +++ b/src/Wippersnapper.cpp @@ -347,6 +347,7 @@ bool Wippersnapper::configureDigitalPinReq( bool cbDecodePinConfigMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) { (void) field; // marking unused parameters to avoid compiler warning + (void) arg; // marking unused parameters to avoid compiler warning bool is_success = true; WS_DEBUG_PRINTLN("cbDecodePinConfigMsg"); @@ -388,6 +389,7 @@ bool cbDecodeDigitalPinWriteMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) { bool is_success = true; (void) field; // marking unused parameters to avoid compiler warning + (void) arg; // marking unused parameters to avoid compiler warning WS_DEBUG_PRINTLN("cbDecodeDigitalPinWriteMsg"); // Decode stream into a PinEvent @@ -599,6 +601,7 @@ bool initializeI2CBus(wippersnapper_i2c_v1_I2CBusInitRequest msgInitRequest) { bool cbDecodeI2CDeviceInitRequestList(pb_istream_t *stream, const pb_field_t *field, void **arg) { (void) field; // marking unused parameters to avoid compiler warning + (void) arg; // marking unused parameters to avoid compiler warning WS_DEBUG_PRINTLN("EXEC: cbDecodeI2CDeviceInitRequestList"); // Decode stream into individual msgI2CDeviceInitRequest messages wippersnapper_i2c_v1_I2CDeviceInitRequest msgI2CDeviceInitRequest = @@ -664,6 +667,7 @@ bool cbDecodeI2CDeviceInitRequestList(pb_istream_t *stream, bool cbDecodeSignalRequestI2C(pb_istream_t *stream, const pb_field_t *field, void **arg) { bool is_success = true; + (void) arg; // marking unused parameter to avoid compiler warning WS_DEBUG_PRINTLN("cbDecodeSignalRequestI2C"); // Create I2C Response wippersnapper_signal_v1_I2CResponse msgi2cResponse = @@ -904,6 +908,7 @@ void cbSignalI2CReq(char *data, uint16_t len) { bool cbDecodeServoMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) { WS_DEBUG_PRINTLN("Decoding Servo Message..."); + (void) arg; // marking unused parameter to avoid compiler warning if (field->tag == wippersnapper_signal_v1_ServoRequest_servo_attach_tag) { WS_DEBUG_PRINTLN("GOT: Servo Attach"); // Attempt to decode contents of servo_attach message @@ -1082,6 +1087,7 @@ void cbServoMsg(char *data, uint16_t len) { /******************************************************************************************/ bool cbPWMDecodeMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) { WS_DEBUG_PRINTLN("Decoding PWM Message..."); + (void) arg; // marking unused parameter to avoid compiler warning if (field->tag == wippersnapper_signal_v1_PWMRequest_attach_request_tag) { WS_DEBUG_PRINTLN("GOT: PWM Pin Attach"); // Attempt to decode contents of PWM attach message @@ -1286,6 +1292,7 @@ void cbPWMMsg(char *data, uint16_t len) { /******************************************************************************************/ bool cbDecodeDs18x20Msg(pb_istream_t *stream, const pb_field_t *field, void **arg) { + (void) arg; // marking unused parameter to avoid compiler warning if (field->tag == wippersnapper_signal_v1_Ds18x20Request_req_ds18x20_init_tag) { WS_DEBUG_PRINTLN("[Message Type] Init. DS Sensor"); @@ -1373,6 +1380,7 @@ void cbSignalDSReq(char *data, uint16_t len) { /******************************************************************************************/ bool cbDecodePixelsMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) { + (void) arg; // marking unused parameter to avoid compiler warning if (field->tag == wippersnapper_signal_v1_PixelsRequest_req_pixels_create_tag) { WS_DEBUG_PRINTLN( @@ -1528,6 +1536,7 @@ void cbRegistrationStatus(char *data, uint16_t len) { */ /**************************************************************************/ void cbErrorTopic(char *errorData, uint16_t len) { + (void) len; // marking unused parameter to avoid compiler warning WS_DEBUG_PRINT("IO Ban Error: "); WS_DEBUG_PRINTLN(errorData); // Disconnect client from broker @@ -1558,6 +1567,7 @@ void cbErrorTopic(char *errorData, uint16_t len) { */ /**************************************************************************/ void cbThrottleTopic(char *throttleData, uint16_t len) { + (void) len; // marking unused parameter to avoid compiler warning WS_DEBUG_PRINT("IO Throttle Error: "); WS_DEBUG_PRINTLN(throttleData); char *throttleMessage; From 528130b04e94d08bd624ac6913144107cfc96f3d Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 16 Aug 2023 17:04:19 -0400 Subject: [PATCH 7/9] clang-format --- src/Wippersnapper.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Wippersnapper.cpp b/src/Wippersnapper.cpp index afe9119c2..d9ce6a619 100644 --- a/src/Wippersnapper.cpp +++ b/src/Wippersnapper.cpp @@ -346,8 +346,8 @@ bool Wippersnapper::configureDigitalPinReq( /*****************************************************************************/ bool cbDecodePinConfigMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) { - (void) field; // marking unused parameters to avoid compiler warning - (void) arg; // marking unused parameters to avoid compiler warning + (void)field; // marking unused parameters to avoid compiler warning + (void)arg; // marking unused parameters to avoid compiler warning bool is_success = true; WS_DEBUG_PRINTLN("cbDecodePinConfigMsg"); @@ -388,8 +388,8 @@ bool cbDecodePinConfigMsg(pb_istream_t *stream, const pb_field_t *field, bool cbDecodeDigitalPinWriteMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) { bool is_success = true; - (void) field; // marking unused parameters to avoid compiler warning - (void) arg; // marking unused parameters to avoid compiler warning + (void)field; // marking unused parameters to avoid compiler warning + (void)arg; // marking unused parameters to avoid compiler warning WS_DEBUG_PRINTLN("cbDecodeDigitalPinWriteMsg"); // Decode stream into a PinEvent @@ -421,7 +421,7 @@ bool cbDecodeDigitalPinWriteMsg(pb_istream_t *stream, const pb_field_t *field, */ /**************************************************************************/ bool cbSignalMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) { - (void) arg; // marking unused parameters to avoid compiler warning + (void)arg; // marking unused parameters to avoid compiler warning bool is_success = true; WS_DEBUG_PRINTLN("cbSignalMsg"); @@ -600,8 +600,8 @@ bool initializeI2CBus(wippersnapper_i2c_v1_I2CBusInitRequest msgInitRequest) { /******************************************************************************************/ bool cbDecodeI2CDeviceInitRequestList(pb_istream_t *stream, const pb_field_t *field, void **arg) { - (void) field; // marking unused parameters to avoid compiler warning - (void) arg; // marking unused parameters to avoid compiler warning + (void)field; // marking unused parameters to avoid compiler warning + (void)arg; // marking unused parameters to avoid compiler warning WS_DEBUG_PRINTLN("EXEC: cbDecodeI2CDeviceInitRequestList"); // Decode stream into individual msgI2CDeviceInitRequest messages wippersnapper_i2c_v1_I2CDeviceInitRequest msgI2CDeviceInitRequest = @@ -667,7 +667,7 @@ bool cbDecodeI2CDeviceInitRequestList(pb_istream_t *stream, bool cbDecodeSignalRequestI2C(pb_istream_t *stream, const pb_field_t *field, void **arg) { bool is_success = true; - (void) arg; // marking unused parameter to avoid compiler warning + (void)arg; // marking unused parameter to avoid compiler warning WS_DEBUG_PRINTLN("cbDecodeSignalRequestI2C"); // Create I2C Response wippersnapper_signal_v1_I2CResponse msgi2cResponse = @@ -908,7 +908,7 @@ void cbSignalI2CReq(char *data, uint16_t len) { bool cbDecodeServoMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) { WS_DEBUG_PRINTLN("Decoding Servo Message..."); - (void) arg; // marking unused parameter to avoid compiler warning + (void)arg; // marking unused parameter to avoid compiler warning if (field->tag == wippersnapper_signal_v1_ServoRequest_servo_attach_tag) { WS_DEBUG_PRINTLN("GOT: Servo Attach"); // Attempt to decode contents of servo_attach message @@ -1087,7 +1087,7 @@ void cbServoMsg(char *data, uint16_t len) { /******************************************************************************************/ bool cbPWMDecodeMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) { WS_DEBUG_PRINTLN("Decoding PWM Message..."); - (void) arg; // marking unused parameter to avoid compiler warning + (void)arg; // marking unused parameter to avoid compiler warning if (field->tag == wippersnapper_signal_v1_PWMRequest_attach_request_tag) { WS_DEBUG_PRINTLN("GOT: PWM Pin Attach"); // Attempt to decode contents of PWM attach message @@ -1292,7 +1292,7 @@ void cbPWMMsg(char *data, uint16_t len) { /******************************************************************************************/ bool cbDecodeDs18x20Msg(pb_istream_t *stream, const pb_field_t *field, void **arg) { - (void) arg; // marking unused parameter to avoid compiler warning + (void)arg; // marking unused parameter to avoid compiler warning if (field->tag == wippersnapper_signal_v1_Ds18x20Request_req_ds18x20_init_tag) { WS_DEBUG_PRINTLN("[Message Type] Init. DS Sensor"); @@ -1380,7 +1380,7 @@ void cbSignalDSReq(char *data, uint16_t len) { /******************************************************************************************/ bool cbDecodePixelsMsg(pb_istream_t *stream, const pb_field_t *field, void **arg) { - (void) arg; // marking unused parameter to avoid compiler warning + (void)arg; // marking unused parameter to avoid compiler warning if (field->tag == wippersnapper_signal_v1_PixelsRequest_req_pixels_create_tag) { WS_DEBUG_PRINTLN( @@ -1536,7 +1536,7 @@ void cbRegistrationStatus(char *data, uint16_t len) { */ /**************************************************************************/ void cbErrorTopic(char *errorData, uint16_t len) { - (void) len; // marking unused parameter to avoid compiler warning + (void)len; // marking unused parameter to avoid compiler warning WS_DEBUG_PRINT("IO Ban Error: "); WS_DEBUG_PRINTLN(errorData); // Disconnect client from broker @@ -1567,7 +1567,7 @@ void cbErrorTopic(char *errorData, uint16_t len) { */ /**************************************************************************/ void cbThrottleTopic(char *throttleData, uint16_t len) { - (void) len; // marking unused parameter to avoid compiler warning + (void)len; // marking unused parameter to avoid compiler warning WS_DEBUG_PRINT("IO Throttle Error: "); WS_DEBUG_PRINTLN(throttleData); char *throttleMessage; From c769a0d6895a0e7057fbe8f2d18433ff763995dd Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 16 Aug 2023 17:11:52 -0400 Subject: [PATCH 8/9] brentru fork for esp8266, wsign compare --- .github/workflows/build-clang-doxy.yml | 2 +- src/components/ds18x20/ws_ds18x20.cpp | 2 +- src/components/pwm/ws_pwm.cpp | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-clang-doxy.yml b/.github/workflows/build-clang-doxy.yml index 43f0b9ea1..2bdb7ec04 100644 --- a/.github/workflows/build-clang-doxy.yml +++ b/.github/workflows/build-clang-doxy.yml @@ -305,7 +305,7 @@ jobs: echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags) - uses: actions/checkout@v2 with: - repository: adafruit/ci-arduino + repository: brentru/ci-arduino path: ci - name: Install CI-Arduino run: bash ci/actions_install.sh diff --git a/src/components/ds18x20/ws_ds18x20.cpp b/src/components/ds18x20/ws_ds18x20.cpp index 50e26db9f..9673c96ef 100644 --- a/src/components/ds18x20/ws_ds18x20.cpp +++ b/src/components/ds18x20/ws_ds18x20.cpp @@ -135,7 +135,7 @@ bool ws_ds18x20::addDS18x20( void ws_ds18x20::deleteDS18x20( wippersnapper_ds18x20_v1_Ds18x20DeInitRequest *msgDS18x20DeinitReq) { // Loop thru vector of drivers to find the unique address - for (int idx = 0; idx < _ds18xDrivers.size(); idx++) { + for (size_t idx = 0; idx < _ds18xDrivers.size(); idx++) { if (strcmp(_ds18xDrivers[idx]->onewire_pin, msgDS18x20DeinitReq->onewire_pin) == 0) { WS_DEBUG_PRINT("Deleting OneWire instance on pin "); diff --git a/src/components/pwm/ws_pwm.cpp b/src/components/pwm/ws_pwm.cpp index ef7203f32..06c29ca35 100644 --- a/src/components/pwm/ws_pwm.cpp +++ b/src/components/pwm/ws_pwm.cpp @@ -48,13 +48,16 @@ ws_pwm::~ws_pwm() { _ledcMgr = nullptr; } */ /******************************************************************/ bool ws_pwm::attach(uint8_t pin, double freq, uint8_t resolution) { + // Future TODO: Maybe this function should be within #ifdef for ARCH_ESP32 bool is_attached = true; #if defined(ARDUINO_ARCH_ESP32) uint8_t rc = _ledcMgr->attachPin(pin, freq, resolution); if (rc == LEDC_CH_ERR) is_attached = false; #else -(void) pin; // marking as unused parameter to avoid compiler warning + (void)pin; // marking as unused parameter to avoid compiler warning + (void)freq; // marking as unused parameter to avoid compiler warning + (void)resolution; // marking as unused parameter to avoid compiler warning #endif return is_attached; // always true on non-esp32 } From ece56dde679ce8f841cd54af5df9a28d22f96783 Mon Sep 17 00:00:00 2001 From: brentru Date: Mon, 21 Aug 2023 13:33:04 -0400 Subject: [PATCH 9/9] add suggestions from Tyeth, src/components/i2c/WipperSnapper_I2C.cpp --- src/components/analogIO/Wippersnapper_AnalogIO.cpp | 2 +- src/components/ds18x20/ws_ds18x20.cpp | 4 ++-- src/components/i2c/WipperSnapper_I2C.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/analogIO/Wippersnapper_AnalogIO.cpp b/src/components/analogIO/Wippersnapper_AnalogIO.cpp index a6bc4ea57..56c5f6fce 100644 --- a/src/components/analogIO/Wippersnapper_AnalogIO.cpp +++ b/src/components/analogIO/Wippersnapper_AnalogIO.cpp @@ -329,7 +329,7 @@ void Wippersnapper_AnalogIO::update() { if (_analog_input_pins[i].enabled == true) { // Does the pin execute on-period? - if (millis() - _analog_input_pins[i].prvPeriod > + if ((long)millis() - _analog_input_pins[i].prvPeriod > _analog_input_pins[i].period && _analog_input_pins[i].period != 0L) { WS_DEBUG_PRINT("Executing periodic event on A"); diff --git a/src/components/ds18x20/ws_ds18x20.cpp b/src/components/ds18x20/ws_ds18x20.cpp index 9673c96ef..91360271d 100644 --- a/src/components/ds18x20/ws_ds18x20.cpp +++ b/src/components/ds18x20/ws_ds18x20.cpp @@ -30,7 +30,7 @@ ws_ds18x20::ws_ds18x20() {} /*************************************************************/ ws_ds18x20::~ws_ds18x20() { // delete DallasTemp sensors and release onewire buses - for (int idx = 0; idx < _ds18xDrivers.size(); idx++) { + for (size_t idx = 0; idx < _ds18xDrivers.size(); idx++) { delete _ds18xDrivers[idx]->dallasTempObj; delete _ds18xDrivers[idx]->oneWire; } @@ -185,7 +185,7 @@ void ws_ds18x20::update() { for (int i = 0; i < (*iter)->sensorPropertiesCount; i++) { // has sensor_period elapsed? if (curTime - (*iter)->sensorPeriodPrv > - (*iter)->sensorProperties[i].sensor_period) { + (long)(*iter)->sensorProperties[i].sensor_period) { // issue global temperature request to all DS sensors WS_DEBUG_PRINTLN("Requesting temperature.."); (*iter)->dallasTempObj->requestTemperatures(); diff --git a/src/components/i2c/WipperSnapper_I2C.cpp b/src/components/i2c/WipperSnapper_I2C.cpp index 64e4dba07..e3c1df77c 100644 --- a/src/components/i2c/WipperSnapper_I2C.cpp +++ b/src/components/i2c/WipperSnapper_I2C.cpp @@ -492,7 +492,7 @@ void WipperSnapper_Component_I2C::updateI2CDeviceProperties( uint16_t i2cAddress = (uint16_t)msgDeviceUpdateReq->i2c_device_address; // Loop thru vector of drivers to find the unique address - for (int i = 0; i < drivers.size(); i++) { + for (size_t i = 0; i < drivers.size(); i++) { if (drivers[i]->getI2CAddress() == i2cAddress) { // Update the properties of each driver for (int j = 0; j < msgDeviceUpdateReq->i2c_device_properties_count;