Sanitize code

This commit is contained in:
Theo Arends 2019-11-20 20:53:12 +01:00
parent 02db6b632f
commit 7777fa08b0
17 changed files with 32 additions and 32 deletions

View File

@ -391,7 +391,7 @@ char* NoAlNumToUnderscore(char* dest, const char* source)
return dest; return dest;
} }
char IndexSeparator() char IndexSeparator(void)
{ {
/* /*
// 20 bytes more costly !?! // 20 bytes more costly !?!
@ -414,7 +414,7 @@ void SetShortcutDefault(void)
} }
} }
uint8_t Shortcut() uint8_t Shortcut(void)
{ {
uint8_t result = 10; uint8_t result = 10;
@ -921,7 +921,7 @@ int ResponseJsonEndEnd(void)
* GPIO Module and Template management * GPIO Module and Template management
\*********************************************************************************************/ \*********************************************************************************************/
uint8_t ModuleNr() uint8_t ModuleNr(void)
{ {
// 0 = User module (255) // 0 = User module (255)
// 1 up = Template module 0 up // 1 up = Template module 0 up
@ -953,7 +953,7 @@ String AnyModuleName(uint32_t index)
} }
} }
String ModuleName() String ModuleName(void)
{ {
return AnyModuleName(Settings.module); return AnyModuleName(Settings.module);
} }
@ -985,7 +985,7 @@ void ModuleGpios(myio *gp)
// AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t *)gp, sizeof(myio)); // AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t *)gp, sizeof(myio));
} }
gpio_flag ModuleFlag() gpio_flag ModuleFlag(void)
{ {
gpio_flag flag; gpio_flag flag;
@ -1005,7 +1005,7 @@ void ModuleDefault(uint32_t module)
memcpy_P(&Settings.user_template, &kModules[module], sizeof(mytmplt)); memcpy_P(&Settings.user_template, &kModules[module], sizeof(mytmplt));
} }
void SetModuleType() void SetModuleType(void)
{ {
my_module_type = (USER_MODULE == Settings.module) ? Settings.user_template_base : Settings.module; my_module_type = (USER_MODULE == Settings.module) ? Settings.user_template_base : Settings.module;
} }
@ -1033,7 +1033,7 @@ bool ValidGPIO(uint32_t pin, uint32_t gpio)
return (GPIO_USER == ValidPin(pin, gpio)); // Only allow GPIO_USER pins return (GPIO_USER == ValidPin(pin, gpio)); // Only allow GPIO_USER pins
} }
bool ValidAdc() bool ValidAdc(void)
{ {
gpio_flag flag = ModuleFlag(); gpio_flag flag = ModuleFlag();
uint32_t template_adc0 = flag.data &15; uint32_t template_adc0 = flag.data &15;
@ -1133,7 +1133,7 @@ bool JsonTemplate(const char* dataBuf)
return true; return true;
} }
void TemplateJson() void TemplateJson(void)
{ {
Response_P(PSTR("{\"" D_JSON_NAME "\":\"%s\",\"" D_JSON_GPIO "\":["), Settings.user_template.name); Response_P(PSTR("{\"" D_JSON_NAME "\":\"%s\",\"" D_JSON_GPIO "\":["), Settings.user_template.name);
for (uint32_t i = 0; i < sizeof(Settings.user_template.gp); i++) { for (uint32_t i = 0; i < sizeof(Settings.user_template.gp); i++) {

View File

@ -217,7 +217,7 @@ void WifiBegin(uint8_t flag, uint8_t channel)
#endif // LWIP_IPV6=1 #endif // LWIP_IPV6=1
} }
void WifiBeginAfterScan() void WifiBeginAfterScan(void)
{ {
static int8_t best_network_db; static int8_t best_network_db;
@ -314,12 +314,12 @@ void WifiBeginAfterScan()
} }
} }
uint16_t WifiLinkCount() uint16_t WifiLinkCount(void)
{ {
return Wifi.link_count; return Wifi.link_count;
} }
String WifiDowntime() String WifiDowntime(void)
{ {
return GetDuration(Wifi.downtime); return GetDuration(Wifi.downtime);
} }

View File

@ -1661,7 +1661,7 @@ void setup(void)
XsnsCall(FUNC_INIT); XsnsCall(FUNC_INIT);
} }
static void BacklogLoop() void BacklogLoop(void)
{ {
if (TimeReached(backlog_delay)) { if (TimeReached(backlog_delay)) {
if (!BACKLOG_EMPTY && !backlog_mutex) { if (!BACKLOG_EMPTY && !backlog_mutex) {

View File

@ -730,7 +730,7 @@ void _WSContentSend(const String& content) // Low level sendContent for a
DEBUG_CORE_LOG(PSTR("WEB: Chunk size %d"), len); DEBUG_CORE_LOG(PSTR("WEB: Chunk size %d"), len);
} }
void WSContentFlush() void WSContentFlush(void)
{ {
if (Web.chunk_buffer.length() > 0) { if (Web.chunk_buffer.length() > 0) {
_WSContentSend(Web.chunk_buffer); // Flush chunk buffer _WSContentSend(Web.chunk_buffer); // Flush chunk buffer

View File

@ -468,7 +468,7 @@ void MqttPublishPowerState(uint32_t device)
#endif // USE_SONOFF_IFAN #endif // USE_SONOFF_IFAN
} }
void MqttPublishAllPowerState() void MqttPublishAllPowerState(void)
{ {
for (uint32_t i = 1; i <= devices_present; i++) { for (uint32_t i = 1; i <= devices_present; i++) {
MqttPublishPowerState(i); MqttPublishPowerState(i);
@ -493,7 +493,7 @@ void MqttPublishPowerBlinkState(uint32_t device)
/*********************************************************************************************/ /*********************************************************************************************/
uint16_t MqttConnectCount() uint16_t MqttConnectCount(void)
{ {
return Mqtt.connect_count; return Mqtt.connect_count;
} }

View File

@ -430,7 +430,7 @@ void EnergyMqttShow(void)
} }
#endif // USE_ENERGY_MARGIN_DETECTION #endif // USE_ENERGY_MARGIN_DETECTION
void EnergyEverySecond() void EnergyEverySecond(void)
{ {
// Overtemp check // Overtemp check
if (global_update) { if (global_update) {

View File

@ -66,7 +66,7 @@ IRrecv *irrecv = nullptr;
unsigned long ir_lasttime = 0; unsigned long ir_lasttime = 0;
void IrReceiveUpdateThreshold() void IrReceiveUpdateThreshold(void)
{ {
if (irrecv != nullptr) { if (irrecv != nullptr) {
if (Settings.param[P_IR_UNKNOW_THRESHOLD] < 6) { Settings.param[P_IR_UNKNOW_THRESHOLD] = 6; } if (Settings.param[P_IR_UNKNOW_THRESHOLD] < 6) { Settings.param[P_IR_UNKNOW_THRESHOLD] = 6; }

View File

@ -92,7 +92,7 @@ IRrecv *irrecv = nullptr;
unsigned long ir_lasttime = 0; unsigned long ir_lasttime = 0;
void IrReceiveUpdateThreshold() void IrReceiveUpdateThreshold(void)
{ {
if (irrecv != nullptr) { if (irrecv != nullptr) {
if (Settings.param[P_IR_UNKNOW_THRESHOLD] < 6) { Settings.param[P_IR_UNKNOW_THRESHOLD] = 6; } if (Settings.param[P_IR_UNKNOW_THRESHOLD] < 6) { Settings.param[P_IR_UNKNOW_THRESHOLD] = 6; }

View File

@ -80,7 +80,7 @@ int DomoticzRssiQuality(void)
} }
#ifdef USE_SONOFF_IFAN #ifdef USE_SONOFF_IFAN
void MqttPublishDomoticzFanState() void MqttPublishDomoticzFanState(void)
{ {
if (Settings.flag.mqtt_enabled && Settings.domoticz_relay_idx[1]) { // SetOption3 - Enable MQTT if (Settings.flag.mqtt_enabled && Settings.domoticz_relay_idx[1]) { // SetOption3 - Enable MQTT
char svalue[8]; // Fanspeed value char svalue[8]; // Fanspeed value
@ -94,7 +94,7 @@ void MqttPublishDomoticzFanState()
} }
} }
void DomoticzUpdateFanState() void DomoticzUpdateFanState(void)
{ {
if (domoticz_update_flag) { if (domoticz_update_flag) {
MqttPublishDomoticzFanState(); MqttPublishDomoticzFanState();

View File

@ -1226,7 +1226,7 @@ float evaluateExpression(const char * expression, unsigned int len)
#endif // USE_EXPRESSION #endif // USE_EXPRESSION
#ifdef SUPPORT_IF_STATEMENT #ifdef SUPPORT_IF_STATEMENT
void CmndIf() void CmndIf(void)
{ {
if (XdrvMailbox.data_len > 0) { if (XdrvMailbox.data_len > 0) {
char parameters[XdrvMailbox.data_len+1]; char parameters[XdrvMailbox.data_len+1];

View File

@ -43,7 +43,7 @@ bool ifan_restart_flag = true;
/*********************************************************************************************/ /*********************************************************************************************/
bool IsModuleIfan() bool IsModuleIfan(void)
{ {
return ((SONOFF_IFAN02 == my_module_type) || (SONOFF_IFAN03 == my_module_type)); return ((SONOFF_IFAN02 == my_module_type) || (SONOFF_IFAN03 == my_module_type));
} }

View File

@ -72,7 +72,7 @@ void Pcf8574SwitchRelay(void)
} }
} }
void Pcf8574Init() void Pcf8574Init(void)
{ {
uint8_t pcf8574_address = PCF8574_ADDR1; uint8_t pcf8574_address = PCF8574_ADDR1;
while ((Pcf8574.max_devices < MAX_PCF8574) && (pcf8574_address < PCF8574_ADDR2 +8)) { while ((Pcf8574.max_devices < MAX_PCF8574) && (pcf8574_address < PCF8574_ADDR2 +8)) {
@ -178,7 +178,7 @@ void HandlePcf8574(void)
WSContentStop(); WSContentStop();
} }
void Pcf8574SaveSettings() void Pcf8574SaveSettings(void)
{ {
char stemp[7]; char stemp[7];
char tmp[100]; char tmp[100];

View File

@ -47,7 +47,7 @@ extern uint8_t *buffer;
/*********************************************************************************************/ /*********************************************************************************************/
void SSD1306InitDriver() void SSD1306InitDriver(void)
{ {
if (!Settings.display_model) { if (!Settings.display_model) {
if (I2cSetDevice(OLED_ADDRESS1)) { if (I2cSetDevice(OLED_ADDRESS1)) {

View File

@ -185,7 +185,7 @@ void Ade7953GetData(void)
} }
} }
void Ade7953EnergyEverySecond() void Ade7953EnergyEverySecond(void)
{ {
if (Ade7953.init_step) { if (Ade7953.init_step) {
if (1 == Ade7953.init_step) { if (1 == Ade7953.init_step) {

View File

@ -201,7 +201,7 @@ uint16_t solaxX1_calculateCRC(uint8_t *bExternTxPackage, uint8_t bLen)
return wChkSum; return wChkSum;
} }
void solaxX1_SendInverterAddress() void solaxX1_SendInverterAddress(void)
{ {
source[0] = 0x00; source[0] = 0x00;
destination[0] = 0x00; destination[0] = 0x00;
@ -213,7 +213,7 @@ void solaxX1_SendInverterAddress()
solaxX1_RS485Send(24); solaxX1_RS485Send(24);
} }
void solaxX1_QueryLiveData() void solaxX1_QueryLiveData(void)
{ {
source[0] = 0x01; source[0] = 0x01;
destination[0] = 0x00; destination[0] = 0x00;

View File

@ -101,7 +101,7 @@ void AdcEvery250ms(void)
} }
#endif // USE_RULES #endif // USE_RULES
uint16_t AdcGetLux() uint16_t AdcGetLux(void)
{ {
int adc = AdcRead(2); int adc = AdcRead(2);
// Source: https://www.allaboutcircuits.com/projects/design-a-luxmeter-using-a-light-dependent-resistor/ // Source: https://www.allaboutcircuits.com/projects/design-a-luxmeter-using-a-light-dependent-resistor/

View File

@ -90,7 +90,7 @@ bool HxIsReady(uint16_t timeout)
return (digitalRead(Hx.pin_dout) == LOW); return (digitalRead(Hx.pin_dout) == LOW);
} }
long HxRead() long HxRead(void)
{ {
if (!HxIsReady(HX_TIMEOUT)) { return -1; } if (!HxIsReady(HX_TIMEOUT)) { return -1; }
@ -241,7 +241,7 @@ bool HxCommand(void)
/*********************************************************************************************/ /*********************************************************************************************/
long HxWeight() long HxWeight(void)
{ {
return (Hx.calibrate_step < HX_CAL_FAIL) ? Hx.weight : 0; return (Hx.calibrate_step < HX_CAL_FAIL) ? Hx.weight : 0;
} }
@ -371,7 +371,7 @@ void HxEvery100mSecond(void)
} }
} }
void HxSaveBeforeRestart() void HxSaveBeforeRestart(void)
{ {
Settings.energy_frequency_calibration = Hx.weight; Settings.energy_frequency_calibration = Hx.weight;
Hx.sample_count = HX_SAMPLES +1; // Stop updating Hx.weight Hx.sample_count = HX_SAMPLES +1; // Stop updating Hx.weight