Version v14.2.0.2

- Changed Energy BL09xx command ``CurrentSet`` input changed from Ampere to milliAmpere
This commit is contained in:
Theo Arends 2024-08-21 16:27:43 +02:00
parent ba7161fb00
commit 798edc20c2
10 changed files with 69 additions and 42 deletions

View File

@ -3,14 +3,24 @@ All notable changes to this project will be documented in this file.
## [Unreleased] - Development ## [Unreleased] - Development
## [14.2.0.1] ## [14.2.0.2]
### Added
### Breaking Changed
### Changed
- Energy BL09xx command ``CurrentSet`` input changed from Ampere to milliAmpere
### Fixed
### Removed
## [14.2.0.1] 20240821
### Added ### Added
- Energy Log level 4 message when (Calculated) Apparent Power is less than Active Power indicating wrong calibration (#20653) - Energy Log level 4 message when (Calculated) Apparent Power is less than Active Power indicating wrong calibration (#20653)
- Energy command ``PowerSet 60,230`` to calibrate both Current and Power with known resistive load of 60W at 230V using calibrated Voltage - Energy command ``PowerSet 60,230`` to calibrate both Current and Power with known resistive load of 60W at 230V using calibrated Voltage
- Energy command ``CurrentSet 60,230`` to calibrate both Power and Current with known resistive load of 60W at 230V using calibrated Voltage - Energy command ``CurrentSet 60,230`` to calibrate both Power and Current with known resistive load of 60W at 230V using calibrated Voltage
### Breaking Changed
### Changed ### Changed
- Energy force Apparent Power equals Active Power when (Calculated) Apparent Power is less than Active Power (#20653) - Energy force Apparent Power equals Active Power when (Calculated) Apparent Power is less than Active Power (#20653)

View File

@ -119,7 +119,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
[Complete list](BUILDS.md) of available feature and sensors. [Complete list](BUILDS.md) of available feature and sensors.
## Changelog v14.2.0.1 ## Changelog v14.2.0.2
### Added ### Added
- Energy command ``PowerSet 60,230`` to calibrate both Current and Power with known resistive load of 60W at 230V using calibrated Voltage - Energy command ``PowerSet 60,230`` to calibrate both Current and Power with known resistive load of 60W at 230V using calibrated Voltage
- Energy command ``CurrentSet 60,230`` to calibrate both Power and Current with known resistive load of 60W at 230V using calibrated Voltage - Energy command ``CurrentSet 60,230`` to calibrate both Power and Current with known resistive load of 60W at 230V using calibrated Voltage
@ -128,6 +128,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
### Breaking Changed ### Breaking Changed
### Changed ### Changed
- Energy BL09xx command ``CurrentSet`` input changed from Ampere to milliAmpere
- Energy force Apparent Power equals Active Power when (Calculated) Apparent Power is less than Active Power [#20653](https://github.com/arendst/Tasmota/issues/20653) - Energy force Apparent Power equals Active Power when (Calculated) Apparent Power is less than Active Power [#20653](https://github.com/arendst/Tasmota/issues/20653)
### Fixed ### Fixed

View File

@ -22,6 +22,6 @@
#define TASMOTA_SHA_SHORT // Filled by Github sed #define TASMOTA_SHA_SHORT // Filled by Github sed
const uint32_t TASMOTA_VERSION = 0x0E020001; // 14.2.0.1 const uint32_t TASMOTA_VERSION = 0x0E020002; // 14.2.0.2
#endif // _TASMOTA_VERSION_H_ #endif // _TASMOTA_VERSION_H_

View File

@ -284,22 +284,26 @@ void HlwDrvInit(void) {
bool HlwCommand(void) { bool HlwCommand(void) {
bool serviced = true; bool serviced = true;
if ((CMND_POWERCAL == Energy->command_code) || (CMND_VOLTAGECAL == Energy->command_code) || (CMND_CURRENTCAL == Energy->command_code)) { float value = CharToFloat(XdrvMailbox.data);
if ((CMND_POWERCAL == Energy->command_code) ||
(CMND_VOLTAGECAL == Energy->command_code) ||
(CMND_CURRENTCAL == Energy->command_code)) {
// Service in xdrv_03_energy.ino // Service in xdrv_03_energy.ino
} }
else if (CMND_POWERSET == Energy->command_code) { else if (CMND_POWERSET == Energy->command_code) { // xxx.x W
if (XdrvMailbox.data_len && Hlw.cf_power_pulse_length ) { if (XdrvMailbox.data_len && Hlw.cf_power_pulse_length ) {
XdrvMailbox.payload = ((uint32_t)(CharToFloat(XdrvMailbox.data) * 10) * Hlw.cf_power_pulse_length ) / Hlw.power_ratio; XdrvMailbox.payload = ((uint32_t)(value * 10) * Hlw.cf_power_pulse_length ) / Hlw.power_ratio;
} }
} }
else if (CMND_VOLTAGESET == Energy->command_code) { else if (CMND_VOLTAGESET == Energy->command_code) { // xxx.x V
if (XdrvMailbox.data_len && Hlw.cf1_voltage_pulse_length ) { if (XdrvMailbox.data_len && Hlw.cf1_voltage_pulse_length ) {
XdrvMailbox.payload = ((uint32_t)(CharToFloat(XdrvMailbox.data) * 10) * Hlw.cf1_voltage_pulse_length ) / Hlw.voltage_ratio; XdrvMailbox.payload = ((uint32_t)(value * 10) * Hlw.cf1_voltage_pulse_length ) / Hlw.voltage_ratio;
} }
} }
else if (CMND_CURRENTSET == Energy->command_code) { else if (CMND_CURRENTSET == Energy->command_code) { // xxx mA
if (XdrvMailbox.data_len && Hlw.cf1_current_pulse_length) { if (XdrvMailbox.data_len && Hlw.cf1_current_pulse_length) {
XdrvMailbox.payload = ((uint32_t)(CharToFloat(XdrvMailbox.data)) * Hlw.cf1_current_pulse_length) / Hlw.current_ratio; XdrvMailbox.payload = ((uint32_t)(value) * Hlw.cf1_current_pulse_length) / Hlw.current_ratio;
} }
} }
else serviced = false; // Unknown command else serviced = false; // Unknown command

View File

@ -258,22 +258,26 @@ void CseDrvInit(void) {
bool CseCommand(void) { bool CseCommand(void) {
bool serviced = true; bool serviced = true;
if ((CMND_POWERCAL == Energy->command_code) || (CMND_VOLTAGECAL == Energy->command_code) || (CMND_CURRENTCAL == Energy->command_code)) { float value = CharToFloat(XdrvMailbox.data);
if ((CMND_POWERCAL == Energy->command_code) ||
(CMND_VOLTAGECAL == Energy->command_code) ||
(CMND_CURRENTCAL == Energy->command_code)) {
// Service in xdrv_03_energy.ino // Service in xdrv_03_energy.ino
} }
else if (CMND_POWERSET == Energy->command_code) { else if (CMND_POWERSET == Energy->command_code) { // xxx W
if (XdrvMailbox.data_len && Cse.power_cycle) { if (XdrvMailbox.data_len && Cse.power_cycle) {
XdrvMailbox.payload = (unsigned long)(CharToFloat(XdrvMailbox.data) * Cse.power_cycle) / CSE_PREF; XdrvMailbox.payload = (uint32_t)(value * Cse.power_cycle) / CSE_PREF;
} }
} }
else if (CMND_VOLTAGESET == Energy->command_code) { else if (CMND_VOLTAGESET == Energy->command_code) { // xxx V
if (XdrvMailbox.data_len && Cse.voltage_cycle) { if (XdrvMailbox.data_len && Cse.voltage_cycle) {
XdrvMailbox.payload = (unsigned long)(CharToFloat(XdrvMailbox.data) * Cse.voltage_cycle) / CSE_UREF; XdrvMailbox.payload = (uint32_t)(value * Cse.voltage_cycle) / CSE_UREF;
} }
} }
else if (CMND_CURRENTSET == Energy->command_code) { else if (CMND_CURRENTSET == Energy->command_code) { // xxx mA
if (XdrvMailbox.data_len && Cse.current_cycle) { if (XdrvMailbox.data_len && Cse.current_cycle) {
XdrvMailbox.payload = (unsigned long)(CharToFloat(XdrvMailbox.data) * Cse.current_cycle) / 1000; XdrvMailbox.payload = (uint32_t)(value * Cse.current_cycle) / 1000;
} }
} }
else serviced = false; // Unknown command else serviced = false; // Unknown command

View File

@ -599,11 +599,13 @@ void McpDrvInit(void)
bool McpCommand(void) bool McpCommand(void)
{ {
bool serviced = true; bool serviced = true;
unsigned long value = 0;
float value_f = CharToFloat(XdrvMailbox.data);
uint32_t value = 0;
if (CMND_POWERSET == Energy->command_code) { if (CMND_POWERSET == Energy->command_code) {
if (XdrvMailbox.data_len && mcp_active_power) { if (XdrvMailbox.data_len && mcp_active_power) {
value = (unsigned long)(CharToFloat(XdrvMailbox.data) * 100); value = (uint32_t)(value_f * 100);
if ((value > 100) && (value < 2000000)) { // Between 1W and 20000W if ((value > 100) && (value < 2000000)) { // Between 1W and 20000W
XdrvMailbox.payload = value; XdrvMailbox.payload = value;
mcp_calibrate |= MCP_CALIBRATE_POWER; mcp_calibrate |= MCP_CALIBRATE_POWER;
@ -613,7 +615,7 @@ bool McpCommand(void)
} }
else if (CMND_VOLTAGESET == Energy->command_code) { else if (CMND_VOLTAGESET == Energy->command_code) {
if (XdrvMailbox.data_len && mcp_voltage_rms) { if (XdrvMailbox.data_len && mcp_voltage_rms) {
value = (unsigned long)(CharToFloat(XdrvMailbox.data) * 10); value = (uint32_t)(value_f * 10);
if ((value > 1000) && (value < 4000)) { // Between 100V and 400V if ((value > 1000) && (value < 4000)) { // Between 100V and 400V
XdrvMailbox.payload = value; XdrvMailbox.payload = value;
mcp_calibrate |= MCP_CALIBRATE_VOLTAGE; mcp_calibrate |= MCP_CALIBRATE_VOLTAGE;
@ -623,7 +625,7 @@ bool McpCommand(void)
} }
else if (CMND_CURRENTSET == Energy->command_code) { else if (CMND_CURRENTSET == Energy->command_code) {
if (XdrvMailbox.data_len && mcp_current_rms) { if (XdrvMailbox.data_len && mcp_current_rms) {
value = (unsigned long)(CharToFloat(XdrvMailbox.data) * 10); value = (uint32_t)(value_f * 10);
if ((value > 100) && (value < 800000)) { // Between 10mA and 80A if ((value > 100) && (value < 800000)) { // Between 10mA and 80A
XdrvMailbox.payload = value; XdrvMailbox.payload = value;
mcp_calibrate |= MCP_CALIBRATE_CURRENT; mcp_calibrate |= MCP_CALIBRATE_CURRENT;
@ -633,7 +635,7 @@ bool McpCommand(void)
} }
else if (CMND_FREQUENCYSET == Energy->command_code) { else if (CMND_FREQUENCYSET == Energy->command_code) {
if (XdrvMailbox.data_len && mcp_line_frequency) { if (XdrvMailbox.data_len && mcp_line_frequency) {
value = (unsigned long)(CharToFloat(XdrvMailbox.data) * 1000); value = (uint32_t)(value_f * 1000);
if ((value > 45000) && (value < 65000)) { // Between 45Hz and 65Hz if ((value > 45000) && (value < 65000)) { // Between 45Hz and 65Hz
XdrvMailbox.payload = value; XdrvMailbox.payload = value;
mcp_calibrate |= MCP_CALIBRATE_FREQUENCY; mcp_calibrate |= MCP_CALIBRATE_FREQUENCY;

View File

@ -393,19 +393,24 @@ bool Bl09XXCommand(void) {
uint32_t channel = (2 == XdrvMailbox.index) && (Energy->phase_count > 1) ? 1 : 0; uint32_t channel = (2 == XdrvMailbox.index) && (Energy->phase_count > 1) ? 1 : 0;
uint32_t value = (uint32_t)(CharToFloat(XdrvMailbox.data) * 100); // 1.23 = 123 uint32_t value = (uint32_t)(CharToFloat(XdrvMailbox.data) * 100); // 1.23 = 123
if (CMND_POWERSET == Energy->command_code) { if ((CMND_POWERCAL == Energy->command_code) ||
(CMND_VOLTAGECAL == Energy->command_code) ||
(CMND_CURRENTCAL == Energy->command_code)) {
// Service in xdrv_03_energy.ino
}
else if (CMND_POWERSET == Energy->command_code) { // xxx.xx W
if (XdrvMailbox.data_len && Bl09XX.power[channel]) { if (XdrvMailbox.data_len && Bl09XX.power[channel]) {
XdrvMailbox.payload = (Bl09XX.power[channel] * 100) / value; XdrvMailbox.payload = (Bl09XX.power[channel] * 100) / value;
} }
} }
else if (CMND_VOLTAGESET == Energy->command_code) { else if (CMND_VOLTAGESET == Energy->command_code) { // xxx.xx V
if (XdrvMailbox.data_len && Bl09XX.voltage) { if (XdrvMailbox.data_len && Bl09XX.voltage) {
XdrvMailbox.payload = (Bl09XX.voltage * 100) / value; XdrvMailbox.payload = (Bl09XX.voltage * 100) / value;
} }
} }
else if (CMND_CURRENTSET == Energy->command_code) { else if (CMND_CURRENTSET == Energy->command_code) { // xxx.xx mA
if (XdrvMailbox.data_len && Bl09XX.current[channel]) { if (XdrvMailbox.data_len && Bl09XX.current[channel]) {
XdrvMailbox.payload = (Bl09XX.current[channel] * 100) / value; XdrvMailbox.payload = ((Bl09XX.current[channel] * 100) / value) * 1000;
} }
} }
else serviced = false; // Unknown command else serviced = false; // Unknown command

View File

@ -640,16 +640,21 @@ void Cse7761DrvInit(void) {
bool Cse7761Command(void) { bool Cse7761Command(void) {
bool serviced = true; bool serviced = true;
uint32_t channel = 0; uint32_t channel = (2 == XdrvMailbox.index) && (Energy->phase_count > 1) ? 1 : 0;
if (Energy->phase_count > 1) {
channel = (2 == XdrvMailbox.index) ? 1 : 0;
}
uint32_t value = (uint32_t)(CharToFloat(XdrvMailbox.data) * 100); // 1.23 = 123 uint32_t value = (uint32_t)(CharToFloat(XdrvMailbox.data) * 100); // 1.23 = 123
if (CMND_POWERCAL == Energy->command_code) { if (CMND_POWERCAL == Energy->command_code) {
if (1 == XdrvMailbox.payload) { XdrvMailbox.payload = Cse7761Ref(PowerPAC); } if (1 == XdrvMailbox.payload) { XdrvMailbox.payload = Cse7761Ref(PowerPAC); }
// Service in xdrv_03_energy.ino // Service in xdrv_03_energy.ino
} }
else if (CMND_VOLTAGECAL == Energy->command_code) {
if (1 == XdrvMailbox.payload) { XdrvMailbox.payload = Cse7761Ref(RmsUC); }
// Service in xdrv_03_energy.ino
}
else if (CMND_CURRENTCAL == Energy->command_code) {
if (1 == XdrvMailbox.payload) { XdrvMailbox.payload = Cse7761Ref(RmsIAC); }
// Service in xdrv_03_energy.ino
}
else if (CMND_POWERSET == Energy->command_code) { else if (CMND_POWERSET == Energy->command_code) {
if (XdrvMailbox.data_len && CSE7761Data.active_power[channel]) { if (XdrvMailbox.data_len && CSE7761Data.active_power[channel]) {
if ((value > 100) && (value < 2000000)) { // Between 1W and 20000W if ((value > 100) && (value < 2000000)) { // Between 1W and 20000W
@ -657,10 +662,6 @@ bool Cse7761Command(void) {
} }
} }
} }
else if (CMND_VOLTAGECAL == Energy->command_code) {
if (1 == XdrvMailbox.payload) { XdrvMailbox.payload = Cse7761Ref(RmsUC); }
// Service in xdrv_03_energy.ino
}
else if (CMND_VOLTAGESET == Energy->command_code) { else if (CMND_VOLTAGESET == Energy->command_code) {
if (XdrvMailbox.data_len && CSE7761Data.voltage_rms) { if (XdrvMailbox.data_len && CSE7761Data.voltage_rms) {
if ((value > 10000) && (value < 40000)) { // Between 100V and 400V if ((value > 10000) && (value < 40000)) { // Between 100V and 400V
@ -668,10 +669,6 @@ bool Cse7761Command(void) {
} }
} }
} }
else if (CMND_CURRENTCAL == Energy->command_code) {
if (1 == XdrvMailbox.payload) { XdrvMailbox.payload = Cse7761Ref(RmsIAC); }
// Service in xdrv_03_energy.ino
}
else if (CMND_CURRENTSET == Energy->command_code) { else if (CMND_CURRENTSET == Energy->command_code) {
if (XdrvMailbox.data_len && CSE7761Data.current_rms[channel]) { if (XdrvMailbox.data_len && CSE7761Data.current_rms[channel]) {
if ((value > 1000) && (value < 10000000)) { // Between 10mA and 100A if ((value > 1000) && (value < 10000000)) { // Between 10mA and 100A

View File

@ -259,7 +259,9 @@ bool Bl6523Command(void) {
int32_t value = (int32_t)(CharToFloat(XdrvMailbox.data) * 1000); // 1.234 = 1234, -1.234 = -1234 int32_t value = (int32_t)(CharToFloat(XdrvMailbox.data) * 1000); // 1.234 = 1234, -1.234 = -1234
uint32_t abs_value = abs(value) / 10; // 1.23 = 123, -1.23 = 123 uint32_t abs_value = abs(value) / 10; // 1.23 = 123, -1.23 = 123
if ((CMND_POWERCAL == Energy->command_code) || (CMND_VOLTAGECAL == Energy->command_code) || (CMND_CURRENTCAL == Energy->command_code)) { if ((CMND_POWERCAL == Energy->command_code) ||
(CMND_VOLTAGECAL == Energy->command_code) ||
(CMND_CURRENTCAL == Energy->command_code)) {
// Service in xdrv_03_energy.ino // Service in xdrv_03_energy.ino
} }
else if (CMND_POWERSET == Energy->command_code) { else if (CMND_POWERSET == Energy->command_code) {

View File

@ -90,7 +90,9 @@ bool NrgDummyCommand(void) {
int32_t value = (int32_t)(CharToFloat(XdrvMailbox.data) * 1000); // 1.234 = 1234, -1.234 = -1234 int32_t value = (int32_t)(CharToFloat(XdrvMailbox.data) * 1000); // 1.234 = 1234, -1.234 = -1234
uint32_t abs_value = abs(value) / 10; // 1.23 = 123, -1.23 = 123 uint32_t abs_value = abs(value) / 10; // 1.23 = 123, -1.23 = 123
if ((CMND_POWERCAL == Energy->command_code) || (CMND_VOLTAGECAL == Energy->command_code) || (CMND_CURRENTCAL == Energy->command_code)) { if ((CMND_POWERCAL == Energy->command_code) ||
(CMND_VOLTAGECAL == Energy->command_code) ||
(CMND_CURRENTCAL == Energy->command_code)) {
// Service in xdrv_03_energy.ino // Service in xdrv_03_energy.ino
} }
else if (CMND_POWERSET == Energy->command_code) { else if (CMND_POWERSET == Energy->command_code) {