Browse Source

several HMS / HMT related changes

pull/935/head
lumapu 2 years ago
parent
commit
b8533cc17d
  1. 4
      src/app.cpp
  2. 10
      src/config/settings.h
  3. 10
      src/hm/hmDefines.h
  4. 6
      src/hm/hmInverter.h
  5. 27
      src/hm/hmSystem.h
  6. 10
      src/hm/miPayload.h
  7. 155
      src/hms/hmsDefines.h
  8. 4
      src/hms/hmsPayload.h
  9. 15
      src/web/html/setup.html
  10. 10
      src/web/web.h

4
src/app.cpp

@ -162,7 +162,7 @@ void app::loopStandard(void) {
Inverter<> *iv = mSys.findInverter(&p->data[2]);
if(NULL != iv) {
if(IV_HMS == iv->ivGen)
if((iv->ivGen == IV_HMS) || (iv->ivGen == IV_HMT))
mHmsPayload.add(iv, p);
}
mCmtRadio.mBufCtrl.pop();
@ -405,7 +405,7 @@ void app::tickSend(void) {
else if(iv->ivGen == IV_MI)
mMiPayload.ivSend(iv);
#if defined(ESP32)
else if(iv->ivGen == IV_HMS)
else if((iv->ivGen == IV_HMS) || (iv->ivGen == IV_HMT))
mHmsPayload.ivSend(iv);
#endif
}

10
src/config/settings.h

@ -129,9 +129,9 @@ typedef struct {
bool enabled;
char name[MAX_NAME_LENGTH];
serial_u serial;
uint16_t chMaxPwr[4];
int32_t yieldCor[4]; // signed YieldTotal correction value
char chName[4][MAX_NAME_LENGTH];
uint16_t chMaxPwr[6];
int32_t yieldCor[6]; // signed YieldTotal correction value
char chName[6][MAX_NAME_LENGTH];
} cfgIv_t;
typedef struct {
@ -634,7 +634,7 @@ class settings {
obj[F("en")] = (bool)cfg->enabled;
obj[F("name")] = cfg->name;
obj[F("sn")] = cfg->serial.u64;
for(uint8_t i = 0; i < 4; i++) {
for(uint8_t i = 0; i < 6; i++) {
obj[F("yield")][i] = cfg->yieldCor[i];
obj[F("pwr")][i] = cfg->chMaxPwr[i];
obj[F("chName")][i] = cfg->chName[i];
@ -643,7 +643,7 @@ class settings {
getVal<bool>(obj, F("en"), &cfg->enabled);
getChar(obj, F("name"), cfg->name, MAX_NAME_LENGTH);
getVal<uint64_t>(obj, F("sn"), &cfg->serial.u64);
for(uint8_t i = 0; i < 4; i++) {
for(uint8_t i = 0; i < (sizeof(obj[F("yield")])/sizeof(int32_t)); i++) {
if(obj.containsKey(F("yield"))) cfg->yieldCor[i] = obj[F("yield")][i];
if(obj.containsKey(F("pwr"))) cfg->chMaxPwr[i] = obj[F("pwr")][i];
if(obj.containsKey(F("chName"))) snprintf(cfg->chName[i], MAX_NAME_LENGTH, "%s", obj[F("chName")][i].as<const char*>());

10
src/hm/hmDefines.h

@ -18,13 +18,15 @@ const char* const units[] = {"V", "A", "W", "Wh", "kWh", "Hz", "°C", "%", "var"
// field types
enum {FLD_UDC = 0, FLD_IDC, FLD_PDC, FLD_YD, FLD_YW, FLD_YT,
FLD_UAC, FLD_IAC, FLD_PAC, FLD_F, FLD_T, FLD_PF, FLD_EFF,
FLD_UAC, FLD_UAC_1N, FLD_UAC_2N, FLD_UAC_3N, FLD_UAC_12, FLD_UAC_23, FLD_UAC_31, FLD_IAC,
FLD_IAC_1, FLD_IAC_2, FLD_IAC_3, FLD_PAC, FLD_F, FLD_T, FLD_PF, FLD_EFF,
FLD_IRR, FLD_Q, FLD_EVT, FLD_FW_VERSION, FLD_FW_BUILD_YEAR,
FLD_FW_BUILD_MONTH_DAY, FLD_FW_BUILD_HOUR_MINUTE, FLD_HW_ID,
FLD_ACT_ACTIVE_PWR_LIMIT, /*FLD_ACT_REACTIVE_PWR_LIMIT, FLD_ACT_PF,*/ FLD_LAST_ALARM_CODE};
const char* const fields[] = {"U_DC", "I_DC", "P_DC", "YieldDay", "YieldWeek", "YieldTotal",
"U_AC", "I_AC", "P_AC", "F_AC", "Temp", "PF_AC", "Efficiency", "Irradiation","Q_AC",
"U_AC", "U_AC_1N", "U_AC_2N", "U_AC_3N", "UAC_12", "UAC_23", "UAC_31", "I_AC",
"IAC_1", "I_AC_2", "I_AC_3", "P_AC", "F_AC", "Temp", "PF_AC", "Efficiency", "Irradiation","Q_AC",
"ALARM_MES_ID","FWVersion","FWBuildYear","FWBuildMonthDay","FWBuildHourMinute","HWPartId",
"active_PowerLimit", /*"reactivePowerLimit","Powerfactor",*/ "LastAlarmCode"};
const char* const notAvail = "n/a";
@ -67,9 +69,9 @@ enum {CMD_CALC = 0xffff};
// CH0 is default channel (freq, ac, temp)
enum {CH0 = 0, CH1, CH2, CH3, CH4};
enum {CH0 = 0, CH1, CH2, CH3, CH4, CH5, CH6};
enum {INV_TYPE_1CH = 0, INV_TYPE_2CH, INV_TYPE_4CH};
enum {INV_TYPE_1CH = 0, INV_TYPE_2CH, INV_TYPE_4CH, INV_TYPE_6CH};
typedef struct {

6
src/hm/hmInverter.h

@ -445,6 +445,12 @@ class Inverter {
}
channels = 4;
}
else if (INV_TYPE_6CH == type) {
rec->length = (uint8_t)(HMT6CH_LIST_LEN);
rec->assign = (byteAssign_t *)hmt6chAssignment;
rec->pyldLen = HMT6CH_PAYLOAD_LEN;
channels = 6;
}
else {
rec->length = 0;
rec->assign = NULL;

27
src/hm/hmSystem.h

@ -29,9 +29,10 @@ class HmSystem {
DBGPRINT("HMS");
else
DBGPRINT("HM");
} else {
} else if(iv->config->serial.b[5] == 0x13)
DBGPRINT("HMT");
else
DBGPRINT(((iv->config->serial.b[4] & 0x03) == 0x01) ? " (2nd Gen) " : " (3rd Gen) ");
}
DBGPRINTLN(String(iv->config->serial.u64, HEX));
@ -55,13 +56,21 @@ class HmSystem {
DPRINTLN(DBG_VERBOSE, " " + String(p->config->serial.b[4], HEX));
if((p->config->serial.b[5] == 0x11) || (p->config->serial.b[5] == 0x10)) {
switch(p->config->serial.b[4]) {
case 0x24: // HMS-500
case 0x22:
case 0x21: p->type = INV_TYPE_1CH; break;
case 0x21: p->type = INV_TYPE_1CH;
break;
case 0x44: // HMS-1000
case 0x42:
case 0x41: p->type = INV_TYPE_2CH; break;
case 0x64: // HMS2000
case 0x41: p->type = INV_TYPE_2CH;
break;
case 0x64: // HMS-2000
case 0x62:
case 0x61: p->type = INV_TYPE_4CH; break;
case 0x61: p->type = INV_TYPE_4CH;
break;
default:
DPRINTLN(DBG_ERROR, F("unknown inverter type"));
break;
@ -77,8 +86,10 @@ class HmSystem {
p->ivGen = IV_HM;
else // MI 2nd Gen
p->ivGen = IV_MI;
}
else if(p->config->serial.u64 != 0ULL)
} else if(p->config->serial.b[5] == 0x13) {
p->ivGen = IV_HMT;
p->type = INV_TYPE_6CH;
} else if(p->config->serial.u64 != 0ULL)
DPRINTLN(DBG_ERROR, F("inverter type can't be detected!"));
p->init();

10
src/hm/miPayload.h

@ -148,10 +148,10 @@ class MiPayload {
if (cmd == 0x01 || cmd == SystemConfigPara ) { //0x1 and 0x05 for HM-types
cmd = 0x0f; // for MI, these seem to make part of the Polling the device software and hardware version number command
cmd2 = cmd == SystemConfigPara ? 0x01 : 0x00; //perhaps we can only try to get second frame?
mRadio.sendCmdPacket(iv->radioId.u64, cmd, cmd2, false, false);
mRadio->sendCmdPacket(iv->radioId.u64, cmd, cmd2, false, false);
} else {
//mSys->Radio.prepareDevInformCmd(iv->radioId.u64, cmd2, mPayload[iv->id].ts, iv->alarmMesIndex, false, cmd);
mRadio.sendCmdPacket(iv->radioId.u64, cmd, cmd2, false, false);
mRadio->sendCmdPacket(iv->radioId.u64, cmd, cmd2, false, false);
};
mPayload[iv->id].txCmd = cmd;
@ -442,7 +442,7 @@ const byteAssign_t InfoAssignment[] = {
mPayload[iv->id].retransmits = mMaxRetrans;
} else if ( cmd == 0x0f ) {
//hard/firmware request
mRadio.sendCmdPacket(iv->radioId.u64, 0x0f, 0x00, true, false);
mRadio->sendCmdPacket(iv->radioId.u64, 0x0f, 0x00, true, false);
//iv->setQueuedCmdFinished();
//cmd = iv->getQueuedCmd();
} else {
@ -479,7 +479,7 @@ const byteAssign_t InfoAssignment[] = {
}
DBGPRINT(F(" 0x"));
DBGHEXLN(cmd);
mRadio.sendCmdPacket(iv->radioId.u64, cmd, cmd, true, false);
mRadio->sendCmdPacket(iv->radioId.u64, cmd, cmd, true, false);
//mSys->Radio.prepareDevInformCmd(iv->radioId.u64, cmd, mPayload[iv->id].ts, iv->alarmMesIndex, true, cmd);
yield();
}
@ -497,7 +497,7 @@ const byteAssign_t InfoAssignment[] = {
DBGPRINT(F("prepareDevInformCmd 0x"));
DBGHEXLN(mPayload[iv->id].txCmd);
//mSys->Radio.prepareDevInformCmd(iv->radioId.u64, mPayload[iv->id].txCmd, mPayload[iv->id].ts, iv->alarmMesIndex, true);
mRadio.sendCmdPacket(iv->radioId.u64, mPayload[iv->id].txCmd, mPayload[iv->id].txCmd, false, false);
mRadio->sendCmdPacket(iv->radioId.u64, mPayload[iv->id].txCmd, mPayload[iv->id].txCmd, false, false);
}
}
/*else { // payload complete

155
src/hms/hmsDefines.h

@ -9,33 +9,97 @@
#include "../hm/hmDefines.h"
//-------------------------------------
// HMS2000
// HMS-350, HMS-500
//-------------------------------------
const byteAssign_t hms1chAssignment[] = {
{ FLD_UDC, UNIT_V, CH1, 2, 2, 10 },
{ FLD_IDC, UNIT_A, CH1, 4, 2, 100 },
{ FLD_PDC, UNIT_W, CH1, 6, 2, 10 },
{ FLD_YT, UNIT_KWH, CH1, 8, 4, 1000 },
{ FLD_YD, UNIT_WH, CH1, 12, 2, 1 },
{ FLD_IRR, UNIT_PCT, CH1, CALC_IRR_CH, CH1, CMD_CALC },
{ FLD_UAC, UNIT_V, CH0, 14, 2, 10 },
{ FLD_F, UNIT_HZ, CH0, 16, 2, 100 },
{ FLD_PAC, UNIT_W, CH0, 18, 2, 10 },
{ FLD_Q, UNIT_VAR, CH0, 20, 2, 10 }, // signed!
{ FLD_IAC, UNIT_A, CH0, 22, 2, 100 },
{ FLD_PF, UNIT_NONE, CH0, 24, 2, 1000 }, // signed!
{ FLD_T, UNIT_C, CH0, 26, 2, 10 }, // signed!
{ FLD_EVT, UNIT_NONE, CH0, 28, 2, 1 },
{ FLD_YD, UNIT_WH, CH0, CALC_YD_CH0, 0, CMD_CALC },
{ FLD_YT, UNIT_KWH, CH0, CALC_YT_CH0, 0, CMD_CALC },
{ FLD_PDC, UNIT_W, CH0, CALC_PDC_CH0, 0, CMD_CALC },
{ FLD_EFF, UNIT_PCT, CH0, CALC_EFF_CH0, 0, CMD_CALC }
};
#define HMS1CH_LIST_LEN (sizeof(hms1chAssignment) / sizeof(byteAssign_t))
#define HMS1CH_PAYLOAD_LEN 30
//-------------------------------------
// HMS-800, HMS-1000
//-------------------------------------
const byteAssign_t hms2chAssignment[] = {
{ FLD_UDC, UNIT_V, CH1, 2, 2, 10 },
{ FLD_IDC, UNIT_A, CH1, 6, 2, 100 },
{ FLD_PDC, UNIT_W, CH1, 10, 2, 10 },
{ FLD_YT, UNIT_KWH, CH1, 14, 4, 1000 },
{ FLD_YD, UNIT_WH, CH1, 22, 2, 1 },
{ FLD_IRR, UNIT_PCT, CH1, CALC_IRR_CH, CH1, CMD_CALC },
{ FLD_UDC, UNIT_V, CH2, 4, 2, 10 },
{ FLD_IDC, UNIT_A, CH2, 8, 2, 100 },
{ FLD_PDC, UNIT_W, CH2, 12, 2, 10 },
{ FLD_YT, UNIT_KWH, CH2, 18, 4, 1000 },
{ FLD_YD, UNIT_WH, CH2, 24, 2, 1 },
{ FLD_IRR, UNIT_PCT, CH2, CALC_IRR_CH, CH2, CMD_CALC },
{ FLD_UAC, UNIT_V, CH0, 26, 2, 10 },
{ FLD_F, UNIT_HZ, CH0, 28, 2, 100 },
{ FLD_PAC, UNIT_W, CH0, 30, 2, 10 },
{ FLD_Q, UNIT_VAR, CH0, 32, 2, 10 }, // signed!
{ FLD_IAC, UNIT_A, CH0, 34, 2, 100 },
{ FLD_PF, UNIT_NONE, CH0, 36, 2, 1000 }, // signed!
{ FLD_T, UNIT_C, CH0, 38, 2, 10 }, // signed!
{ FLD_EVT, UNIT_NONE, CH0, 40, 2, 1 },
{ FLD_YD, UNIT_WH, CH0, CALC_YD_CH0, 0, CMD_CALC },
{ FLD_YT, UNIT_KWH, CH0, CALC_YT_CH0, 0, CMD_CALC },
{ FLD_PDC, UNIT_W, CH0, CALC_PDC_CH0, 0, CMD_CALC },
{ FLD_EFF, UNIT_PCT, CH0, CALC_EFF_CH0, 0, CMD_CALC }
};
#define HMS2CH_LIST_LEN (sizeof(hms2chAssignment) / sizeof(byteAssign_t))
#define HMS2CH_PAYLOAD_LEN 42
//-------------------------------------
// HMS-1800, HMS-2000
//-------------------------------------
const byteAssign_t hms4chAssignment[] = {
{ FLD_UDC, UNIT_V, CH1, 2, 2, 10 },
{ FLD_UDC, UNIT_V, CH2, 4, 2, 10 },
{ FLD_IDC, UNIT_A, CH1, 6, 2, 100 },
{ FLD_IDC, UNIT_A, CH2, 8, 2, 100 },
{ FLD_PDC, UNIT_W, CH1, 10, 2, 10 },
{ FLD_PDC, UNIT_W, CH2, 12, 2, 10 },
{ FLD_YT, UNIT_KWH, CH1, 14, 4, 1000 },
{ FLD_YT, UNIT_KWH, CH2, 18, 4, 1000 },
{ FLD_YD, UNIT_WH, CH1, 22, 2, 1 },
{ FLD_YD, UNIT_WH, CH2, 24, 2, 1 },
{ FLD_IRR, UNIT_PCT, CH1, CALC_IRR_CH, CH1, CMD_CALC },
{ FLD_UDC, UNIT_V, CH2, 4, 2, 10 },
{ FLD_IDC, UNIT_A, CH2, 8, 2, 100 },
{ FLD_PDC, UNIT_W, CH2, 12, 2, 10 },
{ FLD_YT, UNIT_KWH, CH2, 18, 4, 1000 },
{ FLD_YD, UNIT_WH, CH2, 24, 2, 1 },
{ FLD_IRR, UNIT_PCT, CH2, CALC_IRR_CH, CH2, CMD_CALC },
{ FLD_UDC, UNIT_V, CH3, 26, 2, 10 },
{ FLD_UDC, UNIT_V, CH4, 28, 2, 10 },
{ FLD_IDC, UNIT_A, CH3, 30, 2, 100 },
{ FLD_IDC, UNIT_A, CH4, 32, 2, 100 },
{ FLD_PDC, UNIT_W, CH3, 34, 2, 10 },
{ FLD_PDC, UNIT_W, CH4, 36, 2, 10 },
{ FLD_YT, UNIT_KWH, CH3, 38, 4, 1000 },
{ FLD_YT, UNIT_KWH, CH4, 42, 4, 1000 },
{ FLD_YD, UNIT_WH, CH3, 46, 2, 1 },
{ FLD_YD, UNIT_WH, CH4, 48, 2, 1 },
{ FLD_IRR, UNIT_PCT, CH3, CALC_IRR_CH, CH3, CMD_CALC },
{ FLD_UDC, UNIT_V, CH4, 28, 2, 10 },
{ FLD_IDC, UNIT_A, CH4, 32, 2, 100 },
{ FLD_PDC, UNIT_W, CH4, 36, 2, 10 },
{ FLD_YT, UNIT_KWH, CH4, 42, 4, 1000 },
{ FLD_YD, UNIT_WH, CH4, 48, 2, 1 },
{ FLD_IRR, UNIT_PCT, CH4, CALC_IRR_CH, CH4, CMD_CALC },
{ FLD_UAC, UNIT_V, CH0, 50, 2, 10 },
@ -54,4 +118,73 @@ const byteAssign_t hms4chAssignment[] = {
#define HMS4CH_LIST_LEN (sizeof(hms4chAssignment) / sizeof(byteAssign_t))
#define HMS4CH_PAYLOAD_LEN 66
//-------------------------------------
// HMT-1800, HMT-2250
//-------------------------------------
const byteAssign_t hmt6chAssignment[] = {
{ FLD_UDC, UNIT_V, CH1, 2, 2, 10 },
{ FLD_IDC, UNIT_A, CH1, 4, 2, 100 },
{ FLD_PDC, UNIT_W, CH1, 8, 2, 10 },
{ FLD_YT, UNIT_KWH, CH1, 12, 4, 1000 },
{ FLD_YD, UNIT_WH, CH1, 20, 2, 1 },
{ FLD_IRR, UNIT_PCT, CH1, CALC_IRR_CH, CH1, CMD_CALC },
{ FLD_UDC, UNIT_V, CH2, CALC_UDC_CH, CH1, CMD_CALC },
{ FLD_IDC, UNIT_A, CH2, 6, 2, 100 },
{ FLD_PDC, UNIT_W, CH2, 10, 2, 10 },
{ FLD_YT, UNIT_KWH, CH2, 16, 4, 1000 },
{ FLD_YD, UNIT_WH, CH2, 22, 2, 1 },
{ FLD_IRR, UNIT_PCT, CH2, CALC_IRR_CH, CH2, CMD_CALC },
{ FLD_UDC, UNIT_V, CH3, 24, 2, 10 },
{ FLD_IDC, UNIT_A, CH3, 26, 2, 100 },
{ FLD_PDC, UNIT_W, CH3, 30, 2, 10 },
{ FLD_YT, UNIT_KWH, CH3, 34, 4, 1000 },
{ FLD_YD, UNIT_WH, CH3, 42, 2, 1 },
{ FLD_IRR, UNIT_PCT, CH3, CALC_IRR_CH, CH3, CMD_CALC },
{ FLD_UDC, UNIT_V, CH4, CALC_UDC_CH, CH3, CMD_CALC },
{ FLD_IDC, UNIT_A, CH4, 28, 2, 100 },
{ FLD_PDC, UNIT_W, CH4, 32, 2, 10 },
{ FLD_YT, UNIT_KWH, CH4, 38, 4, 1000 },
{ FLD_YD, UNIT_WH, CH4, 44, 2, 1 },
{ FLD_IRR, UNIT_PCT, CH4, CALC_IRR_CH, CH4, CMD_CALC },
{ FLD_UDC, UNIT_V, CH5, 46, 2, 10 },
{ FLD_IDC, UNIT_A, CH5, 48, 2, 100 },
{ FLD_PDC, UNIT_W, CH5, 52, 2, 10 },
{ FLD_YT, UNIT_KWH, CH5, 56, 4, 1000 },
{ FLD_YD, UNIT_WH, CH5, 64, 2, 1 },
{ FLD_IRR, UNIT_PCT, CH5, CALC_IRR_CH, CH5, CMD_CALC },
{ FLD_UDC, UNIT_V, CH6, CALC_UDC_CH, CH5, CMD_CALC },
{ FLD_IDC, UNIT_A, CH6, 50, 2, 100 },
{ FLD_PDC, UNIT_W, CH6, 54, 2, 10 },
{ FLD_YT, UNIT_KWH, CH6, 60, 4, 1000 },
{ FLD_YD, UNIT_WH, CH6, 66, 2, 1 },
{ FLD_IRR, UNIT_PCT, CH6, CALC_IRR_CH, CH6, CMD_CALC },
{ FLD_UAC_1N, UNIT_V, CH0, 68, 2, 10 },
{ FLD_UAC_2N, UNIT_V, CH0, 70, 2, 10 },
{ FLD_UAC_3N, UNIT_V, CH0, 72, 2, 10 },
{ FLD_UAC_12, UNIT_V, CH0, 74, 2, 10 },
{ FLD_UAC_23, UNIT_V, CH0, 76, 2, 10 },
{ FLD_UAC_31, UNIT_V, CH0, 78, 2, 10 },
{ FLD_F, UNIT_HZ, CH0, 80, 2, 100 },
{ FLD_PAC, UNIT_W, CH0, 82, 2, 10 },
{ FLD_Q, UNIT_VAR, CH0, 84, 2, 10 },
{ FLD_IAC_1, UNIT_A, CH0, 86, 2, 100 },
{ FLD_IAC_2, UNIT_A, CH0, 88, 2, 100 },
{ FLD_IAC_3, UNIT_A, CH0, 90, 2, 100 },
{ FLD_PF, UNIT_NONE, CH0, 92, 2, 1000 },
{ FLD_T, UNIT_C, CH0, 94, 2, 10 },
{ FLD_EVT, UNIT_NONE, CH0, 96, 2, 1 },
{ FLD_YD, UNIT_WH, CH0, CALC_YD_CH0, 0, CMD_CALC },
{ FLD_YT, UNIT_KWH, CH0, CALC_YT_CH0, 0, CMD_CALC },
{ FLD_PDC, UNIT_W, CH0, CALC_PDC_CH0, 0, CMD_CALC },
{ FLD_EFF, UNIT_PCT, CH0, CALC_EFF_CH0, 0, CMD_CALC }
};
#define HMT6CH_LIST_LEN (sizeof(hmt6chAssignment) / sizeof(byteAssign_t))
#define HMT6CH_PAYLOAD_LEN 98
#endif /*__HMS_DEFINES_H__*/

4
src/hms/hmsPayload.h

@ -80,7 +80,7 @@ class HmsPayload {
}
void ivSend(Inverter<> *iv, bool highPrio = false) {
if (IV_HMS != iv->ivGen) // only process HMS inverters
if ((IV_HMS != iv->ivGen) && (IV_HMT != iv->ivGen)) // only process HMS inverters
return;
//if(!highPrio) {
@ -215,7 +215,7 @@ class HmsPayload {
if (NULL == iv)
continue; // skip to next inverter
if (IV_HMS != iv->ivGen) // only process HMS inverters
if ((IV_HMS != iv->ivGen) && (IV_HMT != iv->ivGen)) // only process HMS inverters
continue; // skip to next inverter
if ((mPayload[iv->id].txId != (TX_REQ_INFO + ALL_FRAMES)) && (0 != mPayload[iv->id].txId)) {

15
src/web/html/setup.html

@ -410,7 +410,7 @@
[1, "high active"],
];
const re = /11[2,4,6][1,2,4].*/;
const re = /1[1,3][2,4,6,8][1,2,4].*/;
window.onload = function() {
for(it of document.getElementsByClassName("s_collapsible")) {
@ -432,7 +432,7 @@
document.getElementById("btnAdd").addEventListener("click", function() {
if(highestId <= (maxInv-1)) {
ivHtml(JSON.parse('{"enabled":true,"name":"","serial":"","channels":4,"ch_max_pwr":[0,0,0,0],"ch_name":["","","",""],"ch_yield_cor":[0,0,0,0]}'), highestId);
ivHtml(JSON.parse('{"enabled":true,"name":"","serial":"","channels":6,"ch_max_pwr":[0,0,0,0,0,0],"ch_name":["","","","","",""],"ch_yield_cor":[0,0,0,0,0,0]}'), highestId);
}
});
@ -539,7 +539,7 @@
addr.addEventListener(evt, (e) => {
var serial = addr.value.substring(0,4);
var max = 0;
for(var i=0;i<4;i++) {
for(var i=0;i<6;i++) {
setHide(id+"ModPwr"+i, true);
setHide(id+"ModName"+i, true);
setHide(id+"YieldCor"+i, true);
@ -549,16 +549,13 @@
setHide("row"+id+"YieldCor", true);
if(serial.charAt(0) == 1) {
if((serial.charAt(1) == 0) || (serial.charAt(1) == 1)) {
if((serial.charAt(3) == 1) || (serial.charAt(3) == 2)) {
if((serial.charAt(1) == 0) || (serial.charAt(1) == 1) || (serial.charAt(1) == 3)) {
if((serial.charAt(3) == 1) || (serial.charAt(3) == 2) || (serial.charAt(3) == 4)) {
switch(serial.charAt(2)) {
case "2": max = 1; break;
case "4": max = 2; break;
case "6": max = 4; break;
}
} else if(serial.charAt(2) == 6) {
switch(serial.charAt(3)) {
case "4": max = 4; break;
case "8": max = 6; break;
}
}
}

10
src/web/web.h

@ -487,8 +487,16 @@ class Web {
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;
}
@ -497,7 +505,7 @@ class Web {
request->arg("inv" + String(i) + "Name").toCharArray(iv->config->name, MAX_NAME_LENGTH);
// max channel power / name
for (uint8_t j = 0; j < 4; j++) {
for (uint8_t j = 0; j < 6; j++) {
iv->config->yieldCor[j] = request->arg("inv" + String(i) + "YieldCor" + String(j)).toInt();
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);

Loading…
Cancel
Save