mirror of https://github.com/arendst/Tasmota.git
command EnergyConfig
This commit is contained in:
parent
3bb01daf7e
commit
e9e0d35368
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
enum EnergyCommands {
|
enum EnergyCommands {
|
||||||
CMND_POWERCAL, CMND_VOLTAGECAL, CMND_CURRENTCAL, CMND_FREQUENCYCAL,
|
CMND_POWERCAL, CMND_VOLTAGECAL, CMND_CURRENTCAL, CMND_FREQUENCYCAL,
|
||||||
CMND_POWERSET, CMND_VOLTAGESET, CMND_CURRENTSET, CMND_FREQUENCYSET, CMND_MODULEADDRESS };
|
CMND_POWERSET, CMND_VOLTAGESET, CMND_CURRENTSET, CMND_FREQUENCYSET, CMND_MODULEADDRESS, CMND_NRGCONFIG };
|
||||||
|
|
||||||
const char kEnergyCommands[] PROGMEM = "|" // No prefix
|
const char kEnergyCommands[] PROGMEM = "|" // No prefix
|
||||||
D_CMND_POWERCAL "|" D_CMND_VOLTAGECAL "|" D_CMND_CURRENTCAL "|" D_CMND_FREQUENCYCAL "|"
|
D_CMND_POWERCAL "|" D_CMND_VOLTAGECAL "|" D_CMND_CURRENTCAL "|" D_CMND_FREQUENCYCAL "|"
|
||||||
|
@ -56,7 +56,7 @@ const char kEnergyCommands[] PROGMEM = "|" // No prefix
|
||||||
D_CMND_SAFEPOWER "|" D_CMND_SAFEPOWERHOLD "|" D_CMND_SAFEPOWERWINDOW "|"
|
D_CMND_SAFEPOWER "|" D_CMND_SAFEPOWERHOLD "|" D_CMND_SAFEPOWERWINDOW "|"
|
||||||
#endif // USE_ENERGY_POWER_LIMIT
|
#endif // USE_ENERGY_POWER_LIMIT
|
||||||
#endif // USE_ENERGY_MARGIN_DETECTION
|
#endif // USE_ENERGY_MARGIN_DETECTION
|
||||||
D_CMND_ENERGYRESET "|" D_CMND_TARIFF ;
|
D_CMND_ENERGYRESET "|" D_CMND_TARIFF "|EnergyConfig";
|
||||||
|
|
||||||
void (* const EnergyCommand[])(void) PROGMEM = {
|
void (* const EnergyCommand[])(void) PROGMEM = {
|
||||||
&CmndPowerCal, &CmndVoltageCal, &CmndCurrentCal, &CmndFrequencyCal,
|
&CmndPowerCal, &CmndVoltageCal, &CmndCurrentCal, &CmndFrequencyCal,
|
||||||
|
@ -69,7 +69,7 @@ void (* const EnergyCommand[])(void) PROGMEM = {
|
||||||
&CmndSafePower, &CmndSafePowerHold, &CmndSafePowerWindow,
|
&CmndSafePower, &CmndSafePowerHold, &CmndSafePowerWindow,
|
||||||
#endif // USE_ENERGY_POWER_LIMIT
|
#endif // USE_ENERGY_POWER_LIMIT
|
||||||
#endif // USE_ENERGY_MARGIN_DETECTION
|
#endif // USE_ENERGY_MARGIN_DETECTION
|
||||||
&CmndEnergyReset, &CmndTariff };
|
&CmndEnergyReset, &CmndTariff, &CmndEnergyConfig };
|
||||||
|
|
||||||
const char kEnergyPhases[] PROGMEM = "|%s / %s|%s / %s / %s||[%s,%s]|[%s,%s,%s]";
|
const char kEnergyPhases[] PROGMEM = "|%s / %s|%s / %s / %s||[%s,%s]|[%s,%s,%s]";
|
||||||
|
|
||||||
|
@ -761,6 +761,14 @@ void CmndModuleAddress(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CmndEnergyConfig(void) {
|
||||||
|
AddLog_P(LOG_LEVEL_DEBUG, PSTR("NRG: xdrv_03 index:%d"), XdrvMailbox.index);
|
||||||
|
Energy.command_code = CMND_NRGCONFIG;
|
||||||
|
if (XnrgCall(FUNC_COMMAND)) {
|
||||||
|
ResponseCmndDone();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef USE_ENERGY_MARGIN_DETECTION
|
#ifdef USE_ENERGY_MARGIN_DETECTION
|
||||||
void CmndPowerDelta(void) {
|
void CmndPowerDelta(void) {
|
||||||
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= ENERGY_MAX_PHASES)) {
|
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= ENERGY_MAX_PHASES)) {
|
||||||
|
|
|
@ -99,6 +99,9 @@ bool NrgDummyCommand(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (CMND_NRGCONFIG == Energy.command_code) {
|
||||||
|
AddLog_P(LOG_LEVEL_DEBUG, PSTR("NRG: Config payload:%d, data:'%s'"), XdrvMailbox.payload, XdrvMailbox.data ? XdrvMailbox.data : "null" );
|
||||||
|
}
|
||||||
else serviced = false; // Unknown command
|
else serviced = false; // Unknown command
|
||||||
|
|
||||||
return serviced;
|
return serviced;
|
||||||
|
|
Loading…
Reference in New Issue