mirror of https://github.com/arendst/Tasmota.git
6.2.1.6 Remove some commands
6.2.1.6 20180922 * Removed commands PowerCal, VoltageCal and CurrentCal as more functionality is provided by commands PowerSet, VoltageSet and CurrentSet * Allow decimals as input to commands PowerSet, VoltageSet and CurrentSet * Add support for PCA9685 12bit 16pin hardware PWM driver (#3866)
This commit is contained in:
parent
57e7005b48
commit
7a767f104c
|
@ -1,4 +1,9 @@
|
|||
/* 6.2.1.5 20180921
|
||||
/* 6.2.1.6 20180922
|
||||
* Removed commands PowerCal, VoltageCal and CurrentCal as more functionality is provided by commands PowerSet, VoltageSet and CurrentSet
|
||||
* Allow decimals as input to commands PowerSet, VoltageSet and CurrentSet
|
||||
* Add support for PCA9685 12bit 16pin hardware PWM driver (#3866)
|
||||
*
|
||||
* 6.2.1.5 20180921
|
||||
* Add authentication to HTTP web pages
|
||||
* Add energy monitoring to Shelly2 (#2789)
|
||||
* Rewrite TSL2561 driver to fix some issues (#3681)
|
||||
|
|
|
@ -287,11 +287,8 @@
|
|||
#define D_CMND_CURRENTLOW "CurrentLow"
|
||||
#define D_CMND_CURRENTHIGH "CurrentHigh"
|
||||
#define D_CMND_ENERGYRESET "EnergyReset"
|
||||
#define D_CMND_POWERCAL "PowerCal"
|
||||
#define D_CMND_POWERSET "PowerSet"
|
||||
#define D_CMND_VOLTAGECAL "VoltageCal"
|
||||
#define D_CMND_VOLTAGESET "VoltageSet"
|
||||
#define D_CMND_CURRENTCAL "CurrentCal"
|
||||
#define D_CMND_CURRENTSET "CurrentSet"
|
||||
#define D_CMND_FREQUENCYSET "FrequencySet"
|
||||
#define D_CMND_MAXPOWER "MaxPower"
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#ifndef _SONOFF_VERSION_H_
|
||||
#define _SONOFF_VERSION_H_
|
||||
|
||||
#define VERSION 0x06020105
|
||||
#define VERSION 0x06020106
|
||||
|
||||
#define D_PROGRAMNAME "Sonoff-Tasmota"
|
||||
#define D_AUTHOR "Theo Arends"
|
||||
|
|
|
@ -29,14 +29,14 @@
|
|||
enum EnergyCommands {
|
||||
CMND_POWERDELTA,
|
||||
CMND_POWERLOW, CMND_POWERHIGH, CMND_VOLTAGELOW, CMND_VOLTAGEHIGH, CMND_CURRENTLOW, CMND_CURRENTHIGH,
|
||||
CMND_POWERCAL, CMND_POWERSET, CMND_VOLTAGECAL, CMND_VOLTAGESET, CMND_CURRENTCAL, CMND_CURRENTSET, CMND_FREQUENCYSET,
|
||||
CMND_POWERSET, CMND_VOLTAGESET, CMND_CURRENTSET, CMND_FREQUENCYSET,
|
||||
CMND_ENERGYRESET, CMND_MAXENERGY, CMND_MAXENERGYSTART,
|
||||
CMND_MAXPOWER, CMND_MAXPOWERHOLD, CMND_MAXPOWERWINDOW,
|
||||
CMND_SAFEPOWER, CMND_SAFEPOWERHOLD, CMND_SAFEPOWERWINDOW };
|
||||
const char kEnergyCommands[] PROGMEM =
|
||||
D_CMND_POWERDELTA "|"
|
||||
D_CMND_POWERLOW "|" D_CMND_POWERHIGH "|" D_CMND_VOLTAGELOW "|" D_CMND_VOLTAGEHIGH "|" D_CMND_CURRENTLOW "|" D_CMND_CURRENTHIGH "|"
|
||||
D_CMND_POWERCAL "|" D_CMND_POWERSET "|" D_CMND_VOLTAGECAL "|" D_CMND_VOLTAGESET "|" D_CMND_CURRENTCAL "|" D_CMND_CURRENTSET "|" D_CMND_FREQUENCYSET "|"
|
||||
D_CMND_POWERSET "|" D_CMND_VOLTAGESET "|" D_CMND_CURRENTSET "|" D_CMND_FREQUENCYSET "|"
|
||||
D_CMND_ENERGYRESET "|" D_CMND_MAXENERGY "|" D_CMND_MAXENERGYSTART "|"
|
||||
D_CMND_MAXPOWER "|" D_CMND_MAXPOWERHOLD "|" D_CMND_MAXPOWERWINDOW "|"
|
||||
D_CMND_SAFEPOWER "|" D_CMND_SAFEPOWERHOLD "|" D_CMND_SAFEPOWERWINDOW ;
|
||||
|
@ -415,45 +415,21 @@ boolean EnergyCommand()
|
|||
command, energy_total_chr, energy_yesterday_chr, energy_daily_chr);
|
||||
status_flag = 1;
|
||||
}
|
||||
else if ((CMND_POWERCAL == command_code) && XnrgCall(FUNC_COMMAND)) {
|
||||
if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload < 32001)) {
|
||||
Settings.energy_power_calibration = (XdrvMailbox.payload > 4000) ? XdrvMailbox.payload : HLW_PREF_PULSE; // HLW = 12530, CSE = 5364
|
||||
}
|
||||
nvalue = Settings.energy_power_calibration;
|
||||
unit = UNIT_MICROSECOND;
|
||||
}
|
||||
else if ((CMND_VOLTAGECAL == command_code) && XnrgCall(FUNC_COMMAND)) {
|
||||
if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload < 32001)) {
|
||||
Settings.energy_voltage_calibration = (XdrvMailbox.payload > 999) ? XdrvMailbox.payload : HLW_UREF_PULSE; // HLW = 1950, CSE = 1912
|
||||
}
|
||||
nvalue = Settings.energy_voltage_calibration;
|
||||
unit = UNIT_MICROSECOND;
|
||||
}
|
||||
else if ((CMND_CURRENTCAL == command_code) && XnrgCall(FUNC_COMMAND)) {
|
||||
if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload < 32001)) {
|
||||
Settings.energy_current_calibration = (XdrvMailbox.payload > 1100) ? XdrvMailbox.payload : HLW_IREF_PULSE; // HLW = 3500, CSE = 16140
|
||||
}
|
||||
nvalue = Settings.energy_current_calibration;
|
||||
unit = UNIT_MICROSECOND;
|
||||
}
|
||||
else if ((CMND_POWERSET == command_code) && XnrgCall(FUNC_COMMAND)) { // Watt
|
||||
snprintf_P(command, sizeof(command), PSTR(D_CMND_POWERCAL));
|
||||
nvalue = Settings.energy_power_calibration;
|
||||
unit = UNIT_MICROSECOND;
|
||||
}
|
||||
else if ((CMND_VOLTAGESET == command_code) && XnrgCall(FUNC_COMMAND)) { // Volt
|
||||
snprintf_P(command, sizeof(command), PSTR(D_CMND_VOLTAGECAL));
|
||||
nvalue = Settings.energy_voltage_calibration;
|
||||
unit = UNIT_MICROSECOND;
|
||||
}
|
||||
else if ((CMND_CURRENTSET == command_code) && XnrgCall(FUNC_COMMAND)) { // milliAmpere
|
||||
snprintf_P(command, sizeof(command), PSTR(D_CMND_CURRENTCAL));
|
||||
nvalue = Settings.energy_current_calibration;
|
||||
unit = UNIT_MICROSECOND;
|
||||
}
|
||||
else if ((CMND_FREQUENCYSET == command_code) && XnrgCall(FUNC_COMMAND)) { // Hz
|
||||
nvalue = Settings.energy_frequency_calibration;
|
||||
unit = UNIT_HERTZ;
|
||||
unit = UNIT_MICROSECOND;
|
||||
}
|
||||
|
||||
#if FEATURE_POWER_LIMIT
|
||||
|
@ -518,6 +494,11 @@ boolean EnergyCommand()
|
|||
else serviced = false; // Unknown command
|
||||
|
||||
if (serviced && !status_flag) {
|
||||
|
||||
if (UNIT_MICROSECOND == unit) {
|
||||
snprintf_P(command, sizeof(command), PSTR("%sCal"), command);
|
||||
}
|
||||
|
||||
if (Settings.flag.value_units) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_LVALUE_SPACE_UNIT, command, nvalue, GetTextIndexed(sunit, sizeof(sunit), unit, kUnitNames));
|
||||
} else {
|
||||
|
|
|
@ -227,22 +227,19 @@ boolean HlwCommand()
|
|||
{
|
||||
boolean serviced = true;
|
||||
|
||||
if ((CMND_POWERCAL == energy_command_code) || (CMND_VOLTAGECAL == energy_command_code) || (CMND_CURRENTCAL == energy_command_code)) {
|
||||
|
||||
}
|
||||
else if (CMND_POWERSET == energy_command_code) {
|
||||
if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload < 3601) && hlw_cf_pulse_length) {
|
||||
Settings.energy_power_calibration = (XdrvMailbox.payload * 10 * hlw_cf_pulse_length) / hlw_power_ratio;
|
||||
if (CMND_POWERSET == energy_command_code) {
|
||||
if (XdrvMailbox.data_len && hlw_cf_pulse_length) {
|
||||
Settings.energy_power_calibration = ((unsigned long)(CharToDouble(XdrvMailbox.data) * 10) * hlw_cf_pulse_length) / hlw_power_ratio;
|
||||
}
|
||||
}
|
||||
else if (CMND_VOLTAGESET == energy_command_code) {
|
||||
if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload < 501) && hlw_cf1_voltage_pulse_length) {
|
||||
Settings.energy_voltage_calibration = (XdrvMailbox.payload * 10 * hlw_cf1_voltage_pulse_length) / hlw_voltage_ratio;
|
||||
if (XdrvMailbox.data_len && hlw_cf1_voltage_pulse_length) {
|
||||
Settings.energy_voltage_calibration = ((unsigned long)(CharToDouble(XdrvMailbox.data) * 10) * hlw_cf1_voltage_pulse_length) / hlw_voltage_ratio;
|
||||
}
|
||||
}
|
||||
else if (CMND_CURRENTSET == energy_command_code) {
|
||||
if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload < 16001) && hlw_cf1_current_pulse_length) {
|
||||
Settings.energy_current_calibration = (XdrvMailbox.payload * hlw_cf1_current_pulse_length) / hlw_current_ratio;
|
||||
if (XdrvMailbox.data_len && hlw_cf1_current_pulse_length) {
|
||||
Settings.energy_current_calibration = ((unsigned long)(CharToDouble(XdrvMailbox.data)) * hlw_cf1_current_pulse_length) / hlw_current_ratio;
|
||||
}
|
||||
}
|
||||
else serviced = false; // Unknown command
|
||||
|
|
|
@ -195,22 +195,19 @@ boolean CseCommand()
|
|||
{
|
||||
boolean serviced = true;
|
||||
|
||||
if ((CMND_POWERCAL == energy_command_code) || (CMND_VOLTAGECAL == energy_command_code) || (CMND_CURRENTCAL == energy_command_code)) {
|
||||
|
||||
}
|
||||
else if (CMND_POWERSET == energy_command_code) {
|
||||
if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload < 3601) && power_cycle) {
|
||||
Settings.energy_power_calibration = (XdrvMailbox.payload * power_cycle) / CSE_PREF;
|
||||
if (CMND_POWERSET == energy_command_code) {
|
||||
if (XdrvMailbox.data_len && power_cycle) {
|
||||
Settings.energy_power_calibration = ((unsigned long)CharToDouble(XdrvMailbox.data) * power_cycle) / CSE_PREF;
|
||||
}
|
||||
}
|
||||
else if (CMND_VOLTAGESET == energy_command_code) {
|
||||
if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload < 501) && voltage_cycle) {
|
||||
Settings.energy_voltage_calibration = (XdrvMailbox.payload * voltage_cycle) / CSE_UREF;
|
||||
if (XdrvMailbox.data_len && voltage_cycle) {
|
||||
Settings.energy_voltage_calibration = ((unsigned long)CharToDouble(XdrvMailbox.data) * voltage_cycle) / CSE_UREF;
|
||||
}
|
||||
}
|
||||
else if (CMND_CURRENTSET == energy_command_code) {
|
||||
if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload < 16001) && current_cycle) {
|
||||
Settings.energy_current_calibration = (XdrvMailbox.payload * current_cycle) / 1000;
|
||||
if (XdrvMailbox.data_len && current_cycle) {
|
||||
Settings.energy_current_calibration = ((unsigned long)CharToDouble(XdrvMailbox.data) * current_cycle) / 1000;
|
||||
}
|
||||
}
|
||||
else serviced = false; // Unknown command
|
||||
|
|
|
@ -637,16 +637,7 @@ boolean McpCommand()
|
|||
{
|
||||
boolean serviced = true;
|
||||
|
||||
if ((CMND_POWERCAL == energy_command_code) || (CMND_VOLTAGECAL == energy_command_code) || (CMND_CURRENTCAL == energy_command_code)) {
|
||||
|
||||
// MCP Debug commands - PowerCal <payload>
|
||||
// if (1 == XdrvMailbox.payload) { McpSingleWireStart(); }
|
||||
// if (2 == XdrvMailbox.payload) { McpSingleWireStop(0); }
|
||||
// if (3 == XdrvMailbox.payload) { McpGetAddress(); }
|
||||
|
||||
serviced = false;
|
||||
}
|
||||
else if (CMND_POWERSET == energy_command_code) {
|
||||
if (CMND_POWERSET == energy_command_code) {
|
||||
if (XdrvMailbox.data_len && mcp_output_registers.active_power) {
|
||||
Settings.energy_power_calibration = (unsigned long)(CharToDouble(XdrvMailbox.data) * 100);
|
||||
mcp_calibration_setpoint.calibration_active_power = Settings.energy_power_calibration;
|
||||
|
|
Loading…
Reference in New Issue