Skip to content

Commit

Permalink
Merge pull request #42 from klew/master
Browse files Browse the repository at this point in the history
warnings cleanup
  • Loading branch information
przemyslawzygmunt authored Aug 28, 2021
2 parents 9069a52 + d847ea5 commit b243652
Show file tree
Hide file tree
Showing 18 changed files with 42 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ steps:
webhook:
from_secret: slack_webhook
channel: github
username: drone
username: drone@supla-arduino

# here's the template :)
# notice that the repo endpoint is hardcoded to `https://github.com/`.
Expand Down
4 changes: 2 additions & 2 deletions src/SuplaDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ SuplaDeviceClass::SuplaDeviceClass()
connectionFailCounter(0),
networkIsNotReadyCounter(0),
currentStatus(STATUS_UNKNOWN),
clock(nullptr),
impl_arduino_status(nullptr) {
impl_arduino_status(nullptr),
clock(nullptr) {
srpc = NULL;
registered = 0;
lastIterateTime = 0;
Expand Down
5 changes: 3 additions & 2 deletions src/SuplaDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,18 @@ typedef void (*_impl_arduino_status)(int status, const char *msg);
class SuplaDeviceClass {
protected:
void *srpc;
char registered;
int8_t registered;
int port;
int connectionFailCounter;
int networkIsNotReadyCounter;

unsigned long lastIterateTime;
unsigned long waitForIterate;

_impl_arduino_status impl_arduino_status;
int currentStatus;

_impl_arduino_status impl_arduino_status;

Supla::Uptime uptime;
Supla::Clock *clock;

Expand Down
2 changes: 1 addition & 1 deletion src/supla/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace Supla {
unsigned long Channel::lastCommunicationTimeMs = 0;
TDS_SuplaRegisterDevice_E Channel::reg_dev;

Channel::Channel() : validityTimeSec(0), channelNumber(-1), valueChanged(false) {
Channel::Channel() : valueChanged(false), channelNumber(-1), validityTimeSec(0) {
if (reg_dev.channel_count < SUPLA_CHANNELMAXCOUNT) {
channelNumber = reg_dev.channel_count;

Expand Down
2 changes: 1 addition & 1 deletion src/supla/condition.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class Condition : public ActionHandler {
virtual bool condition(double val, bool isValid = true) = 0;

double threshold;
bool alreadyFired;
bool useAlternativeMeasurement;
bool alreadyFired;
Supla::ChannelElement *source;
Supla::ActionHandler *client;

Expand Down
1 change: 1 addition & 0 deletions src/supla/conditions/on_invalid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class OnInvalidCond : public Supla::Condition {
}

bool condition(double val, bool isValid) {
(void)(val);
return !isValid;
}

Expand Down
5 changes: 5 additions & 0 deletions src/supla/control/dimmer_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ void Supla::Control::DimmerBase::setRGBW(int red,
int colorBrightness,
int brightness,
bool toggle) {
(void)(red);
(void)(green);
(void)(blue);
(void)(colorBrightness);
Supla::Control::RGBWBase::setRGBW(0, 0, 0, 0, brightness, toggle);
}

Expand All @@ -44,5 +48,6 @@ void Supla::Control::DimmerBase::onSaveState() {
}

void Supla::Control::DimmerBase::iterateDimmerRGBW(int rgbStep, int wStep) {
(void)(rgbStep);
Supla::Control::RGBWBase::iterateDimmerRGBW(0, wStep);
}
5 changes: 5 additions & 0 deletions src/supla/control/dimmer_leds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ void Supla::Control::DimmerLeds::setRGBWValueOnDevice(uint32_t red,
uint32_t blue,
uint32_t colorBrightness,
uint32_t brightness) {
(void)(red);
(void)(green);
(void)(blue);
(void)(colorBrightness);

uint32_t brightnessAdj = brightness;

#ifdef ARDUINO_ARCH_AVR
Expand Down
4 changes: 2 additions & 2 deletions src/supla/control/internal_pin_output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ Supla::Control::InternalPinOutput::InternalPinOutput(int pin, bool highIsOn)
: pin(pin),
highIsOn(highIsOn),
stateOnInit(STATE_ON_INIT_OFF),
durationMs(0),
storedTurnOnDurationMs(0),
durationTimestamp(0),
durationMs(0) {
durationTimestamp(0) {
}

Supla::Control::InternalPinOutput &
Expand Down
1 change: 1 addition & 0 deletions src/supla/control/rgb_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ void Supla::Control::RGBBase::setRGBW(int red,
int colorBrightness,
int brightness,
bool toggle) {
(void)(brightness);
Supla::Control::RGBWBase::setRGBW(
red, green, blue, colorBrightness, 0, toggle);
}
Expand Down
1 change: 1 addition & 0 deletions src/supla/control/rgb_leds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ void Supla::Control::RGBLeds::setRGBWValueOnDevice(uint32_t red,
uint32_t blue,
uint32_t colorBrightness,
uint32_t brightness) {
(void)(brightness);
uint32_t redAdj = red * colorBrightness / 1023;
uint32_t greenAdj = green * colorBrightness / 1023;
uint32_t blueAdj = blue * colorBrightness / 1023;
Expand Down
8 changes: 6 additions & 2 deletions src/supla/correction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ double Supla::Correction::get(uint8_t channelNumber, bool forSecondaryValue) {
return 0;
}

Supla::Correction::Correction(uint8_t channelNumber, double correction, bool forSecondaryValue) :
channelNumber(channelNumber), correction(correction), forSecondaryValue(forSecondaryValue), next(nullptr) {
Supla::Correction::Correction(uint8_t channelNumber, double correction,
bool forSecondaryValue)
: next(nullptr),
channelNumber(channelNumber),
correction(correction),
forSecondaryValue(forSecondaryValue) {
if (first == nullptr) {
first = this;
} else {
Expand Down
2 changes: 2 additions & 0 deletions src/supla/network/esp_wifi.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,14 @@ class ESPWifi : public Supla::Network {
Serial.println(F(" dBm"));
},
WiFiEvent_t::SYSTEM_EVENT_STA_GOT_IP);
(void)(event_gotIP);

WiFiEventId_t event_disconnected = WiFi.onEvent(
[](WiFiEvent_t event, WiFiEventInfo_t info) {
Serial.println(F("wifi Station disconnected"));
},
WiFiEvent_t::SYSTEM_EVENT_STA_DISCONNECTED);
(void)(event_disconnected);
#endif
Serial.print(F("WiFi: establishing connection with SSID: \""));
Serial.print(ssid);
Expand Down
2 changes: 1 addition & 1 deletion src/supla/network/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void message_received(void *_srpc,
(void)(call_type);
(void)(proto_version);
TsrpcReceivedData rd;
char getDataResult;
int8_t getDataResult;

Network::Instance()->updateLastResponse();

Expand Down
4 changes: 2 additions & 2 deletions src/supla/pv/solaredge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ bool SolarEdge::iterateConnected(void *srpc) {
pvClient.setBufferSizes(2048, 512); //
#endif
pvClient.setInsecure();
int returnCode = 0;
if (returnCode = pvClient.connect("monitoringapi.solaredge.com", 443)) {
int returnCode = pvClient.connect("monitoringapi.solaredge.com", 443);
if (returnCode) {
retryCounter = 0;
dataFetchInProgress = true;
connectionTimeoutMs = lastReadTime;
Expand Down
8 changes: 4 additions & 4 deletions src/supla/sensor/Si7021_sonoff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
namespace Supla {
namespace Sensor {
Si7021Sonoff::Si7021Sonoff(int pin)
: temperature(TEMPERATURE_NOT_AVAILABLE),
: pin(pin),
temperature(TEMPERATURE_NOT_AVAILABLE),
humidity(HUMIDITY_NOT_AVAILABLE),
pin(pin),
retryCount(0) {
}

Expand Down Expand Up @@ -62,7 +62,7 @@ double Si7021Sonoff::readHumi(uint8_t* data) {
return humi;
}

bool Si7021Sonoff::read() {
void Si7021Sonoff::read() {
uint8_t data[5] = {0};

yield();
Expand Down Expand Up @@ -115,4 +115,4 @@ bool Si7021Sonoff::waitState(bool state) {
}

}; // namespace Sensor
}; // namespace Supla
}; // namespace Supla
4 changes: 2 additions & 2 deletions src/supla/sensor/Si7021_sonoff.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Si7021Sonoff : public ThermHygroMeter {
void onInit();
double readTemp(uint8_t* data);
double readHumi(uint8_t* data);
bool read();
void read();
bool waitState(bool state);

protected:
Expand All @@ -47,4 +47,4 @@ class Si7021Sonoff : public ThermHygroMeter {
}; // namespace Sensor
}; // namespace Supla

#endif
#endif
3 changes: 2 additions & 1 deletion src/supla/storage/eeprom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ using namespace Supla;

Eeprom::Eeprom(unsigned int storageStartingOffset, int reservedSize)
: Storage(storageStartingOffset),
dataChanged(false), reservedSize(reservedSize) {
reservedSize(reservedSize),
dataChanged(false) {
setStateSavePeriod((unsigned long)SUPLA_EEPROM_WRITING_PERIOD);
}

Expand Down

0 comments on commit b243652

Please sign in to comment.