mirror of https://github.com/arendst/Tasmota.git
Add SetOption150
Add SetOption150 - (Energy) Force no voltage/frequency common allowing individual voltage channel calibration.
This commit is contained in:
parent
438b235dc8
commit
db581b15c7
|
@ -183,7 +183,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
|
||||||
uint32_t mqtt_disable_sserialrec : 1; // bit 1 (v12.1.1.2) - SetOption147 - (MQTT) Disable publish SSerialReceived MQTT messages, you must use event trigger rules instead.
|
uint32_t mqtt_disable_sserialrec : 1; // bit 1 (v12.1.1.2) - SetOption147 - (MQTT) Disable publish SSerialReceived MQTT messages, you must use event trigger rules instead.
|
||||||
uint32_t artnet_autorun : 1; // bit 2 (v12.2.0.4) - SetOption148 - (Light) start DMX ArtNet at boot, listen to UDP port as soon as network is up
|
uint32_t artnet_autorun : 1; // bit 2 (v12.2.0.4) - SetOption148 - (Light) start DMX ArtNet at boot, listen to UDP port as soon as network is up
|
||||||
uint32_t dns_ipv6_priority : 1; // bit 3 (v12.2.0.6) - SetOption149 - (Wifi) prefer IPv6 DNS resolution to IPv4 address when available. Requires `#define USE_IPV6`
|
uint32_t dns_ipv6_priority : 1; // bit 3 (v12.2.0.6) - SetOption149 - (Wifi) prefer IPv6 DNS resolution to IPv4 address when available. Requires `#define USE_IPV6`
|
||||||
uint32_t spare04 : 1; // bit 4
|
uint32_t no_voltage_common : 1; // bit 4 (v12.3.1.5) - SetOption150 - (Energy) Force no voltage/frequency common
|
||||||
uint32_t spare05 : 1; // bit 5
|
uint32_t spare05 : 1; // bit 5
|
||||||
uint32_t spare06 : 1; // bit 6
|
uint32_t spare06 : 1; // bit 6
|
||||||
uint32_t spare07 : 1; // bit 7
|
uint32_t spare07 : 1; // bit 7
|
||||||
|
|
|
@ -1200,7 +1200,10 @@ const char HTTP_ENERGY_SNS3[] PROGMEM =
|
||||||
#endif // USE_WEBSERVER
|
#endif // USE_WEBSERVER
|
||||||
|
|
||||||
void EnergyShow(bool json) {
|
void EnergyShow(bool json) {
|
||||||
if (Energy->voltage_common) {
|
bool voltage_common = (Settings->flag6.no_voltage_common) ? false : Energy->voltage_common;
|
||||||
|
bool frequency_common = (Settings->flag6.no_voltage_common) ? false : Energy->frequency_common;
|
||||||
|
|
||||||
|
if (voltage_common) {
|
||||||
for (uint32_t i = 0; i < Energy->phase_count; i++) {
|
for (uint32_t i = 0; i < Energy->phase_count; i++) {
|
||||||
Energy->voltage[i] = Energy->voltage[0];
|
Energy->voltage[i] = Energy->voltage[0];
|
||||||
}
|
}
|
||||||
|
@ -1333,12 +1336,12 @@ void EnergyShow(bool json) {
|
||||||
}
|
}
|
||||||
if (!isnan(Energy->frequency[0])) {
|
if (!isnan(Energy->frequency[0])) {
|
||||||
ResponseAppend_P(PSTR(",\"" D_JSON_FREQUENCY "\":%s"),
|
ResponseAppend_P(PSTR(",\"" D_JSON_FREQUENCY "\":%s"),
|
||||||
EnergyFormat(value_chr, Energy->frequency, Settings->flag2.frequency_resolution, Energy->frequency_common));
|
EnergyFormat(value_chr, Energy->frequency, Settings->flag2.frequency_resolution, frequency_common));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Energy->voltage_available) {
|
if (Energy->voltage_available) {
|
||||||
ResponseAppend_P(PSTR(",\"" D_JSON_VOLTAGE "\":%s"),
|
ResponseAppend_P(PSTR(",\"" D_JSON_VOLTAGE "\":%s"),
|
||||||
EnergyFormat(value_chr, Energy->voltage, Settings->flag2.voltage_resolution, Energy->voltage_common));
|
EnergyFormat(value_chr, Energy->voltage, Settings->flag2.voltage_resolution, voltage_common));
|
||||||
}
|
}
|
||||||
if (Energy->current_available) {
|
if (Energy->current_available) {
|
||||||
ResponseAppend_P(PSTR(",\"" D_JSON_CURRENT "\":%s"),
|
ResponseAppend_P(PSTR(",\"" D_JSON_CURRENT "\":%s"),
|
||||||
|
@ -1397,7 +1400,7 @@ void EnergyShow(bool json) {
|
||||||
// {s}</th><th></th><th>Head1</th><th></th><th>Head2</th><th></th><th>Head3</th><th></th><td>{e}
|
// {s}</th><th></th><th>Head1</th><th></th><th>Head2</th><th></th><th>Head3</th><th></th><td>{e}
|
||||||
// {s}</th><th></th><th>Head1</th><th></th><th>Head2</th><th></th><th>Head3</th><th></th><th>Head4</th><th></th><td>{e}
|
// {s}</th><th></th><th>Head1</th><th></th><th>Head2</th><th></th><th>Head3</th><th></th><th>Head4</th><th></th><td>{e}
|
||||||
WSContentSend_P(PSTR("</table><hr/>{t}{s}</th><th></th>")); // First column is empty ({t} = <table style='width:100%'>, {s} = <tr><th>)
|
WSContentSend_P(PSTR("</table><hr/>{t}{s}</th><th></th>")); // First column is empty ({t} = <table style='width:100%'>, {s} = <tr><th>)
|
||||||
bool label_o = Energy->voltage_common;
|
bool label_o = voltage_common;
|
||||||
bool no_label = (1 == Energy->phase_count);
|
bool no_label = (1 == Energy->phase_count);
|
||||||
for (uint32_t i = 0; i < Energy->phase_count; i++) {
|
for (uint32_t i = 0; i < Energy->phase_count; i++) {
|
||||||
WSContentSend_P(PSTR("<th style='text-align:center'>%s%s<th></th>"), (no_label)?"":(label_o)?"O":"L", (no_label)?"":itoa(i +1, value_chr, 10));
|
WSContentSend_P(PSTR("<th style='text-align:center'>%s%s<th></th>"), (no_label)?"":(label_o)?"O":"L", (no_label)?"":itoa(i +1, value_chr, 10));
|
||||||
|
@ -1405,12 +1408,12 @@ void EnergyShow(bool json) {
|
||||||
WSContentSend_P(PSTR("<td>{e}")); // Last column is units ({e} = </td></tr>)
|
WSContentSend_P(PSTR("<td>{e}")); // Last column is units ({e} = </td></tr>)
|
||||||
#endif // USE_ENERGY_COLUMN_GUI
|
#endif // USE_ENERGY_COLUMN_GUI
|
||||||
if (Energy->voltage_available) {
|
if (Energy->voltage_available) {
|
||||||
WSContentSend_PD(HTTP_SNS_VOLTAGE, WebEnergyFormat(value_chr, Energy->voltage, Settings->flag2.voltage_resolution, Energy->voltage_common));
|
WSContentSend_PD(HTTP_SNS_VOLTAGE, WebEnergyFormat(value_chr, Energy->voltage, Settings->flag2.voltage_resolution, voltage_common));
|
||||||
}
|
}
|
||||||
if (!Energy->type_dc) {
|
if (!Energy->type_dc) {
|
||||||
if (!isnan(Energy->frequency[0])) {
|
if (!isnan(Energy->frequency[0])) {
|
||||||
WSContentSend_PD(PSTR("{s}" D_FREQUENCY "{m}%s " D_UNIT_HERTZ "{e}"),
|
WSContentSend_PD(PSTR("{s}" D_FREQUENCY "{m}%s " D_UNIT_HERTZ "{e}"),
|
||||||
WebEnergyFormat(value_chr, Energy->frequency, Settings->flag2.frequency_resolution, Energy->frequency_common));
|
WebEnergyFormat(value_chr, Energy->frequency, Settings->flag2.frequency_resolution, frequency_common));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Energy->current_available) {
|
if (Energy->current_available) {
|
||||||
|
|
|
@ -1416,7 +1416,10 @@ const char HTTP_ENERGY_SNS3[] PROGMEM =
|
||||||
#endif // USE_WEBSERVER
|
#endif // USE_WEBSERVER
|
||||||
|
|
||||||
void EnergyShow(bool json) {
|
void EnergyShow(bool json) {
|
||||||
if (Energy->voltage_common) {
|
bool voltage_common = (Settings->flag6.no_voltage_common) ? false : Energy->voltage_common;
|
||||||
|
bool frequency_common = (Settings->flag6.no_voltage_common) ? false : Energy->frequency_common;
|
||||||
|
|
||||||
|
if (voltage_common) {
|
||||||
for (uint32_t i = 0; i < Energy->phase_count; i++) {
|
for (uint32_t i = 0; i < Energy->phase_count; i++) {
|
||||||
Energy->voltage[i] = Energy->voltage[0];
|
Energy->voltage[i] = Energy->voltage[0];
|
||||||
}
|
}
|
||||||
|
@ -1549,12 +1552,12 @@ void EnergyShow(bool json) {
|
||||||
}
|
}
|
||||||
if (!isnan(Energy->frequency[0])) {
|
if (!isnan(Energy->frequency[0])) {
|
||||||
ResponseAppend_P(PSTR(",\"" D_JSON_FREQUENCY "\":%s"),
|
ResponseAppend_P(PSTR(",\"" D_JSON_FREQUENCY "\":%s"),
|
||||||
EnergyFormat(value_chr, Energy->frequency, Settings->flag2.frequency_resolution, Energy->frequency_common));
|
EnergyFormat(value_chr, Energy->frequency, Settings->flag2.frequency_resolution, frequency_common));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Energy->voltage_available) {
|
if (Energy->voltage_available) {
|
||||||
ResponseAppend_P(PSTR(",\"" D_JSON_VOLTAGE "\":%s"),
|
ResponseAppend_P(PSTR(",\"" D_JSON_VOLTAGE "\":%s"),
|
||||||
EnergyFormat(value_chr, Energy->voltage, Settings->flag2.voltage_resolution, Energy->voltage_common));
|
EnergyFormat(value_chr, Energy->voltage, Settings->flag2.voltage_resolution, voltage_common));
|
||||||
}
|
}
|
||||||
if (Energy->current_available) {
|
if (Energy->current_available) {
|
||||||
ResponseAppend_P(PSTR(",\"" D_JSON_CURRENT "\":%s"),
|
ResponseAppend_P(PSTR(",\"" D_JSON_CURRENT "\":%s"),
|
||||||
|
@ -1636,7 +1639,7 @@ void EnergyShow(bool json) {
|
||||||
if (Energy->gui_count > Energy->Settings.gui_cols) { Energy->gui_count = Energy->Settings.gui_cols; }
|
if (Energy->gui_count > Energy->Settings.gui_cols) { Energy->gui_count = Energy->Settings.gui_cols; }
|
||||||
|
|
||||||
WSContentSend_P(PSTR("</table><hr/>")); // Close current table as we will use different column count
|
WSContentSend_P(PSTR("</table><hr/>")); // Close current table as we will use different column count
|
||||||
bool label_o = Energy->voltage_common;
|
bool label_o = voltage_common;
|
||||||
if (ENERGY_DISPLAY_TABS == Energy->Settings.gui_display) {
|
if (ENERGY_DISPLAY_TABS == Energy->Settings.gui_display) {
|
||||||
uint32_t tabs = (relay_show -1 + Energy->Settings.gui_cols) / Energy->Settings.gui_cols;
|
uint32_t tabs = (relay_show -1 + Energy->Settings.gui_cols) / Energy->Settings.gui_cols;
|
||||||
if (tabs > 1) {
|
if (tabs > 1) {
|
||||||
|
@ -1668,12 +1671,12 @@ void EnergyShow(bool json) {
|
||||||
WSContentSend_P(PSTR("<td>{e}")); // Last column is units ({e} = </td></tr>)
|
WSContentSend_P(PSTR("<td>{e}")); // Last column is units ({e} = </td></tr>)
|
||||||
#endif // USE_ENERGY_COLUMN_GUI
|
#endif // USE_ENERGY_COLUMN_GUI
|
||||||
if (Energy->voltage_available) {
|
if (Energy->voltage_available) {
|
||||||
WSContentSend_PD(HTTP_SNS_VOLTAGE, WebEnergyFormat(value_chr, Energy->voltage, Settings->flag2.voltage_resolution, Energy->voltage_common));
|
WSContentSend_PD(HTTP_SNS_VOLTAGE, WebEnergyFormat(value_chr, Energy->voltage, Settings->flag2.voltage_resolution, voltage_common));
|
||||||
}
|
}
|
||||||
if (!Energy->type_dc) {
|
if (!Energy->type_dc) {
|
||||||
if (!isnan(Energy->frequency[0])) {
|
if (!isnan(Energy->frequency[0])) {
|
||||||
WSContentSend_PD(PSTR("{s}" D_FREQUENCY "{m}%s " D_UNIT_HERTZ "{e}"),
|
WSContentSend_PD(PSTR("{s}" D_FREQUENCY "{m}%s " D_UNIT_HERTZ "{e}"),
|
||||||
WebEnergyFormat(value_chr, Energy->frequency, Settings->flag2.frequency_resolution, Energy->frequency_common));
|
WebEnergyFormat(value_chr, Energy->frequency, Settings->flag2.frequency_resolution, frequency_common));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Energy->current_available) {
|
if (Energy->current_available) {
|
||||||
|
|
|
@ -205,7 +205,8 @@ a_setoption = [[
|
||||||
"(MQTT) Disable publish SSerialReceived MQTT messages, you must use event trigger rules instead",
|
"(MQTT) Disable publish SSerialReceived MQTT messages, you must use event trigger rules instead",
|
||||||
"(Light) start DMX ArtNet at boot, listen to UDP port as soon as network is up",
|
"(Light) start DMX ArtNet at boot, listen to UDP port as soon as network is up",
|
||||||
"(Wifi) prefer IPv6 DNS resolution to IPv4 address when available. Requires `#define USE_IPV6`",
|
"(Wifi) prefer IPv6 DNS resolution to IPv4 address when available. Requires `#define USE_IPV6`",
|
||||||
"","","","",
|
"(Energy) Force no voltage/frequency common",
|
||||||
|
"","","",
|
||||||
"","","","",
|
"","","","",
|
||||||
"","","","",
|
"","","","",
|
||||||
"","","","",
|
"","","","",
|
||||||
|
@ -322,7 +323,7 @@ else:
|
||||||
obj = json.load(fp)
|
obj = json.load(fp)
|
||||||
|
|
||||||
def StartDecode():
|
def StartDecode():
|
||||||
print ("\n*** decode-status.py v12.3.1.2 by Theo Arends and Jacek Ziolkowski ***")
|
print ("\n*** decode-status.py v12.3.1.5 by Theo Arends and Jacek Ziolkowski ***")
|
||||||
|
|
||||||
# print("Decoding\n{}".format(obj))
|
# print("Decoding\n{}".format(obj))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue