Skip to content

Commit

Permalink
Merge pull request #2917 from TD-er/cleanup/use_pluginhelper_include
Browse files Browse the repository at this point in the history
[Cleanup] Include _Plugin_Helper.h in all plugin INO files
  • Loading branch information
TD-er committed Mar 4, 2020
2 parents 589b955 + 8b8de9d commit cde4c93
Show file tree
Hide file tree
Showing 101 changed files with 214 additions and 64 deletions.
10 changes: 5 additions & 5 deletions platformio_esp82xx_base.ini
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ build_flags = ${esp82xx_1M_OTA.build_flags} -DESP8285
[esp8266_2M256]
extends = esp82xx_common
board = esp12e
board_build.flash_mode = dio
board_build.flash_mode = dout
board_upload.maximum_size = 1044464
build_flags = -Wl,-Tesp8266.flash.2m256.ld
${esp82xx_common.build_flags}

[espWroom2M]
extends = esp82xx_common
board = esp12e
board_build.flash_mode = dio
board_build.flash_mode = dout
board_upload.maximum_size = 1044464
build_flags = -Wl,-Tesp8266.flash.2m.ld
${esp82xx_common.build_flags}
Expand All @@ -186,15 +186,15 @@ build_flags = -Wl,-Tesp8266.flash.2m256.ld
[esp8266_4M1M]
extends = esp82xx_common
board = esp12e
board_build.flash_mode = dio
board_build.flash_mode = dout
board_upload.maximum_size = 1044464
build_flags = -Wl,-Tesp8266.flash.4m1m.ld
${esp82xx_common.build_flags}

[esp8266_4M2M]
extends = esp82xx_common
board = esp12e
board_build.flash_mode = dio
board_build.flash_mode = dout
board_upload.maximum_size = 1044464
build_flags = -Wl,-Tesp8266.flash.4m2m.ld
${esp82xx_common.build_flags}
Expand All @@ -212,7 +212,7 @@ build_flags = -Wl,-Tesp8266.flash.4m2m.ld
[esp8266_16M]
extends = esp82xx_common
board = esp12e
board_build.flash_mode = dio
board_build.flash_mode = dout
board_upload.maximum_size = 1044464
build_flags = -Wl,-Tesp8266.flash.16m14m.ld
-DSPIFFS_MAX_OPEN_FILES=20
Expand Down
7 changes: 1 addition & 6 deletions src/Controller.ino
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,7 @@ bool MQTTConnect(controllerIndex_t controller_idx)
String clientid;

if (Settings.MQTTUseUnitNameAsClientId) {
clientid = Settings.Name;

if (Settings.Unit != 0) { // only append non-zero unit number
clientid += '_';
clientid += Settings.Unit;
}
clientid = Settings.getHostname();
}
else {
clientid = F("ESPClient_");
Expand Down
9 changes: 2 additions & 7 deletions src/ESPEasyWifi.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#define WIFI_ALLOW_AP_AFTERBOOT_PERIOD 5 // in minutes

#include "src/Globals/ESPEasyWiFiEvent.h"
#include "ESPEasy-Globals.h"

// ********************************************************************************
// WiFi state
Expand Down Expand Up @@ -510,13 +511,7 @@ bool WifiIsSTA(WiFiMode_t wifimode)
// ********************************************************************************
String WifiGetAPssid()
{
String ssid(Settings.Name);

if (Settings.appendUnitToHostname()) {
ssid += "_";
ssid += Settings.Unit;
}
return ssid;
return Settings.getHostname();
}

// ********************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion src/Misc.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2705,7 +2705,7 @@ void ArduinoOTAInit()
checkRAM(F("ArduinoOTAInit"));

ArduinoOTA.setPort(ARDUINO_OTA_PORT);
ArduinoOTA.setHostname(Settings.Name);
ArduinoOTA.setHostname(Settings.getHostname().c_str());
if (SecuritySettings.Password[0]!=0)
ArduinoOTA.setPassword(SecuritySettings.Password);

Expand Down
2 changes: 1 addition & 1 deletion src/StringProvider.ino
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ String getValue(LabelType::Enum label) {
switch (label)
{
case LabelType::UNIT_NR: return String(Settings.Unit);
case LabelType::UNIT_NAME: return String(Settings.Name);
case LabelType::UNIT_NAME: return String(Settings.Name); // Only return the set name, no appended unit.
case LabelType::HOST_NAME:
#ifdef ESP32
return WiFi.getHostname();
Expand Down
2 changes: 1 addition & 1 deletion src/WebServer_I2C_Scanner.ino
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ String getKnownI2Cdevice(byte address) {
result = F("PCF8574A,OLED");
break;
case 0x40:
result = F("SI7021,HTU21D,INA219,PCA9685");
result = F("SI7021,HTU21D,INA219,PCA9685,HDC1080");
break;
case 0x41:
case 0x42:
Expand Down
4 changes: 2 additions & 2 deletions src/_N001_Email.ino
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ boolean NPlugin_001_send(const NotificationSettingsStruct& notificationsettings,
int pos_less = email_address.indexOf('<');
if (pos_less == -1) {
// No email address markup
mailheader.replace(String(F("$nodename")), Settings.Name);
mailheader.replace(String(F("$nodename")), Settings.getHostname());
mailheader.replace(String(F("$emailfrom")), notificationsettings.Sender);
} else {
String senderName = email_address.substring(0, pos_less);
Expand All @@ -112,7 +112,7 @@ boolean NPlugin_001_send(const NotificationSettingsStruct& notificationsettings,
mailheader.replace(String(F("$emailfrom")), address);
}

mailheader.replace(String(F("$nodename")), Settings.Name);
mailheader.replace(String(F("$nodename")), Settings.getHostname());
mailheader.replace(String(F("$emailfrom")), notificationsettings.Sender);
mailheader.replace(String(F("$ato")), notificationsettings.Receiver);
mailheader.replace(String(F("$subject")), aSub);
Expand Down
1 change: 1 addition & 0 deletions src/_P001_Switch.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#ifdef USES_P001

#include "_Plugin_Helper.h"
#include "src/DataStructs/PinMode.h"

// #######################################################################################################
Expand Down
1 change: 1 addition & 0 deletions src/_P002_ADC.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define PLUGIN_NAME_002 "Analog input - internal"
#define PLUGIN_VALUENAME1_002 "Analog"

#include "_Plugin_Helper.h"

#ifdef ESP32
# define P002_MAX_ADC_VALUE 4095
Expand Down
2 changes: 2 additions & 0 deletions src/_P003_Pulse.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//#################################### Plugin 003: Pulse ###############################################
//#######################################################################################################

#include "_Plugin_Helper.h"

#define PLUGIN_003
#define PLUGIN_ID_003 3
#define PLUGIN_NAME_003 "Generic - Pulse counter"
Expand Down
3 changes: 3 additions & 0 deletions src/_P004_Dallas.ino
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# define ESP32interrupts() portEXIT_CRITICAL(&mux); }
#endif // if defined(ESP32)

#include "_Plugin_Helper.h"


#define PLUGIN_004
#define PLUGIN_ID_004 4
#define PLUGIN_NAME_004 "Environment - DS18b20"
Expand Down
2 changes: 2 additions & 0 deletions src/_P005_DHT.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//######################## Plugin 005: Temperature and Humidity sensor DHT 11/22 ########################
//#######################################################################################################

#include "_Plugin_Helper.h"

#define PLUGIN_005
#define PLUGIN_ID_005 5
#define PLUGIN_NAME_005 "Environment - DHT11/12/22 SONOFF2301/7021"
Expand Down
2 changes: 2 additions & 0 deletions src/_P006_BMP085.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//######################## Plugin 006 BMP0685 I2C Barometric Pressure Sensor ###########################
//#######################################################################################################

#include "_Plugin_Helper.h"

#define PLUGIN_006
#define PLUGIN_ID_006 6
#define PLUGIN_NAME_006 "Environment - BMP085/180"
Expand Down
2 changes: 2 additions & 0 deletions src/_P007_PCF8591.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//#################################### Plugin 007: ExtWiredAnalog #######################################
//#######################################################################################################

#include "_Plugin_Helper.h"

#define PLUGIN_007
#define PLUGIN_ID_007 7
#define PLUGIN_NAME_007 "Analog input - PCF8591"
Expand Down
2 changes: 2 additions & 0 deletions src/_P008_RFID.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//################################# Plugin 008: Wiegand RFID Tag Reader #################################
//#######################################################################################################

#include "_Plugin_Helper.h"

#define PLUGIN_008
#define PLUGIN_ID_008 8
#define PLUGIN_NAME_008 "RFID - Wiegand"
Expand Down
1 change: 1 addition & 0 deletions src/_P009_MCP.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#ifdef USES_P009

#include "_Plugin_Helper.h"
#include "src/DataStructs/PinMode.h"

//#######################################################################################################
Expand Down
2 changes: 2 additions & 0 deletions src/_P010_BH1750.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//#################################### Plugin-010: LuxRead ############################################
//#######################################################################################################

#include "_Plugin_Helper.h"

#ifdef ESP8266 // Needed for precompile issues.
#include "AS_BH1750.h"
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/_P011_PME.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//#################################### Plugin 011: Pro Mini Extender ####################################
//#######################################################################################################

#include "_Plugin_Helper.h"

#define PLUGIN_011
#define PLUGIN_ID_011 11
#define PLUGIN_NAME_011 "Extra IO - ProMini Extender"
Expand Down
2 changes: 2 additions & 0 deletions src/_P012_LCD.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//#################################### Plugin 012: LCD ##################################################
//#######################################################################################################

#include "_Plugin_Helper.h"

// Sample templates
// Temp: [DHT11#Temperature] Hum:[DHT11#humidity]
// DS Temp:[Dallas1#Temperature#R]
Expand Down
2 changes: 2 additions & 0 deletions src/_P013_HCSR04.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//############################### Plugin 013: HC-SR04, RCW-0001, etc. ###################################
//#######################################################################################################

#include "_Plugin_Helper.h"

#define PLUGIN_013
#define PLUGIN_ID_013 13
#define PLUGIN_NAME_013 "Position - HC-SR04, RCW-0001, etc."
Expand Down
2 changes: 2 additions & 0 deletions src/_P014_SI7021.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
//#######################################################################################################
// 12-10-2015 Charles-Henri Hallard, see my projects and blog at https://hallard.me

#include "_Plugin_Helper.h"

#define PLUGIN_014
#define PLUGIN_ID_014 14
#define PLUGIN_NAME_014 "Environment - SI7021/HTU21D"
Expand Down
1 change: 1 addition & 0 deletions src/_P015_TSL2561.ino
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// this plugin is based on the sparkfun library
// written based on version 1.1.0 from https://github.com/sparkfun/SparkFun_TSL2561_Arduino_Library

#include "_Plugin_Helper.h"

#define PLUGIN_015
#define PLUGIN_ID_015 15
Expand Down
2 changes: 2 additions & 0 deletions src/_P016_IR.ino
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include <IRutils.h>
#include <IRrecv.h>

#include "_Plugin_Helper.h"

#ifdef P016_P035_Extended_AC
#include <IRac.h>
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/_P017_PN532.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//#################################### Plugin-017: PN532 RFID reader ####################################
//#######################################################################################################

#include "_Plugin_Helper.h"

#define PLUGIN_017
#define PLUGIN_ID_017 17
#define PLUGIN_NAME_017 "RFID - PN532"
Expand Down
2 changes: 2 additions & 0 deletions src/_P018_Dust.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//#################################### Plugin 018: GP2Y10 ###############################################
//#######################################################################################################

#include "_Plugin_Helper.h"

#define PLUGIN_018
#define PLUGIN_ID_018 18
#define PLUGIN_NAME_018 "Dust - Sharp GP2Y10"
Expand Down
1 change: 1 addition & 0 deletions src/_P019_PCF8574.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#ifdef USES_P019

#include "_Plugin_Helper.h"
#include "src/DataStructs/PinMode.h"

//#######################################################################################################
Expand Down
2 changes: 2 additions & 0 deletions src/_P020_Ser2Net.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//#################################### Plugin 020: Ser2Net ##############################################
//#######################################################################################################

#include "_Plugin_Helper.h"

#define PLUGIN_020
#define PLUGIN_ID_020 20
#define PLUGIN_NAME_020 "Communication - Serial Server"
Expand Down
2 changes: 2 additions & 0 deletions src/_P021_Level.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//#################################### Plugin 021: Level Control ########################################
//#######################################################################################################

#include "_Plugin_Helper.h"

#define PLUGIN_021
#define PLUGIN_ID_021 21
#define PLUGIN_NAME_021 "Regulator - Level Control"
Expand Down
1 change: 1 addition & 0 deletions src/_P022_PCA9685.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#ifdef USES_P022

#include "_Plugin_Helper.h"
#include "src/DataStructs/PinMode.h"

// #######################################################################################################
Expand Down
2 changes: 2 additions & 0 deletions src/_P023_OLED.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//#################################### Plugin 023: OLED SSD1306 display #################################
//#######################################################################################################

#include "_Plugin_Helper.h"

// Sample templates
// Temp: [DHT11#Temperature] Hum:[DHT11#humidity]
// DS Temp:[Dallas1#Temperature#R]
Expand Down
2 changes: 2 additions & 0 deletions src/_P024_MLX90614.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//#################################### Plugin 024: MLX90614 IR temperature I2C 0x5A) ###############################################
//#######################################################################################################

#include "_Plugin_Helper.h"

// MyMessage *msgTemp024; // Mysensors

#define PLUGIN_024
Expand Down
2 changes: 2 additions & 0 deletions src/_P025_ADS1115.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//#################################### Plugin 025: ADS1115 I2C 0x48) ###############################################
//#######################################################################################################

#include "_Plugin_Helper.h"

#define PLUGIN_025
#define PLUGIN_ID_025 25
#define PLUGIN_NAME_025 "Analog input - ADS1115"
Expand Down
1 change: 1 addition & 0 deletions src/_P026_Sysinfo.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//#################################### Plugin 026: System Info ##########################################
//#######################################################################################################

#include "_Plugin_Helper.h"

#include "ESPEasy_packed_raw_data.h"

Expand Down
2 changes: 2 additions & 0 deletions src/_P027_INA219.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//######################### Plugin 027: INA219 DC Voltage/Current sensor ################################
//#######################################################################################################

#include "_Plugin_Helper.h"

#define PLUGIN_027
#define PLUGIN_ID_027 27
#define PLUGIN_NAME_027 "Energy (DC) - INA219"
Expand Down
2 changes: 2 additions & 0 deletions src/_P028_BME280.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//#################### Plugin 028 BME280 I2C Temp/Hum/Barometric Pressure Sensor #######################
//#######################################################################################################

#include "_Plugin_Helper.h"

//#include <math.h>
#include <map>

Expand Down
2 changes: 2 additions & 0 deletions src/_P029_Output.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//#################################### Plugin 029: Output ###############################################
//#######################################################################################################

#include "_Plugin_Helper.h"

#define PLUGIN_029
#define PLUGIN_ID_029 29
#define PLUGIN_NAME_029 "Output - Domoticz MQTT Helper"
Expand Down
2 changes: 2 additions & 0 deletions src/_P030_BMP280.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//#################### Plugin 030 BMP280 I2C Temp/Barometric Pressure Sensor #######################
//#######################################################################################################

#include "_Plugin_Helper.h"

#define PLUGIN_030
#define PLUGIN_ID_030 30
#define PLUGIN_NAME_030 "Environment - BMP280"
Expand Down
2 changes: 2 additions & 0 deletions src/_P031_SHT1X.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//#################### Plugin 031: SHT10/SHT11/SHT15 Temp/Humidity Sensor ###############################
//#######################################################################################################

#include "_Plugin_Helper.h"

#define PLUGIN_031
#define PLUGIN_ID_031 31
#define PLUGIN_NAME_031 "Environment - SHT1X"
Expand Down

0 comments on commit cde4c93

Please sign in to comment.