Skip to content

Commit

Permalink
Merge pull request #474 from brentru/fix-esp8266-warnings
Browse files Browse the repository at this point in the history
Fix ESP8266 Compiler Warnings
  • Loading branch information
brentru committed Aug 21, 2023
2 parents d5e9a70 + ece56dd commit c44beb9
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-clang-doxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
28 changes: 19 additions & 9 deletions src/Wippersnapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +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
bool is_success = true;
WS_DEBUG_PRINTLN("cbDecodePinConfigMsg");

Expand Down Expand Up @@ -386,6 +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
WS_DEBUG_PRINTLN("cbDecodeDigitalPinWriteMsg");

// Decode stream into a PinEvent
Expand Down Expand Up @@ -417,6 +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
bool is_success = true;
WS_DEBUG_PRINTLN("cbSignalMsg");

Expand Down Expand Up @@ -567,15 +572,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
Expand All @@ -599,6 +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
WS_DEBUG_PRINTLN("EXEC: cbDecodeI2CDeviceInitRequestList");
// Decode stream into individual msgI2CDeviceInitRequest messages
wippersnapper_i2c_v1_I2CDeviceInitRequest msgI2CDeviceInitRequest =
Expand All @@ -616,7 +619,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();
Expand Down Expand Up @@ -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 =
Expand All @@ -687,7 +691,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();
Expand Down Expand Up @@ -756,7 +760,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();
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/components/analogIO/Wippersnapper_AnalogIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
6 changes: 3 additions & 3 deletions src/components/ds18x20/ws_ds18x20.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 ");
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/components/i2c/WipperSnapper_I2C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,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;
Expand Down
Loading

0 comments on commit c44beb9

Please sign in to comment.