mirror of
https://github.com/lumapu/ahoy.git
synced 2025-07-23 19:27:13 +02:00
0.8.2
* beautified inverter settings in `setup` (preperation for future, settings become more inverter dependent)
This commit is contained in:
parent
e550111f95
commit
975f6923d3
12 changed files with 223 additions and 166 deletions
|
@ -487,44 +487,6 @@ class Web {
|
|||
request->arg("ipGateway").toCharArray(buf, 20);
|
||||
ah::ip2Arr(mConfig->sys.ip.gateway, buf);
|
||||
|
||||
// inverter
|
||||
Inverter<> *iv;
|
||||
for (uint8_t i = 0; i < MAX_NUM_INVERTERS; i++) {
|
||||
iv = mSys->getInverterByPos(i, false);
|
||||
// enable communication
|
||||
iv->config->enabled = (request->arg("inv" + String(i) + "Enable") == "on");
|
||||
// address
|
||||
request->arg("inv" + String(i) + "Addr").toCharArray(buf, 20);
|
||||
if (strlen(buf) == 0)
|
||||
memset(buf, 0, 20);
|
||||
iv->config->serial.u64 = ah::Serial2u64(buf);
|
||||
switch(iv->config->serial.b[4]) {
|
||||
case 0x24:
|
||||
case 0x22:
|
||||
case 0x21: iv->type = INV_TYPE_1CH; iv->channels = 1; break;
|
||||
|
||||
case 0x44:
|
||||
case 0x42:
|
||||
case 0x41: iv->type = INV_TYPE_2CH; iv->channels = 2; break;
|
||||
|
||||
case 0x64:
|
||||
case 0x62:
|
||||
case 0x61: iv->type = INV_TYPE_4CH; iv->channels = 4; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
// name
|
||||
request->arg("inv" + String(i) + "Name").toCharArray(iv->config->name, MAX_NAME_LENGTH);
|
||||
|
||||
// max channel power / name
|
||||
for (uint8_t j = 0; j < 6; j++) {
|
||||
iv->config->yieldCor[j] = request->arg("inv" + String(i) + "YieldCor" + String(j)).toDouble();
|
||||
iv->config->chMaxPwr[j] = request->arg("inv" + String(i) + "ModPwr" + String(j)).toInt() & 0xffff;
|
||||
request->arg("inv" + String(i) + "ModName" + String(j)).toCharArray(iv->config->chName[j], MAX_NAME_LENGTH);
|
||||
}
|
||||
iv->initialized = true;
|
||||
}
|
||||
|
||||
if (request->arg("invInterval") != "")
|
||||
mConfig->nrf.sendInterval = request->arg("invInterval").toInt();
|
||||
mConfig->inst.rstYieldMidNight = (request->arg("invRstMid") == "on");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue