OK, I tried to squeeze the *.ino together but still makeing sense in the complete context.
These are the error Messages:
sketch\PZEM014.cpp: In function 'void readPZEM014(uint8_t)':
PZEM014.cpp:44:3: error: 'buff' was not declared in this scope
buff.buff8[Addr] = PZEM014DAddr;
^
sketch\PZEM014.cpp: In function 'void readPZEM014Values(float&, float&, float&, float&, float&, float&, uint8_t&)':
PZEM014.cpp:110:10: error: 'buff' was not declared in this scope
if (buff.buff8[COM] != readDATA)
^
sketch\PZEM014.cpp: In function 'void readPZEM014Holding(uint16_t&, uint8_t&, uint8_t&)':
sketch\PZEM014.cpp:176:7: warning: 'readPZEM014Holding(uint16_t&, uint8_t&, uint8_t&):: buff', declared using anonymous type, is used but never defined [-fpermissive]
} buff;
^
sketch\PZEM014.cpp: In function 'void writePZEM014Holding(uint8_t, uint16_t)':
sketch\PZEM014.cpp:204:5: warning: 'writePZEM014Holding(uint8_t, uint16_t):: buff', declared using anonymous type, is used but never defined [-fpermissive]
} buff;
^
PZEM014.cpp:231:2: error: expected primary-expression before '/' token
*/
^
sketch\PZEM017.cpp: In function 'uint16_t ModRTU_CRC(uint8_t)':
PZEM017.cpp:39:3: error: 'buff' was not declared in this scope
buff.buff16[11] = 0xFFFF;
^
sketch\PZEM017.cpp: In function 'void readPZEM017(uint8_t)':
PZEM017.cpp:78:3: error: 'buff' was not declared in this scope
buff.buff8[Addr] = PZEM017DAddr;
^
sketch\PZEM017.cpp: In function 'void readPZEM017Values(float&, float&, float&, float&, uint8_t&)':
PZEM017.cpp:142:10: error: 'buff' was not declared in this scope
if (buff.buff8[COM] != readDATA)
^
PZEM017.cpp:179:7: error: 'buff' was not declared in this scope
if (buff.buff8[HVAL] == 0xFF) // High or Over Voltage Alarm
^
PZEM017.cpp:185:7: error: 'buff' was not declared in this scope
if (buff.buff8[LVAL] == 0xFF) // Low or Under Voltage Alarm
^
sketch\PZEM017.cpp: In function 'void readPZEM017Holding(float&, float&, uint8_t&, uint8_t&, uint8_t&)':
PZEM017.cpp:200:11: error: 'buff' was not declared in this scope
if (buff.buff8[COM] != readHOLDING)
^
sketch\PZEM017.cpp: In function 'void writePZEM017Holding(uint8_t, uint16_t)':
PZEM017.cpp:230:3: error: 'buff' was not declared in this scope
buff.buff8[Addr] = PZEM017HAddr;
^
sketch\PZEM017.cpp: In function 'void resetEnergy(uint8_t)':
PZEM017.cpp:335:7: error: 'buff' was not declared in this scope
buff.buff8[Addr] = PZEM017HAddr;
^
PZEM017.cpp:337:7: error: 'buff' was not declared in this scope
buff.buff8[Addr] = PZEM014HAddr;
^
PZEM017.cpp:338:5: error: 'buff' was not declared in this scope
buff.buff8[COM] = 0x42;
^
exit status 1
'buff' was not declared in this scope
Obviously, they Change, when I uncomment the delarations in the PZEM014.h and PZEM017.h
PZEM014.cpp (5.18 KB)
PZEM014.h (2.08 KB)
PZEM014RegDef.h (504 Bytes)
PZEM017.cpp (7.61 KB)
PZEM017.h (2.32 KB)
PZEM017RegDef.h (554 Bytes)
PZEMglobals.h (192 Bytes)
Test_PZEM.ino (1.22 KB)
PZEMglobals.h (192 Bytes)
PZEM017RegDef.h (554 Bytes)
PZEM017.h (2.32 KB)
PZEM017.cpp (7.61 KB)