reaper7 / SDM_Energy_Meter

reading SDM72 SDM120 SDM220 SDM230 SDM630 modbus energy meters from arduino (esp8266, esp32, avr)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem compiling with arduino IDE 1.8.6+ and hardware serial

v-a-d-e-r opened this issue · comments

Hello all. I'm running mad now. With software serial everything works fine, with hardware serial I can't even compile and get this error:

Code:
#define USE_HARDWARESERIAL
#include <SDM.h>
SDM Plugin_150_SDM(Serial, 9600, NOT_A_PIN, SERIAL_8N1, false);

Error:
undefined reference to SDM::SDM(HardwareSerial&, long, int, int, bool)' sketch/ESPEasy.ino.cpp.o: In function Plugin_150(unsigned char, EventStruct*, String&)':
undefined reference to SDM::SDM(HardwareSerial&, long, int, int, bool)' undefined reference to SDM::SDM(HardwareSerial&, long, int, int, bool)'
collect2: error: ld returned 1 exit status

Any idea what's going wrong here?

Came here to write a bug report, as I am experiencing the exact same error....

Good to know I'm not the only one on the earth with that issue. I hope that Reaper7 knows a fix for it...

I'm experiencing this using a Wemos D1 Mini. Are you using the same hardware?

No. I have a Lolin NodeMCU. But I think it does not depend on the hardware. More on the communication between the SDM software and the hardware serial library.

Uncomment
#define USE_HARDWARESERIAL
in sdm_user_config.h file

Hi. Many thanks, it works! Can't believe it..... I thought when I define it in the .ino it is global? And #define USE_HARDWARESERIAL is before include <SDM.h>!?