Fix: Apply inverter settings only once and not for each channel
This commit is contained in:
parent
35aa835891
commit
b27a476507
@ -214,21 +214,21 @@ void WebApiInverterClass::onInverterEdit(AsyncWebServerRequest* request)
|
|||||||
inverter.Serial = new_serial;
|
inverter.Serial = new_serial;
|
||||||
strncpy(inverter.Name, root["name"].as<String>().c_str(), INV_MAX_NAME_STRLEN);
|
strncpy(inverter.Name, root["name"].as<String>().c_str(), INV_MAX_NAME_STRLEN);
|
||||||
|
|
||||||
|
inverter.Poll_Enable = root["poll_enable"] | true;
|
||||||
|
inverter.Poll_Enable_Night = root["poll_enable_night"] | true;
|
||||||
|
inverter.Command_Enable = root["command_enable"] | true;
|
||||||
|
inverter.Command_Enable_Night = root["command_enable_night"] | true;
|
||||||
|
inverter.ReachableThreshold = root["reachable_threshold"] | REACHABLE_THRESHOLD;
|
||||||
|
inverter.ZeroRuntimeDataIfUnrechable = root["zero_runtime"] | false;
|
||||||
|
inverter.ZeroYieldDayOnMidnight = root["zero_day"] | false;
|
||||||
|
inverter.ClearEventlogOnMidnight = root["clear_eventlog"] | false;
|
||||||
|
inverter.YieldDayCorrection = root["yieldday_correction"] | false;
|
||||||
|
|
||||||
uint8_t arrayCount = 0;
|
uint8_t arrayCount = 0;
|
||||||
for (JsonVariant channel : channelArray) {
|
for (JsonVariant channel : channelArray) {
|
||||||
inverter.channel[arrayCount].MaxChannelPower = channel["max_power"].as<uint16_t>();
|
inverter.channel[arrayCount].MaxChannelPower = channel["max_power"].as<uint16_t>();
|
||||||
inverter.channel[arrayCount].YieldTotalOffset = channel["yield_total_offset"].as<float>();
|
inverter.channel[arrayCount].YieldTotalOffset = channel["yield_total_offset"].as<float>();
|
||||||
strncpy(inverter.channel[arrayCount].Name, channel["name"] | "", sizeof(inverter.channel[arrayCount].Name));
|
strncpy(inverter.channel[arrayCount].Name, channel["name"] | "", sizeof(inverter.channel[arrayCount].Name));
|
||||||
inverter.Poll_Enable = root["poll_enable"] | true;
|
|
||||||
inverter.Poll_Enable_Night = root["poll_enable_night"] | true;
|
|
||||||
inverter.Command_Enable = root["command_enable"] | true;
|
|
||||||
inverter.Command_Enable_Night = root["command_enable_night"] | true;
|
|
||||||
inverter.ReachableThreshold = root["reachable_threshold"] | REACHABLE_THRESHOLD;
|
|
||||||
inverter.ZeroRuntimeDataIfUnrechable = root["zero_runtime"] | false;
|
|
||||||
inverter.ZeroYieldDayOnMidnight = root["zero_day"] | false;
|
|
||||||
inverter.ClearEventlogOnMidnight = root["clear_eventlog"] | false;
|
|
||||||
inverter.YieldDayCorrection = root["yieldday_correction"] | false;
|
|
||||||
|
|
||||||
arrayCount++;
|
arrayCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user