From 03c9e3868c5489b75e23915189f32cd500a7307e Mon Sep 17 00:00:00 2001 From: Luc <8822552+luc-github@users.noreply.github.com> Date: Sun, 23 Aug 2020 09:52:17 +0200 Subject: [PATCH] removes heretic functions... apply astyle --- esp3d/src/core/esp3doutput.cpp | 15 ++++++++---- esp3d/src/core/espcmd/ESP410.cpp | 4 +++- esp3d/src/core/espcmd/ESP420.cpp | 23 +++++++++++++------ esp3d/src/core/hal.cpp | 11 --------- esp3d/src/core/hal.h | 2 -- esp3d/src/core/settings_esp3d.cpp | 7 ------ esp3d/src/core/settings_esp3d.h | 2 -- .../authentication/authentication_service.cpp | 10 -------- .../authentication/authentication_service.h | 2 -- .../src/modules/devices/devices_services.cpp | 8 ------- esp3d/src/modules/devices/devices_services.h | 2 -- esp3d/src/modules/ethernet/ethconfig.cpp | 8 ------- esp3d/src/modules/ethernet/ethconfig.h | 2 -- .../src/modules/filesystem/esp_filesystem.cpp | 10 -------- esp3d/src/modules/filesystem/esp_filesystem.h | 2 -- esp3d/src/modules/filesystem/esp_globalFS.cpp | 10 -------- esp3d/src/modules/filesystem/esp_globalFS.h | 2 -- esp3d/src/modules/filesystem/esp_sd.cpp | 10 -------- esp3d/src/modules/filesystem/esp_sd.h | 2 -- esp3d/src/modules/http/http_server.cpp | 8 ------- esp3d/src/modules/http/http_server.h | 2 -- esp3d/src/modules/network/netconfig.cpp | 8 ------- esp3d/src/modules/network/netconfig.h | 2 -- esp3d/src/modules/network/netservices.cpp | 7 ------ esp3d/src/modules/network/netservices.h | 2 -- esp3d/src/modules/wifi/wificonfig.cpp | 8 ------- esp3d/src/modules/wifi/wificonfig.h | 2 -- 27 files changed, 30 insertions(+), 141 deletions(-) diff --git a/esp3d/src/core/esp3doutput.cpp b/esp3d/src/core/esp3doutput.cpp index a6d0afee..4e35fd29 100644 --- a/esp3d/src/core/esp3doutput.cpp +++ b/esp3d/src/core/esp3doutput.cpp @@ -45,12 +45,19 @@ uint8_t ESP3DOutput::_outputflags = ESP_ALL_CLIENTS; #endif //DISPLAY_DEVICE //tool function to avoid string corrupt JSON files -const char * encodeString(const char * s){ +const char * encodeString(const char * s) +{ static String tmp; tmp = s; - while(tmp.indexOf("'")!=-1)tmp.replace("'", "'"); - while(tmp.indexOf("\"")!=-1)tmp.replace("\"", """); - if (tmp =="") tmp=" "; + while(tmp.indexOf("'")!=-1) { + tmp.replace("'", "'"); + } + while(tmp.indexOf("\"")!=-1) { + tmp.replace("\"", """); + } + if (tmp =="") { + tmp=" "; + } return tmp.c_str(); } diff --git a/esp3d/src/core/espcmd/ESP410.cpp b/esp3d/src/core/espcmd/ESP410.cpp index 042de5d9..7888abdc 100644 --- a/esp3d/src/core/espcmd/ESP410.cpp +++ b/esp3d/src/core/espcmd/ESP410.cpp @@ -62,7 +62,9 @@ bool Commands::ESP410(const char* cmd_params, level_authenticate_type auth_type, if (!plain) { output->print ("{\"SSID\":\""); output->print (encodeString(WiFi.SSID (i).c_str())); - } else output->print (WiFi.SSID (i).c_str()); + } else { + output->print (WiFi.SSID (i).c_str()); + } if (!plain) { output->print ("\",\"SIGNAL\":\""); } else { diff --git a/esp3d/src/core/espcmd/ESP420.cpp b/esp3d/src/core/espcmd/ESP420.cpp index 49ea6d63..e29d49ea 100644 --- a/esp3d/src/core/espcmd/ESP420.cpp +++ b/esp3d/src/core/espcmd/ESP420.cpp @@ -341,9 +341,12 @@ bool Commands::ESP420(const char* cmd_params, level_authenticate_type auth_type, } else { output->print (": "); } - if (!plain)output->print (encodeString(NetConfig::hostname())); - else output->print (NetConfig::hostname()); - + if (!plain) { + output->print (encodeString(NetConfig::hostname())); + } else { + output->print (NetConfig::hostname()); + } + if (!plain) { output->print ("\"}"); } else { @@ -731,8 +734,11 @@ bool Commands::ESP420(const char* cmd_params, level_authenticate_type auth_type, output->print (": "); } if (WiFi.isConnected()) { - if (!plain) output->print (encodeString(WiFi.SSID().c_str())); - else output->print (WiFi.SSID().c_str()); + if (!plain) { + output->print (encodeString(WiFi.SSID().c_str())); + } else { + output->print (WiFi.SSID().c_str()); + } } if (!plain) { output->print ("\"}"); @@ -913,8 +919,11 @@ bool Commands::ESP420(const char* cmd_params, level_authenticate_type auth_type, } else { output->print (": "); } - if (!plain)output->print (encodeString(WiFiConfig::AP_SSID())); - else output->print (WiFiConfig::AP_SSID()); + if (!plain) { + output->print (encodeString(WiFiConfig::AP_SSID())); + } else { + output->print (WiFiConfig::AP_SSID()); + } if (!plain) { output->print ("\"}"); } else { diff --git a/esp3d/src/core/hal.cpp b/esp3d/src/core/hal.cpp index 9331624d..b8ebbc74 100644 --- a/esp3d/src/core/hal.cpp +++ b/esp3d/src/core/hal.cpp @@ -43,17 +43,6 @@ int ChannelAttached2Pin[16]= {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; uint32_t Hal::_analogWriteRange = 255; uint32_t Hal::_analogWriteFreq = 1000; -//Contructor -Hal::Hal() -{ - -} - -//Destructor -Hal::~Hal() -{ -} - void Hal::clearAnalogChannels() { #ifdef ARDUINO_ARCH_ESP32 diff --git a/esp3d/src/core/hal.h b/esp3d/src/core/hal.h index 376f9c9f..3ece54a9 100644 --- a/esp3d/src/core/hal.h +++ b/esp3d/src/core/hal.h @@ -35,8 +35,6 @@ class Hal { public: - Hal(); - ~Hal(); static bool begin(); static void end(); static void wait (uint32_t milliseconds); diff --git a/esp3d/src/core/settings_esp3d.cpp b/esp3d/src/core/settings_esp3d.cpp index bdbeb493..fe8c5838 100644 --- a/esp3d/src/core/settings_esp3d.cpp +++ b/esp3d/src/core/settings_esp3d.cpp @@ -174,13 +174,6 @@ const uint8_t DEFAULT_ADDRESS_VALUE[] = {0, 0, 0, 0}; uint8_t Settings_ESP3D::_FirmwareTarget = UNKNOWN_FW; bool Settings_ESP3D::_SDdevice = ESP_NO_SD; -Settings_ESP3D::Settings_ESP3D() -{ -} -Settings_ESP3D::~Settings_ESP3D() -{ -} - bool Settings_ESP3D::begin() { if(GetSettingsVersion() == -1) { diff --git a/esp3d/src/core/settings_esp3d.h b/esp3d/src/core/settings_esp3d.h index 6002e9e0..8041300b 100644 --- a/esp3d/src/core/settings_esp3d.h +++ b/esp3d/src/core/settings_esp3d.h @@ -102,8 +102,6 @@ class Settings_ESP3D { public: - Settings_ESP3D(); - ~Settings_ESP3D(); static bool begin(); static uint8_t get_default_byte_value(int pos); static uint32_t get_default_int32_value(int pos); diff --git a/esp3d/src/modules/authentication/authentication_service.cpp b/esp3d/src/modules/authentication/authentication_service.cpp index 24cf1a32..9716bbe1 100644 --- a/esp3d/src/modules/authentication/authentication_service.cpp +++ b/esp3d/src/modules/authentication/authentication_service.cpp @@ -47,16 +47,6 @@ uint8_t AuthenticationService::_current_nb_ip = 0; #define MAX_AUTH_IP 10 //#define ALLOW_MULTIPLE_SESSIONS -AuthenticationService::AuthenticationService() -{ -} -AuthenticationService::~AuthenticationService() -{ -#if defined (HTTP_FEATURE) && defined (AUTHENTICATION_FEATURE) - end(); -#endif //HTTP_FEATURE && AUTHENTICATION_FEATURE -} - //check authentification level_authenticate_type AuthenticationService::authenticated_level(const char * pwd) { diff --git a/esp3d/src/modules/authentication/authentication_service.h b/esp3d/src/modules/authentication/authentication_service.h index 420a16a6..81cbeefb 100644 --- a/esp3d/src/modules/authentication/authentication_service.h +++ b/esp3d/src/modules/authentication/authentication_service.h @@ -58,8 +58,6 @@ typedef void Authwebserver; class AuthenticationService { public: - AuthenticationService(); - ~AuthenticationService(); static level_authenticate_type authenticated_level(const char * pwd = nullptr); #ifdef AUTHENTICATION_FEATURE static bool begin(Authwebserver * webserver); diff --git a/esp3d/src/modules/devices/devices_services.cpp b/esp3d/src/modules/devices/devices_services.cpp index d7853c8b..885cb588 100644 --- a/esp3d/src/modules/devices/devices_services.cpp +++ b/esp3d/src/modules/devices/devices_services.cpp @@ -45,14 +45,6 @@ bool DevicesServices::_started = false; -DevicesServices::DevicesServices() -{ -} -DevicesServices::~DevicesServices() -{ - end(); -} - bool DevicesServices::begin() { bool res = true; diff --git a/esp3d/src/modules/devices/devices_services.h b/esp3d/src/modules/devices/devices_services.h index 25670965..22df871d 100644 --- a/esp3d/src/modules/devices/devices_services.h +++ b/esp3d/src/modules/devices/devices_services.h @@ -27,8 +27,6 @@ class DevicesServices { public: - DevicesServices(); - ~DevicesServices(); static bool begin(); static void end(); static void handle(); diff --git a/esp3d/src/modules/ethernet/ethconfig.cpp b/esp3d/src/modules/ethernet/ethconfig.cpp index d1d4d907..a02dca94 100644 --- a/esp3d/src/modules/ethernet/ethconfig.cpp +++ b/esp3d/src/modules/ethernet/ethconfig.cpp @@ -32,14 +32,6 @@ #include "ethconfig.h" bool EthConfig::_started = false; const uint8_t DEFAULT_AP_MASK_VALUE[] = {255, 255, 255, 0}; -EthConfig::EthConfig() -{ -} - -EthConfig::~EthConfig() -{ - end(); -} bool EthConfig::StartSTA() { diff --git a/esp3d/src/modules/ethernet/ethconfig.h b/esp3d/src/modules/ethernet/ethconfig.h index ef825cff..50f1bf81 100644 --- a/esp3d/src/modules/ethernet/ethconfig.h +++ b/esp3d/src/modules/ethernet/ethconfig.h @@ -32,8 +32,6 @@ class EthConfig { public: - EthConfig(); - ~EthConfig(); static bool begin(); static bool StartSTA(); //static bool StartSRV(); diff --git a/esp3d/src/modules/filesystem/esp_filesystem.cpp b/esp3d/src/modules/filesystem/esp_filesystem.cpp index 75c46597..04ece8d7 100644 --- a/esp3d/src/modules/filesystem/esp_filesystem.cpp +++ b/esp3d/src/modules/filesystem/esp_filesystem.cpp @@ -31,16 +31,6 @@ File tFile_handle[ESP_MAX_OPENHANDLE]; bool ESP_FileSystem::_started = false; -//constructor -ESP_FileSystem::ESP_FileSystem() -{ -} - -//destructor -ESP_FileSystem::~ESP_FileSystem() -{ -} - //helper to format size to readable string String & ESP_FileSystem::formatBytes (uint64_t bytes) { diff --git a/esp3d/src/modules/filesystem/esp_filesystem.h b/esp3d/src/modules/filesystem/esp_filesystem.h index 6436147e..6f478ef5 100644 --- a/esp3d/src/modules/filesystem/esp_filesystem.h +++ b/esp3d/src/modules/filesystem/esp_filesystem.h @@ -65,8 +65,6 @@ class ESP_FileSystem { public: static String & formatBytes (uint64_t bytes); - ESP_FileSystem(); - ~ESP_FileSystem(); static bool begin(); static void end(); static size_t totalBytes(); diff --git a/esp3d/src/modules/filesystem/esp_globalFS.cpp b/esp3d/src/modules/filesystem/esp_globalFS.cpp index bf4fef05..98bf84bd 100644 --- a/esp3d/src/modules/filesystem/esp_globalFS.cpp +++ b/esp3d/src/modules/filesystem/esp_globalFS.cpp @@ -42,16 +42,6 @@ bool ESP_GBFS::isavailable(uint8_t FS) uint8_t ESP_GBFS::_nbFS = 0; String ESP_GBFS::_rootlist[MAX_FS]; -//constructor -ESP_GBFS::ESP_GBFS() -{ - _nbFS = 0; -} - -//destructor -ESP_GBFS::~ESP_GBFS() -{ -} //helper to format size to readable string String & ESP_GBFS::formatBytes (uint64_t bytes) diff --git a/esp3d/src/modules/filesystem/esp_globalFS.h b/esp3d/src/modules/filesystem/esp_globalFS.h index 448e75e3..79ab6b01 100644 --- a/esp3d/src/modules/filesystem/esp_globalFS.h +++ b/esp3d/src/modules/filesystem/esp_globalFS.h @@ -80,8 +80,6 @@ private: class ESP_GBFS { public: - ESP_GBFS(); - ~ESP_GBFS(); static bool isavailable(uint8_t FS); static uint64_t totalBytes(uint8_t FS); static uint64_t usedBytes(uint8_t FS); diff --git a/esp3d/src/modules/filesystem/esp_sd.cpp b/esp3d/src/modules/filesystem/esp_sd.cpp index 5e994ce1..c0a14d7d 100644 --- a/esp3d/src/modules/filesystem/esp_sd.cpp +++ b/esp3d/src/modules/filesystem/esp_sd.cpp @@ -49,16 +49,6 @@ uint8_t ESP_SD::setState(uint8_t flag) } -//constructor -ESP_SD::ESP_SD() -{ -} - -//destructor -ESP_SD::~ESP_SD() -{ -} - void ESP_SD::handle() { diff --git a/esp3d/src/modules/filesystem/esp_sd.h b/esp3d/src/modules/filesystem/esp_sd.h index 5e31e3f6..62f0ab63 100644 --- a/esp3d/src/modules/filesystem/esp_sd.h +++ b/esp3d/src/modules/filesystem/esp_sd.h @@ -66,8 +66,6 @@ class ESP_SD { public: static String & formatBytes (uint64_t bytes); - ESP_SD(); - ~ESP_SD(); static bool begin(); static void handle(); static void end(); diff --git a/esp3d/src/modules/http/http_server.cpp b/esp3d/src/modules/http/http_server.cpp index 9a97b684..e7a549df 100644 --- a/esp3d/src/modules/http/http_server.cpp +++ b/esp3d/src/modules/http/http_server.cpp @@ -42,14 +42,6 @@ uint16_t HTTP_Server::_port = 0; WEBSERVER * HTTP_Server::_webserver = nullptr; uint8_t HTTP_Server::_upload_status = UPLOAD_STATUS_NONE; -HTTP_Server::HTTP_Server() -{ -} -HTTP_Server::~HTTP_Server() -{ - end(); -} - void HTTP_Server::init_handlers() { _webserver->on("/",HTTP_ANY, handle_root); diff --git a/esp3d/src/modules/http/http_server.h b/esp3d/src/modules/http/http_server.h index 3c989068..5e609eee 100644 --- a/esp3d/src/modules/http/http_server.h +++ b/esp3d/src/modules/http/http_server.h @@ -45,8 +45,6 @@ typedef enum { class HTTP_Server { public: - HTTP_Server(); - ~HTTP_Server(); static bool begin(); static void end(); static void handle(); diff --git a/esp3d/src/modules/network/netconfig.cpp b/esp3d/src/modules/network/netconfig.cpp index 15ea79c5..4dc0cf13 100644 --- a/esp3d/src/modules/network/netconfig.cpp +++ b/esp3d/src/modules/network/netconfig.cpp @@ -49,14 +49,6 @@ bool NetConfig::_needReconnect2AP = false; bool NetConfig::_events_registered = false; bool NetConfig::_started = false; uint8_t NetConfig::_mode = ESP_RADIO_OFF; -NetConfig::NetConfig() -{ -} - -NetConfig::~NetConfig() -{ - //end(); -} //just simple helper to convert mac address to string char * NetConfig::mac2str (uint8_t mac [8]) diff --git a/esp3d/src/modules/network/netconfig.h b/esp3d/src/modules/network/netconfig.h index 2091567c..aff5b8c6 100644 --- a/esp3d/src/modules/network/netconfig.h +++ b/esp3d/src/modules/network/netconfig.h @@ -57,8 +57,6 @@ class NetConfig { public: - NetConfig(); - ~NetConfig(); static bool isValidIP(const char * string); static bool isHostnameValid (const char * hostname); static uint32_t IP_int_from_string(const char * s); diff --git a/esp3d/src/modules/network/netservices.cpp b/esp3d/src/modules/network/netservices.cpp index 854f0c04..f5e2803f 100644 --- a/esp3d/src/modules/network/netservices.cpp +++ b/esp3d/src/modules/network/netservices.cpp @@ -74,13 +74,6 @@ DNSServer dnsServer; #endif //CAMERA_DEVICE bool NetServices::_started = false; bool NetServices::_restart = false; -NetServices::NetServices() -{ -} -NetServices::~NetServices() -{ - end(); -} bool NetServices::begin() { diff --git a/esp3d/src/modules/network/netservices.h b/esp3d/src/modules/network/netservices.h index 45d5e166..641ce505 100644 --- a/esp3d/src/modules/network/netservices.h +++ b/esp3d/src/modules/network/netservices.h @@ -27,8 +27,6 @@ class NetServices { public: - NetServices(); - ~NetServices(); static bool begin(); static void end(); static void handle(); diff --git a/esp3d/src/modules/wifi/wificonfig.cpp b/esp3d/src/modules/wifi/wificonfig.cpp index b32abfe3..b8bffee9 100644 --- a/esp3d/src/modules/wifi/wificonfig.cpp +++ b/esp3d/src/modules/wifi/wificonfig.cpp @@ -32,14 +32,6 @@ const uint8_t DEFAULT_AP_MASK_VALUE[] = {255, 255, 255, 0}; -WiFiConfig::WiFiConfig() -{ -} - -WiFiConfig::~WiFiConfig() -{ - end(); -} /** * Check if SSID string is valid diff --git a/esp3d/src/modules/wifi/wificonfig.h b/esp3d/src/modules/wifi/wificonfig.h index fafacb13..ea333f6a 100644 --- a/esp3d/src/modules/wifi/wificonfig.h +++ b/esp3d/src/modules/wifi/wificonfig.h @@ -53,8 +53,6 @@ class WiFiConfig { public: - WiFiConfig(); - ~WiFiConfig(); static bool isPasswordValid (const char * password); static bool isSSIDValid (const char * ssid); static bool StartAP();