Fixed issue of wrong detected byteAssignment length
This commit is contained in:
parent
9bfe6a9e63
commit
0d7cef5f60
@ -14,3 +14,8 @@ const byteAssign_t* HM_1CH::getByteAssignment()
|
|||||||
{
|
{
|
||||||
return byteAssignment;
|
return byteAssignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const uint8_t HM_1CH::getAssignmentCount()
|
||||||
|
{
|
||||||
|
return sizeof(byteAssignment) / sizeof(byteAssign_t);
|
||||||
|
}
|
||||||
@ -7,6 +7,7 @@ public:
|
|||||||
static bool isValidSerial(uint64_t serial);
|
static bool isValidSerial(uint64_t serial);
|
||||||
String typeName();
|
String typeName();
|
||||||
const byteAssign_t* getByteAssignment();
|
const byteAssign_t* getByteAssignment();
|
||||||
|
const uint8_t getAssignmentCount();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const byteAssign_t byteAssignment[13] = {
|
const byteAssign_t byteAssignment[13] = {
|
||||||
|
|||||||
@ -14,3 +14,8 @@ const byteAssign_t* HM_2CH::getByteAssignment()
|
|||||||
{
|
{
|
||||||
return byteAssignment;
|
return byteAssignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const uint8_t HM_2CH::getAssignmentCount()
|
||||||
|
{
|
||||||
|
return sizeof(byteAssignment) / sizeof(byteAssign_t);
|
||||||
|
}
|
||||||
@ -7,6 +7,7 @@ public:
|
|||||||
static bool isValidSerial(uint64_t serial);
|
static bool isValidSerial(uint64_t serial);
|
||||||
String typeName();
|
String typeName();
|
||||||
const byteAssign_t* getByteAssignment();
|
const byteAssign_t* getByteAssignment();
|
||||||
|
const uint8_t getAssignmentCount();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const byteAssign_t byteAssignment[21] = {
|
const byteAssign_t byteAssignment[21] = {
|
||||||
|
|||||||
@ -14,3 +14,8 @@ const byteAssign_t* HM_4CH::getByteAssignment()
|
|||||||
{
|
{
|
||||||
return byteAssignment;
|
return byteAssignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const uint8_t HM_4CH::getAssignmentCount()
|
||||||
|
{
|
||||||
|
return sizeof(byteAssignment) / sizeof(byteAssign_t);
|
||||||
|
}
|
||||||
@ -7,6 +7,7 @@ public:
|
|||||||
static bool isValidSerial(uint64_t serial);
|
static bool isValidSerial(uint64_t serial);
|
||||||
String typeName();
|
String typeName();
|
||||||
const byteAssign_t* getByteAssignment();
|
const byteAssign_t* getByteAssignment();
|
||||||
|
const uint8_t getAssignmentCount();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const byteAssign_t byteAssignment[34] = {
|
const byteAssign_t byteAssignment[34] = {
|
||||||
|
|||||||
@ -119,7 +119,8 @@ uint8_t InverterAbstract::getChannelCount()
|
|||||||
{
|
{
|
||||||
const byteAssign_t* b = getByteAssignment();
|
const byteAssign_t* b = getByteAssignment();
|
||||||
uint8_t cnt = 0;
|
uint8_t cnt = 0;
|
||||||
for (uint8_t pos = 0; pos < sizeof(b) / sizeof(byteAssign_t); pos++) {
|
for (uint8_t pos = 0; pos < getAssignmentCount(); pos++) {
|
||||||
|
Serial.println(b[pos].ch);
|
||||||
if (b[pos].ch > cnt) {
|
if (b[pos].ch > cnt) {
|
||||||
cnt = b[pos].ch;
|
cnt = b[pos].ch;
|
||||||
}
|
}
|
||||||
@ -139,7 +140,7 @@ uint8_t InverterAbstract::getAssignIdxByChannelField(uint8_t channel, uint8_t fi
|
|||||||
const byteAssign_t* b = getByteAssignment();
|
const byteAssign_t* b = getByteAssignment();
|
||||||
|
|
||||||
uint8_t pos;
|
uint8_t pos;
|
||||||
for (pos = 0; pos < sizeof(b) / sizeof(byteAssign_t); pos++) {
|
for (pos = 0; pos < getAssignmentCount(); pos++) {
|
||||||
if (b[pos].ch == channel && b[pos].fieldId == fieldId) {
|
if (b[pos].ch == channel && b[pos].fieldId == fieldId) {
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,6 +97,7 @@ public:
|
|||||||
const char* name();
|
const char* name();
|
||||||
virtual String typeName() = 0;
|
virtual String typeName() = 0;
|
||||||
virtual const byteAssign_t* getByteAssignment() = 0;
|
virtual const byteAssign_t* getByteAssignment() = 0;
|
||||||
|
virtual const uint8_t getAssignmentCount() = 0;
|
||||||
uint8_t getChannelCount();
|
uint8_t getChannelCount();
|
||||||
uint16_t getChannelMaxPower(uint8_t channel);
|
uint16_t getChannelMaxPower(uint8_t channel);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user