Biopdu-v1.1.1 (#17868)

* Template Fix

* Removed common setting, use SetOption150 instead

* code cleaning

* BioPDU Factory Settings

* CHANGELOG update

* RELEASENOTES update
This commit is contained in:
Fabrizio Amodio 2023-02-03 17:52:26 +01:00 committed by GitHub
parent de81eecc01
commit e8056df1ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 28 deletions

View File

@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
- ESP32 command ``EnergyDisplay 1..3`` to change GUI column presentation - ESP32 command ``EnergyDisplay 1..3`` to change GUI column presentation
- support for SEN5X gas and air quality sensor by Tyeth Gundry (#17736) - support for SEN5X gas and air quality sensor by Tyeth Gundry (#17736)
- Berry add ``mdns`` advanced features and query - Berry add ``mdns`` advanced features and query
- ESP32 support for Biomine BioPDU 625x12 (#17857)
### Breaking Changed ### Breaking Changed
- Berry energy_ctypes changed with new energy driver - Berry energy_ctypes changed with new energy driver

View File

@ -127,6 +127,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- ESP32 command ``EnergyDisplay 1..3`` to change GUI column presentation - ESP32 command ``EnergyDisplay 1..3`` to change GUI column presentation
- ESP32 support for eigth energy phases/channels - ESP32 support for eigth energy phases/channels
- ESP32 support for BMPxxx sensors on two I2C busses [#17643](https://github.com/arendst/Tasmota/issues/17643) - ESP32 support for BMPxxx sensors on two I2C busses [#17643](https://github.com/arendst/Tasmota/issues/17643)
- ESP32 support for Biomine BioPDU 625x12 [#17857](https://github.com/arendst/Tasmota/issues/17857)
### Breaking Changed ### Breaking Changed

View File

@ -1,11 +1,12 @@
/* /*
xnrg_24_biopdu.ino - BioPDU-625x12 (based on xnrg_05_pzem_ac.ino) xnrg_24_biopdu.ino - BioPDU-625x12 (based on xnrg_05_pzem_ac.ino)
Biomine 625x12 Custom Board Biomine 625x12 Custom Board
6 x 25A Relays
6 x Independent PZEM-004V3 Modbus AC energy sensor 6 x Independent PZEM-004V3 Modbus AC energy sensor
3bit serial switch 3bit serial switch
Integrated MCP23008 Integrated MCP23008
Template {"NAME":"Olimex ESP32-PoE-BioPDU","GPIO":[1,10081,10082,1,10016,1,0,0,5536,640,1,1,608,0,5600,0,0,0,0,5568,0,0,0,0,0,0,0,0,1,10080,1,1,10048,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}
Copyright (C) 2021 Theo Arends Copyright (C) 2021 Theo Arends
Copyright (C) 2022-2023 Fabrizio Amodio Copyright (C) 2022-2023 Fabrizio Amodio
@ -27,6 +28,42 @@
#if defined(USE_ENERGY_SENSOR_ESP32) && defined(USE_I2C) #if defined(USE_ENERGY_SENSOR_ESP32) && defined(USE_I2C)
#ifdef USE_BIOPDU #ifdef USE_BIOPDU
/*
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}
Module 0
EthType 0
EthAddress 0
EthClockMode 3
SetOption26 1
SetOption129 1
SetOption150 1
EnergyDisplay 1
EnergyCols 6
i2cscan
Sensor29 0,1,0
Sensor29 1,5,2
Sensor29 2,5,2
Sensor29 3,5,2
Sensor29 4,5,2
Sensor29 5,5,2
Sensor29 6,5,2
Sensor29 7,1,0
compile with build flags:
${env:tasmota32.build_flags}
USE_ETHERNET
ETH_TYPE=0
ETH_ADDRESS=0
ETH_CLKMODE=3
USE_MCP230xx
USE_MCP230xx_ADDR=0x20
USE_MCP230xx_OUTPUT
USE_BIOPDU
*/
#define XNRG_24 24 #define XNRG_24 24
#undef ENERGY_MAX_PHASES #undef ENERGY_MAX_PHASES
@ -117,22 +154,10 @@ void BioPduEvery250ms(void)
Energy->frequency[BioPdu.phase] = (float)((buffer[17] << 8) + buffer[18]) / 10.0f; // 50.0 Hz Energy->frequency[BioPdu.phase] = (float)((buffer[17] << 8) + buffer[18]) / 10.0f; // 50.0 Hz
Energy->power_factor[BioPdu.phase] = (float)((buffer[19] << 8) + buffer[20]) / 100.0f; // 1.00 Energy->power_factor[BioPdu.phase] = (float)((buffer[19] << 8) + buffer[20]) / 100.0f; // 1.00
Energy->import_active[BioPdu.phase] = (float)((buffer[15] << 24) + (buffer[16] << 16) + (buffer[13] << 8) + buffer[14]) / 1000.0f; // 4294967.295 kWh Energy->import_active[BioPdu.phase] = (float)((buffer[15] << 24) + (buffer[16] << 16) + (buffer[13] << 8) + buffer[14]) / 1000.0f; // 4294967.295 kWh
// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("PDU: ph=%d v=%2_f c=%4_f ap=%2_f f=%2_f pf=%3_f ia=%4_f"),
// BioPdu.phase,
// &Energy->voltage[BioPdu.phase],
// &Energy->current[BioPdu.phase],
// &Energy->active_power[BioPdu.phase],
// &Energy->frequency[BioPdu.phase],
// &Energy->power_factor[BioPdu.phase],
// &Energy->import_active[BioPdu.phase]
// );
} }
} }
} }
// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("PDU: ph=%d st=%d dr=%d sr=%d"), BioPdu.phase, BioPdu.address_step, data_ready, BioPdu.send_retry);
if (0 == BioPdu.send_retry || data_ready) if (0 == BioPdu.send_retry || data_ready)
{ {
if (ADDR_SEND == BioPdu.address_step) if (ADDR_SEND == BioPdu.address_step)
@ -165,24 +190,12 @@ void BioPduEvery250ms(void)
} }
break; break;
} }
else
{
// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("PDU: phase %d not read"), BioPdu.phase);
}
} }
} }
} }
else else
{ {
BioPdu.send_retry--; BioPdu.send_retry--;
if ((Energy->phase_count > 1) && (0 == BioPdu.send_retry) && (TasmotaGlobal.uptime < BIOPDU_STABILIZE))
{
// Energy->phase_count--; // Decrement phases if no response after retry within 30 seconds after restart
// if (TasmotaGlobal.discovery_counter)
// {
// TasmotaGlobal.discovery_counter += ENERGY_WATCHDOG + 1; // Don't send Discovery yet, delay by 4s + 1s
// }
}
} }
} }
@ -210,9 +223,6 @@ void BioPduDrvInit(void)
{ {
TasmotaGlobal.energy_driver = XNRG_24; TasmotaGlobal.energy_driver = XNRG_24;
Energy->voltage_common = false;
Energy->frequency_common = false;
AddLog(LOG_LEVEL_DEBUG, PSTR("PDU: checking pins")); AddLog(LOG_LEVEL_DEBUG, PSTR("PDU: checking pins"));
for (uint8_t p = 0; p < 3; p++) for (uint8_t p = 0; p < 3; p++)