From 0686e048a999d64344f312d2619a374667cdaf34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Fri, 15 Mar 2019 09:00:44 +0100 Subject: [PATCH] Cleaning up arduino.h file --- code/espurna/config/arduino.h | 202 ++++++++++-------- code/espurna/config/hardware.h | 1 - code/espurna/config/sensors.h | 2 +- .../sensors/{MAX6675.h => MAX6675Sensor.h} | 23 +- 4 files changed, 117 insertions(+), 111 deletions(-) rename code/espurna/sensors/{MAX6675.h => MAX6675Sensor.h} (91%) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 961c1bfa..45a7e87e 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -7,117 +7,129 @@ // Hardware //-------------------------------------------------------------------------------- -//#define NODEMCU_LOLIN -//#define WEMOS_D1_MINI -//#define WEMOS_D1_MINI_RELAYSHIELD -//#define TINKERMAN_ESPURNA_H06 -//#define TINKERMAN_ESPURNA_H08 -//#define TINKERMAN_RFM69GW -//#define ITEAD_SONOFF_BASIC -//#define ITEAD_SONOFF_RF -//#define ITEAD_SONOFF_TH -//#define ITEAD_SONOFF_SV -//#define ITEAD_SLAMPHER +//#define AITHINKER_AI_LIGHT +//#define ALLNET_4DUINO_IOT_WLAN_RELAIS +//#define ALLTERCO_SHELLY1 +//#define ALLTERCO_SHELLY2 +//#define ARILUX_AL_LC01 +//#define ARILUX_AL_LC02 +//#define ARILUX_AL_LC02_V14 +//#define ARILUX_AL_LC06 +//#define ARILUX_AL_LC11 +//#define ARILUX_E27 +//#define ARNIEX_SWIFITCH +//#define AUTHOMETION_LYT8266 +//#define BESTEK_MRJ1011 +//#define BH_ONOFRE +//#define BLITZWOLF_BWSHPX +//#define BLITZWOLF_BWSHPX_V23 +//#define DIGOO_NX_SP202 +//#define ELECTRODRAGON_WIFI_IOT +//#define ESPURNA_CORE +//#define ESTINK_WIFI_POWER_STRIP +//#define EUROMATE_WIFI_STECKER_SCHUKO +//#define EUROMATE_WIFI_STECKER_SCHUKO_V2 +//#define EXS_WIFI_RELAY_V31 +//#define EXS_WIFI_RELAY_V50 +//#define FOXEL_LIGHTFOX_DUAL +//#define GBLIFE_RGBW_SOCKET +//#define GENERIC_8CH +//#define GENERIC_AG_L4 +//#define GENERIC_ECH1560 +//#define GENERIC_ESP01S_DHT11_V10 +//#define GENERIC_ESP01S_DS18B20_V10 +//#define GENERIC_ESP01S_RELAY_V40 +//#define GENERIC_ESP01S_RGBLED_V10 +//#define GENERIC_V9261F +//#define GIZWITS_WITTY_CLOUD +//#define GOSUND_SP1_V23 +//#define GOSUND_WS1 +//#define GREEN_ESP8266RELAY +//#define HAMA_WIFI_STECKDOSE_00176533 +//#define HELTEC_TOUCHRELAY +//#define HEYGO_HY02 +//#define HOMECUBE_16A +//#define HUACANXING_H801 +//#define HUACANXING_H802 +//#define IKE_ESPIKE +//#define INTERMITTECH_QUINLED +//#define ITEAD_1CH_INCHING +//#define ITEAD_BNSZ01 +//#define ITEAD_MOTOR //#define ITEAD_S20 -//#define ITEAD_SONOFF_TOUCH -//#define ITEAD_SONOFF_POW -//#define ITEAD_SONOFF_POW_R2 -//#define ITEAD_SONOFF_DUAL -//#define ITEAD_SONOFF_DUAL_R2 +//#define ITEAD_SLAMPHER //#define ITEAD_SONOFF_4CH //#define ITEAD_SONOFF_4CH_PRO -//#define ITEAD_1CH_INCHING -//#define ITEAD_MOTOR -//#define ITEAD_SONOFF_BNSZ01 -//#define ITEAD_SONOFF_RFBRIDGE //#define ITEAD_SONOFF_B1 +//#define ITEAD_SONOFF_BASIC +//#define ITEAD_SONOFF_BNSZ01 +//#define ITEAD_SONOFF_DUAL +//#define ITEAD_SONOFF_DUAL_R2 +//#define ITEAD_SONOFF_IFAN02 //#define ITEAD_SONOFF_LED +//#define ITEAD_SONOFF_POW +//#define ITEAD_SONOFF_POW_R2 +//#define ITEAD_SONOFF_RF +//#define ITEAD_SONOFF_RFBRIDGE +//#define ITEAD_SONOFF_S31 +//#define ITEAD_SONOFF_SV //#define ITEAD_SONOFF_T1_1CH //#define ITEAD_SONOFF_T1_2CH //#define ITEAD_SONOFF_T1_3CH -//#define ITEAD_SONOFF_S31 -//#define ORVIBO_B25 -//#define YJZK_SWITCH_2CH -//#define ELECTRODRAGON_WIFI_IOT -//#define WORKCHOICE_ECOPLUG -//#define AITHINKER_AI_LIGHT -//#define LYASI_LIGHT -//#define MAGICHOME_LED_CONTROLLER -//#define MAGICHOME_LED_CONTROLLER_20 -//#define HUACANXING_H801 -//#define HUACANXING_H802 +//#define ITEAD_SONOFF_TH +//#define ITEAD_SONOFF_TOUCH +//#define IWOOLE_LED_TABLE_LAMP //#define JANGOE_WIFI_RELAY_NC //#define JANGOE_WIFI_RELAY_NO //#define JORGEGARCIA_WIFI_RELAYS -//#define OPENENERGYMONITOR_MQTT_RELAY -//#define WION_50055 -//#define EXS_WIFI_RELAY_V31 -//#define GENERIC_V9261F -//#define GENERIC_ECH1560 -//#define MANCAVEMADE_ESPLIVE -//#define INTERMITTECH_QUINLED -//#define ARILUX_AL_LC06 -//#define ARILUX_E27 -//#define XENON_SM_PW702U -//#define AUTHOMETION_LYT8266 //#define KMC_70011 -//#define GENERIC_8CH -//#define ARILUX_AL_LC01 -//#define ARILUX_AL_LC11 -//#define ARILUX_AL_LC02 -//#define WEMOS_D1_TARPUNA_SHIELD -//#define GIZWITS_WITTY_CLOUD -//#define EUROMATE_WIFI_STECKER_SCHUKO -//#define EUROMATE_WIFI_STECKER_SCHUKO_V2 -//#define TONBUX_POWERSTRIP02 //#define LINGAN_SWA1 -//#define HEYGO_HY02 -//#define MAXCIO_WUS002S -//#define OUKITEL_P1 -//#define YIDIAN_XSSSA05 -//#define TONBUX_XSSSA06 -//#define TONBUX_XSSSA01 -//#define GREEN_ESP8266RELAY -//#define IKE_ESPIKE -//#define ARNIEX_SWIFITCH -//#define GENERIC_ESP01S_RELAY_V40 -//#define GENERIC_ESP01S_RGBLED_V10 -//#define GENERIC_ESP01S_DHT11_V10 -//#define GENERIC_ESP01S_DS18B20_V10 -//#define HELTEC_TOUCHRELAY -//#define ZHILDE_EU44_W -//#define LUANI_HVIO -//#define ALLNET_4DUINO_IOT_WLAN_RELAIS -//#define TONBUX_MOSQUITO_KILLER -//#define NEO_COOLCAM_NAS_WR01W -//#define ESTINK_WIFI_POWER_STRIP -//#define PILOTAK_ESP_DIN_V1 -//#define BLITZWOLF_BWSHPX -//#define BH_ONOFRE -//#define ITEAD_SONOFF_IFAN02 -//#define GENERIC_AG_L4 -//#define ALLTERCO_SHELLY1 +//#define LITESUN_LA_WF3 //#define LOHAS_9W -//#define YJZK_SWITCH_1CH -//#define YJZK_SWITCH_3CH -//#define XIAOMI_SMART_DESK_LAMP -//#define ALLTERCO_SHELLY2 -//#define PHYX_ESP12_RGB -//#define IWOOLE_LED_TABLE_LAMP -//#define EXS_WIFI_RELAY_V50 -//#define TECKIN_SP22_V14 //#define LOMBEX_LUX_NOVA2_TUNABLE_WHITE //#define LOMBEX_LUX_NOVA2_WHITE_COLOR +//#define LUANI_HVIO +//#define LYASI_LIGHT +//#define MAGICHOME_LED_CONTROLLER +//#define MAGICHOME_LED_CONTROLLER_20 //#define MAGICHOME_ZJ_WFMN_A_11 //#define MAGICHOME_ZJ_WFMN_B_11 -//#define GBLIFE_RGBW_SOCKET +//#define MANCAVEMADE_ESPLIVE +//#define MAXCIO_WDE004 +//#define MAXCIO_WUS002S +//#define NEO_COOLCAM_NAS_WR01W +//#define NODEMCU_BASIC +//#define NODEMCU_LOLIN +//#define OPENENERGYMONITOR_MQTT_RELAY +//#define ORVIBO_B25 +//#define OUKITEL_P1 +//#define PHYX_ESP12_RGB +//#define PILOTAK_ESP_DIN_V1 //#define SMARTLIFE_MINI_SMART_SOCKET -//#define GOSUND_SP1_V23 -//#define GOSUND_WS1 -//#define ARILUX_AL_LC02_V14 -//#define BLITZWOLF_BWSHPX_V23 -//#define DIGOO_NX_SP202 -//#define FOXEL_LIGHTFOX_DUAL +//#define STM_RELAY +//#define TECKIN_SP20 +//#define TECKIN_SP22_V14 +//#define TINKERMAN_ESPURNA_H06 +//#define TINKERMAN_ESPURNA_H08 +//#define TINKERMAN_ESPURNA_SWITCH +//#define TINKERMAN_RFM69GW +//#define TONBUX_MOSQUITO_KILLER +//#define TONBUX_POWERSTRIP02 +//#define TONBUX_XSSSA01 +//#define TONBUX_XSSSA06 +//#define VANZAVANZU_SMART_WIFI_PLUG_MINI +//#define WEMOS_D1_MINI +//#define WEMOS_D1_MINI_RELAYSHIELD +//#define WEMOS_D1_TARPUNA_SHIELD +//#define WION_50055 +//#define WORKCHOICE_ECOPLUG +//#define XENON_SM_PW702U +//#define XIAOMI_SMART_DESK_LAMP +//#define YIDIAN_XSSSA05 +//#define YJZK_SWITCH_1CH +//#define YJZK_SWITCH_2CH +//#define YJZK_SWITCH_3CH +//#define ZHILDE_EU44_W //-------------------------------------------------------------------------------- // Features (values below are non-default values) @@ -145,8 +157,8 @@ //#define NETBIOS_SUPPORT 1 // Only with Arduino Core 2.4.0 //#define NOFUSS_SUPPORT 1 //#define NTP_SUPPORT 0 -//#define RFM69_SUPPORT 1 //#define RF_SUPPORT 1 +//#define RFM69_SUPPORT 1 //#define SCHEDULER_SUPPORT 0 //#define SENSOR_SUPPORT 1 //#define SPIFFS_SUPPORT 1 @@ -175,9 +187,11 @@ //#define EMON_ADS1X15_SUPPORT 1 //#define EMON_ANALOG_SUPPORT 1 //#define EVENTS_SUPPORT 1 +//#define EZOPH_SUPPORT 1 //#define GEIGER_SUPPORT 1 //#define GUVAS12SD_SUPPORT 1 //#define HLW8012_SUPPORT 1 +//#define MAX6675_SUPPORT 1 //#define MHZ19_SUPPORT 1 //#define MICS2710_SUPPORT 1 //#define MICS5525_SUPPORT 1 @@ -192,5 +206,5 @@ //#define SONAR_SUPPORT 1 //#define TMP3X_SUPPORT 1 //#define V9261F_SUPPORT 1 +//#define VEML6075_SUPPORT 1 //#define VL53L1X_SUPPORT 1 -//#define EZOPH_SUPPORT 1 diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index b32c7574..e91cf8e3 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -228,7 +228,6 @@ #define RELAY1_PIN 12 #define RELAY1_TYPE RELAY_TYPE_INVERSE - // Check http://tinkerman.cat/rfm69-wifi-gateway/ #elif defined(TINKERMAN_RFM69GW) diff --git a/code/espurna/config/sensors.h b/code/espurna/config/sensors.h index 78487817..f1d16825 100644 --- a/code/espurna/config/sensors.h +++ b/code/espurna/config/sensors.h @@ -1026,7 +1026,7 @@ #endif #if MAX6675_SUPPORT - #include "../sensors/MAX6675.h" + #include "../sensors/MAX6675Sensor.h" #endif #if MHZ19_SUPPORT diff --git a/code/espurna/sensors/MAX6675.h b/code/espurna/sensors/MAX6675Sensor.h similarity index 91% rename from code/espurna/sensors/MAX6675.h rename to code/espurna/sensors/MAX6675Sensor.h index 39a58115..06f66f0c 100644 --- a/code/espurna/sensors/MAX6675.h +++ b/code/espurna/sensors/MAX6675Sensor.h @@ -25,7 +25,7 @@ class MAX6675Sensor : public BaseSensor { MAX6675Sensor(): BaseSensor() { _sensor_id = SENSOR_MAX6675_ID; - + _count = 1; } ~MAX6675Sensor() { @@ -62,11 +62,9 @@ class MAX6675Sensor : public BaseSensor { if (!_dirty) return; //// MAX6675 - int units = 1; // Units to readout temp (0 = raw, 1 = ˚C, 2 = ˚F) + int units = 1; // Units to readout temp (0 = raw, 1 = ˚C, 2 = ˚F) if (_max) delete _max; - _max = new MAX6675(_pin_cs,_pin_so,_pin_sck,units); - - _count = 1; + _max = new MAX6675(_pin_cs, _pin_so, _pin_sck, units); _ready = true; _dirty = false; @@ -78,24 +76,20 @@ class MAX6675Sensor : public BaseSensor { static unsigned long last = 0; if (millis() - last < MAX6675_READ_INTERVAL) return; last = millis(); - last_read = _max->read_temp(); } - // Descriptive name of the sensor String description() { char buffer[20]; //snprintf(buffer, sizeof(buffer), "MAX6675 @ CS %d", _gpio); - snprintf(buffer, sizeof(buffer), "MAX6675 "); + snprintf(buffer, sizeof(buffer), "MAX6675"); return String(buffer); } - String address(unsigned char index){ - return String("@ address"); - - } - + String address(unsigned char index) { + return String("@ address"); + } // Address of the device // Descriptive name of the slot # index @@ -128,7 +122,6 @@ class MAX6675Sensor : public BaseSensor { // Current value for slot # index double value(unsigned char index) { return last_read; - } protected: @@ -141,7 +134,7 @@ class MAX6675Sensor : public BaseSensor { unsigned int _pin_so = MAX6675_SO_PIN; unsigned int _pin_sck = MAX6675_SCK_PIN; bool _busy = false; - double last_read = 0; + double last_read = 0; MAX6675 * _max = NULL;