From c699131103cbf380d9a27f00e577a6c18fab9fae Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sun, 5 Feb 2023 16:22:18 +0100 Subject: [PATCH] Add Shelly Pro 4PM to lvgl binary --- .../include/tasmota_configurations_ESP32.h | 5 +++- .../tasmota_xdrv_driver/xdrv_03_energy.ino | 9 ++------ .../xdrv_03_esp32_energy.ino | 9 ++------ ...24_biopdu.ino => xnrg_24_esp32_biopdu.ino} | 23 ++++++++----------- 4 files changed, 17 insertions(+), 29 deletions(-) rename tasmota/tasmota_xnrg_energy/{xnrg_24_biopdu.ino => xnrg_24_esp32_biopdu.ino} (91%) diff --git a/tasmota/include/tasmota_configurations_ESP32.h b/tasmota/include/tasmota_configurations_ESP32.h index 495d41652..69de06a24 100644 --- a/tasmota/include/tasmota_configurations_ESP32.h +++ b/tasmota/include/tasmota_configurations_ESP32.h @@ -346,7 +346,10 @@ #define USE_DS18x20 // Add support for DS18x20 sensors with id sort, single scan and read retry (+1k3 code) -#undef USE_ENERGY_SENSOR + +#define USE_ENERGY_SENSOR // Add energy to support Shelly Pro 4PM display (+38k code) +#define USE_ADE7953 +#define USE_SHELLY_PRO #define USE_I2C // I2C using library wire (+10k code, 0k2 mem, 124 iram) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino b/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino index bdba44bfa..67d891fe7 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_03_energy.ino @@ -19,15 +19,9 @@ #ifdef ESP8266 #ifdef USE_ENERGY_SENSOR -#define USE_ENERGY_SENSOR_LEGACY -#endif // USE_ENERGY_SENSOR -#endif // ESP8266 - -#ifdef USE_ENERGY_SENSOR_LEGACY /*********************************************************************************************\ * Energy for ESP8266 and legacy ESP32 with max three phases/channels using Settings from flash \*********************************************************************************************/ -//#warning **** USE_ENERGY_SENSOR_LEGACY **** #define XDRV_03 3 #define XSNS_03 3 @@ -1518,4 +1512,5 @@ bool Xsns03(uint32_t function) return result; } -#endif // USE_ENERGY_SENSOR_V1 +#endif // USE_ENERGY_SENSOR +#endif // ESP8266 diff --git a/tasmota/tasmota_xdrv_driver/xdrv_03_esp32_energy.ino b/tasmota/tasmota_xdrv_driver/xdrv_03_esp32_energy.ino index cb5007ffc..85b146bb7 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_03_esp32_energy.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_03_esp32_energy.ino @@ -19,15 +19,9 @@ #ifdef ESP32 #ifdef USE_ENERGY_SENSOR -#define USE_ENERGY_SENSOR_ESP32 -#endif // USE_ENERGY_SENSOR -#endif // ESP32 - -#ifdef USE_ENERGY_SENSOR_ESP32 /*********************************************************************************************\ * Energy for ESP32 with max eight phases/channels using more RAM and Settings from filesystem \*********************************************************************************************/ -//#warning **** USE_ENERGY_SENSOR_ESP32 **** #define XDRV_03 3 #define XSNS_03 3 @@ -1798,4 +1792,5 @@ bool Xsns03(uint32_t function) return result; } -#endif // USE_ENERGY_SENSOR_ESP32 +#endif // USE_ENERGY_SENSOR +#endif // ESP32 diff --git a/tasmota/tasmota_xnrg_energy/xnrg_24_biopdu.ino b/tasmota/tasmota_xnrg_energy/xnrg_24_esp32_biopdu.ino similarity index 91% rename from tasmota/tasmota_xnrg_energy/xnrg_24_biopdu.ino rename to tasmota/tasmota_xnrg_energy/xnrg_24_esp32_biopdu.ino index 680c2fbad..8af5ecb85 100644 --- a/tasmota/tasmota_xnrg_energy/xnrg_24_biopdu.ino +++ b/tasmota/tasmota_xnrg_energy/xnrg_24_esp32_biopdu.ino @@ -17,7 +17,8 @@ along with this program. If not, see . */ -#if defined(USE_ENERGY_SENSOR_ESP32) && defined(USE_I2C) +#ifdef ESP32 +#if defined(USE_ENERGY_SENSOR) && defined(USE_I2C) #ifdef USE_BIOPDU /*********************************************************************************************\ Biomine 625x12 Custom Board @@ -26,11 +27,11 @@ 3bit serial switch Integrated MCP23008 - Template {"NAME":"Olimex ESP32-PoE-BioPDU","GPIO":[1,10209,10210,1,10144,1,0,0,5536,640,1,1,608,0,5600,0,0,0,0,5568,0,0,0,0,0,0,0,0,1,10208,1,1,10176,0,0,1],"FLAG":0,"BASE":1} + Template {"NAME":"Olimex ESP32-PoE-BioPDU","GPIO":[1,10209,10210,1,10144,1,0,0,5536,640,1,1,608,0,5600,0,0,0,0,5568,0,0,0,0,0,0,0,0,1,10208,1,1,10176,0,0,1],"FLAG":0,"BASE":1} BioPDU 625x12 Factory Settings: - Template {"NAME":"Olimex ESP32-PoE-BioPDU","GPIO":[1,10209,10210,1,10144,1,0,0,5536,640,1,1,608,0,5600,0,0,0,0,5568,0,0,0,0,0,0,0,0,1,10208,1,1,10176,0,0,1],"FLAG":0,"BASE":1} + Template {"NAME":"Olimex ESP32-PoE-BioPDU","GPIO":[1,10209,10210,1,10144,1,0,0,5536,640,1,1,608,0,5600,0,0,0,0,5568,0,0,0,0,0,0,0,0,1,10208,1,1,10176,0,0,1],"FLAG":0,"BASE":1} Module 0 EthType 0 EthAddress 0 @@ -65,14 +66,7 @@ #define XNRG_24 24 -#undef ENERGY_MAX_PHASES -#define ENERGY_MAX_PHASES 6 // BioPDU support max six phases/channels - -#undef ENERGY_GUI_MAX_COLS -#define ENERGY_GUI_MAX_COLS 6 // [EnergyCols] Number of GUI data columns - Preffered 6 - -#undef ENERGY_GUI_DISPLAY_MODE -#define ENERGY_GUI_DISPLAY_MODE ENERGY_DISPLAY_TABS // [EnergyDisplay] 1 = Rotate if over EnergyCols, 2 = Rotate only powered on if over EnergyCols, 3 = Use tabs if over EnergyCols +#define BIOPDU_MAX_PHASES 6 // BioPDU support max six phases/channels const uint8_t BIOPDU_DEVICE_ADDRESS = 0x01; // PZEM default address const uint32_t BIOPDU_STABILIZE = 30; // Number of seconds to stabilize configuration @@ -241,7 +235,7 @@ void BioPduDrvInit(void) } } - Energy->phase_count = std::min((uint8_t)(pow(2, BioPdu.pins) - 1), (uint8_t)ENERGY_MAX_PHASES); // Start off with 6 phases + Energy->phase_count = std::min((uint8_t)(pow(2, BioPdu.pins) - 1), (uint8_t)BIOPDU_MAX_PHASES); // Start off with 6 phases AddLog(LOG_LEVEL_DEBUG, PSTR("PDU: number of pins=%d, max_phase=%d"), BioPdu.pins, Energy->phase_count); } @@ -297,5 +291,6 @@ bool Xnrg24(uint32_t function) return result; } -#endif // USE_BIOPDU -#endif // USE_ENERGY_SENSOR +#endif // USE_BIOPDU +#endif // USE_ENERGY_SENSOR +#endif // ESP32