Skip to content

Commit

Permalink
[PIO build] Change all empty function calls into (void)
Browse files Browse the repository at this point in the history
  • Loading branch information
TD-er committed Dec 20, 2019
1 parent 0863059 commit d4ab1c7
Show file tree
Hide file tree
Showing 189 changed files with 3,925 additions and 3,925 deletions.
36 changes: 18 additions & 18 deletions src/Command.ino
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ bool checkNrArguments(const char *cmd, const char *Line, int nrArguments) {
} else {
parameter = parseStringKeepCase(Line, i + 1);
}
done = parameter.length() == 0;
done = parameter.length(void) == 0;
if (!done) {
if (i <= nrArguments) {
if (Settings.TolerantLastArgParse() && i == nrArguments) {
if (Settings.TolerantLastArgParse(void) && i == nrArguments) {
log += F(" (fixed)");
}
log += F(" Arg");
Expand All @@ -77,15 +77,15 @@ bool checkNrArguments(const char *cmd, const char *Line, int nrArguments) {
log += '_';
addLog(LOG_LEVEL_ERROR, log);

if (!Settings.TolerantLastArgParse()) {
if (!Settings.TolerantLastArgParse(void)) {
log = F("Command not executed!");
} else {
log = F("Command executed, but may fail.");
}
log += F(" See: https://github.com/letscontrolit/ESPEasy/issues/2724");
addLog(LOG_LEVEL_ERROR, log);
}
if (Settings.TolerantLastArgParse()) {
if (Settings.TolerantLastArgParse(void)) {
return true;
}
return false;
Expand All @@ -101,13 +101,13 @@ bool executeInternalCommand(const char *cmd, struct EventStruct *event, const ch
String cmd_lc;

cmd_lc = cmd;
cmd_lc.toLowerCase();
cmd_lc.toLowerCase(void);
// Simple macro to match command to function call.
#define COMMAND_CASE(S, C, NARGS) \
if (strcmp_P(cmd_lc.c_str(), \
if (strcmp_P(cmd_lc.c_str(void), \
PSTR(S)) == 0) \
{ if (!checkNrArguments(cmd, line, NARGS)) { \
status = return_incorrect_nr_arguments(); return false;} \
status = return_incorrect_nr_arguments(void); return false;} \
else status = C (event, line); return true;}

// FIXME TD-er: Should we execute command when number of arguments is wrong?
Expand Down Expand Up @@ -321,7 +321,7 @@ bool ExecuteCommand(taskIndex_t taskIndex, byte source, const char *Line, bool t
String cmd;

if (!GetArgv(Line, cmd, 1)) {
SendStatus(source, return_command_failed());
SendStatus(source, return_command_failed(void));
return false;
}

Expand All @@ -342,7 +342,7 @@ bool ExecuteCommand(taskIndex_t taskIndex, byte source, const char *Line, bool t
TempEvent.Source = source;

String action(Line);
action = parseTemplate(action, action.length()); // parseTemplate before executing the command
action = parseTemplate(action, action.length(void)); // parseTemplate before executing the command

// Split the arguments into Par1...5 of the event.
// Do not split it in executeInternalCommand, since that one will be called from the scheduler with pre-set events.
Expand Down Expand Up @@ -379,8 +379,8 @@ bool ExecuteCommand(taskIndex_t taskIndex, byte source, const char *Line, bool t

if (tryInternal) {
String status;
bool handled = executeInternalCommand(cmd.c_str(), &TempEvent, action.c_str(), status);
if (status.length() > 0) {
bool handled = executeInternalCommand(cmd.c_str(void), &TempEvent, action.c_str(void), status);
if (status.length(void) > 0) {
delay(0);
SendStatus(source, status);
delay(0);
Expand All @@ -404,13 +404,13 @@ bool ExecuteCommand(taskIndex_t taskIndex, byte source, const char *Line, bool t
}
}
if (handled) {
SendStatus(source, return_command_success());
SendStatus(source, return_command_success(void));
return true;
}
}
if (tryRemoteConfig) {
if (remoteConfig(&TempEvent, action)) {
SendStatus(source, return_command_success());
SendStatus(source, return_command_success(void));
return true;
}
}
Expand All @@ -427,7 +427,7 @@ bool ExecuteCommand(taskIndex_t taskIndex, byte source, const char *Line, bool t
void printDirectory(File dir, int numTabs)
{
while (true) {
File entry = dir.openNextFile();
File entry = dir.openNextFile(void);

if (!entry) {
// no more files
Expand All @@ -437,17 +437,17 @@ void printDirectory(File dir, int numTabs)
for (uint8_t i = 0; i < numTabs; i++) {
serialPrint("\t");
}
serialPrint(entry.name());
serialPrint(entry.name(void));

if (entry.isDirectory()) {
if (entry.isDirectory(void)) {
serialPrintln("/");
printDirectory(entry, numTabs + 1);
} else {
// files have sizes, directories do not
serialPrint("\t\t");
serialPrintln(String(entry.size(), DEC));
serialPrintln(String(entry.size(void), DEC));
}
entry.close();
entry.close(void);
}
}

Expand Down
90 changes: 45 additions & 45 deletions src/Controller.ino
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ void sendData(struct EventStruct *event)
delayBackground(delayms);
// unsigned long timer = millis() + delayms;
// unsigned long timer = millis(void) + delayms;
// while (!timeOutReached(timer))
// backgroundtasks();
// backgroundtasks(void);
}
}
*/
Expand Down Expand Up @@ -76,7 +76,7 @@ void sendData(struct EventStruct *event)
String dummy;
PluginCall(PLUGIN_EVENT_OUT, event, dummy);
}
lastSend = millis();
lastSend = millis(void);
STOP_TIMER(SEND_DATA_STATS);
}

Expand Down Expand Up @@ -108,7 +108,7 @@ bool validUserVar(struct EventStruct *event) {
// handle MQTT messages
void callback(char *c_topic, byte *b_payload, unsigned int length) {
statusLED(true);
int enabledMqttController = firstEnabledMQTTController();
int enabledMqttController = firstEnabledMQTTController(void);

if (enabledMqttController < 0) {
addLog(LOG_LEVEL_ERROR, F("MQTT : No enabled MQTT controller"));
Expand Down Expand Up @@ -152,13 +152,13 @@ void callback(char *c_topic, byte *b_payload, unsigned int length) {
/*********************************************************************************************\
* Disconnect from MQTT message broker
\*********************************************************************************************/
void MQTTDisconnect()
void MQTTDisconnect(void)
{
if (MQTTclient.connected()) {
MQTTclient.disconnect();
if (MQTTclient.connected(void)) {
MQTTclient.disconnect(void);
addLog(LOG_LEVEL_INFO, F("MQTT : Disconnected from broker"));
}
updateMQTTclient_connected();
updateMQTTclient_connected(void);
}

/*********************************************************************************************\
Expand All @@ -174,18 +174,18 @@ bool MQTTConnect(int controller_idx)
return false;
}

if (MQTTclient.connected()) {
MQTTclient.disconnect();
if (MQTTclient.connected(void)) {
MQTTclient.disconnect(void);
}
updateMQTTclient_connected();
mqtt = WiFiClient(); // workaround see: https://github.com/esp8266/Arduino/issues/4497#issuecomment-373023864
updateMQTTclient_connected(void);
mqtt = WiFiClient(void); // workaround see: https://github.com/esp8266/Arduino/issues/4497#issuecomment-373023864
mqtt.setTimeout(ControllerSettings.ClientTimeout);
MQTTclient.setClient(mqtt);

if (ControllerSettings.UseDNS) {
MQTTclient.setServer(ControllerSettings.getHost().c_str(), ControllerSettings.Port);
MQTTclient.setServer(ControllerSettings.getHost(void).c_str(void), ControllerSettings.Port);
} else {
MQTTclient.setServer(ControllerSettings.getIP(), ControllerSettings.Port);
MQTTclient.setServer(ControllerSettings.getIP(void), ControllerSettings.Port);
}
MQTTclient.setCallback(callback);

Expand All @@ -202,11 +202,11 @@ bool MQTTConnect(int controller_idx)
}
else {
clientid = F("ESPClient_");
clientid += WiFi.macAddress();
clientid += WiFi.macAddress(void);
}
clientid.replace(' ', '_'); // Make sure no spaces are present in the client ID

if ((wifi_reconnects >= 1) && Settings.uniqueMQTTclientIdReconnect()) {
if ((wifi_reconnects >= 1) && Settings.uniqueMQTTclientIdReconnect(void)) {
// Work-around for 'lost connections' to the MQTT broker.
// If the broker thinks the connection is still alive, a reconnect from the
// client will be refused.
Expand All @@ -218,7 +218,7 @@ bool MQTTConnect(int controller_idx)

String LWTTopic = ControllerSettings.MQTTLwtTopic;

if (LWTTopic.length() == 0)
if (LWTTopic.length(void) == 0)
{
LWTTopic = ControllerSettings.Subscribe;
LWTTopic += F("/LWT");
Expand All @@ -228,14 +228,14 @@ bool MQTTConnect(int controller_idx)

String LWTMessageConnect = ControllerSettings.LWTMessageConnect;

if (LWTMessageConnect.length() == 0) {
if (LWTMessageConnect.length(void) == 0) {
LWTMessageConnect = F(DEFAULT_MQTT_LWT_CONNECT_MESSAGE);
}
parseSystemVariables(LWTMessageConnect, false);

String LWTMessageDisconnect = ControllerSettings.LWTMessageDisconnect;

if (LWTMessageDisconnect.length() == 0) {
if (LWTMessageDisconnect.length(void) == 0) {
LWTMessageDisconnect = F(DEFAULT_MQTT_LWT_DISCONNECT_MESSAGE);
}
parseSystemVariables(LWTMessageDisconnect, false);
Expand All @@ -247,45 +247,45 @@ bool MQTTConnect(int controller_idx)

if ((SecuritySettings.ControllerUser[controller_idx] != 0) && (SecuritySettings.ControllerPassword[controller_idx] != 0)) {
MQTTresult =
MQTTclient.connect(clientid.c_str(),
MQTTclient.connect(clientid.c_str(void),
SecuritySettings.ControllerUser[controller_idx],
SecuritySettings.ControllerPassword[controller_idx],
LWTTopic.c_str(),
LWTTopic.c_str(void),
willQos,
willRetain,
LWTMessageDisconnect.c_str(),
LWTMessageDisconnect.c_str(void),
cleanSession);
} else {
MQTTresult = MQTTclient.connect(clientid.c_str(),
MQTTresult = MQTTclient.connect(clientid.c_str(void),
nullptr,
nullptr,
LWTTopic.c_str(),
LWTTopic.c_str(void),
willQos,
willRetain,
LWTMessageDisconnect.c_str(),
LWTMessageDisconnect.c_str(void),
cleanSession);
}
delay(0);

byte controller_number = Settings.Protocol[controller_idx];
count_connection_results(MQTTresult, F("MQTT : Broker "), controller_number, ControllerSettings);
if (!MQTTresult) {
MQTTclient.disconnect();
updateMQTTclient_connected();
MQTTclient.disconnect(void);
updateMQTTclient_connected(void);
return false;
}
String log = F("MQTT : Connected to broker with client ID: ");
log += clientid;
addLog(LOG_LEVEL_INFO, log);
String subscribeTo = ControllerSettings.Subscribe;
parseSystemVariables(subscribeTo, false);
MQTTclient.subscribe(subscribeTo.c_str());
MQTTclient.subscribe(subscribeTo.c_str(void));
log = F("Subscribed to: ");
log += subscribeTo;
addLog(LOG_LEVEL_INFO, log);

if (MQTTclient.publish(LWTTopic.c_str(), LWTMessageConnect.c_str(), 1)) {
updateMQTTclient_connected();
if (MQTTclient.publish(LWTTopic.c_str(void), LWTMessageConnect.c_str(void), 1)) {
updateMQTTclient_connected(void);
statusLED(true);
mqtt_reconnect_count = 0;

Expand All @@ -309,7 +309,7 @@ bool MQTTCheck(int controller_idx)

if (Protocol[ProtocolIndex].usesMQTT)
{
if (MQTTclient_should_reconnect || !MQTTclient.connected())
if (MQTTclient_should_reconnect || !MQTTclient.connected(void))
{
if (MQTTclient_should_reconnect) {
addLog(LOG_LEVEL_ERROR, F("MQTT : Intentional reconnect"));
Expand Down Expand Up @@ -377,42 +377,42 @@ bool MQTTpublish(int controller_idx, const char *topic, const char *payload, boo
MQTT_queue_element dummy_element(MQTT_queue_element(controller_idx, "", "", retained));
if (MQTTDelayHandler.queueFull(dummy_element)) {
// The queue is full, try to make some room first.
addLog(LOG_LEVEL_DEBUG, F("MQTT : Extra processMQTTdelayQueue()"));
processMQTTdelayQueue();
addLog(LOG_LEVEL_DEBUG, F("MQTT : Extra processMQTTdelayQueue(void)"));
processMQTTdelayQueue(void);
}
}
const bool success = MQTTDelayHandler.addToQueue(MQTT_queue_element(controller_idx, topic, payload, retained));

scheduleNextMQTTdelayQueue();
scheduleNextMQTTdelayQueue(void);
return success;
}

void scheduleNextMQTTdelayQueue() {
scheduleNextDelayQueue(TIMER_MQTT_DELAY_QUEUE, MQTTDelayHandler.getNextScheduleTime());
void scheduleNextMQTTdelayQueue(void) {
scheduleNextDelayQueue(TIMER_MQTT_DELAY_QUEUE, MQTTDelayHandler.getNextScheduleTime(void));
}

void processMQTTdelayQueue() {
void processMQTTdelayQueue(void) {
START_TIMER;
MQTT_queue_element *element(MQTTDelayHandler.getNext());
MQTT_queue_element *element(MQTTDelayHandler.getNext(void));

if (element == NULL) { return; }

if (MQTTclient.publish(element->_topic.c_str(), element->_payload.c_str(), element->_retained)) {
if (MQTTclient.publish(element->_topic.c_str(void), element->_payload.c_str(void), element->_retained)) {
MQTTDelayHandler.markProcessed(true);
} else {
MQTTDelayHandler.markProcessed(false);
#ifndef BUILD_NO_DEBUG

if (loglevelActiveFor(LOG_LEVEL_DEBUG)) {
String log = F("MQTT : process MQTT queue not published, ");
log += MQTTDelayHandler.sendQueue.size();
log += MQTTDelayHandler.sendQueue.size(void);
log += F(" items left in queue");
addLog(LOG_LEVEL_DEBUG, log);
}
#endif // ifndef BUILD_NO_DEBUG
}
setIntervalTimerOverride(TIMER_MQTT, 10); // Make sure the MQTT is being processed as soon as possible.
scheduleNextMQTTdelayQueue();
scheduleNextMQTTdelayQueue(void);
STOP_TIMER(MQTT_DELAY_QUEUE);
}

Expand All @@ -421,15 +421,15 @@ void processMQTTdelayQueue() {
\*********************************************************************************************/
void MQTTStatus(const String& status)
{
int enabledMqttController = firstEnabledMQTTController();
int enabledMqttController = firstEnabledMQTTController(void);

if (enabledMqttController >= 0) {
MakeControllerSettings(ControllerSettings);
LoadControllerSettings(enabledMqttController, ControllerSettings);
String pubname = ControllerSettings.Subscribe;
pubname.replace(F("/#"), F("/status"));
parseSystemVariables(pubname, false);
MQTTpublish(enabledMqttController, pubname.c_str(), status.c_str(), Settings.MQTTRetainFlag);
MQTTpublish(enabledMqttController, pubname.c_str(void), status.c_str(void), Settings.MQTTRetainFlag);
}
}
#endif //USES_MQTT
Expand All @@ -439,7 +439,7 @@ void MQTTStatus(const String& status)
/*********************************************************************************************\
* send all sensordata
\*********************************************************************************************/
// void SensorSendAll()
// void SensorSendAll(void)
// {
// for (taskIndex_t x = 0; x < TASKS_MAX; x++)
// {
Expand Down Expand Up @@ -494,7 +494,7 @@ void SensorSendTask(taskIndex_t TaskIndex)
formula.replace(F("%pvalue%"), String(preValue[varNr]));
formula.replace(F("%value%"), String(UserVar[varIndex + varNr]));
float result = 0;
byte error = Calculate(formula.c_str(), &result);
byte error = Calculate(formula.c_str(void), &result);
if (error == 0)
UserVar[varIndex + varNr] = result;
}
Expand Down
Loading

0 comments on commit d4ab1c7

Please sign in to comment.