reaper7 / SDM_Energy_Meter

reading SDM72 SDM120 SDM220 SDM230 SDM630 modbus energy meters from arduino (esp8266, esp32, avr)
240 stars 97 forks source link

Problem compiling with arduino IDE 1.8.6+ and hardware serial #23

Closed v-a-d-e-r closed 6 years ago

v-a-d-e-r commented 6 years ago

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 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 functionPlugin_150(unsigned char, EventStruct*, String&)': undefined reference to SDM::SDM(HardwareSerial&, long, int, int, bool)' undefined reference toSDM::SDM(HardwareSerial&, long, int, int, bool)' collect2: error: ld returned 1 exit status

Any idea what's going wrong here?

salberin commented 6 years ago

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

v-a-d-e-r commented 6 years ago

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

salberin commented 6 years ago

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

v-a-d-e-r commented 6 years ago

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.

reaper7 commented 6 years ago

Uncomment

define USE_HARDWARESERIAL

in sdm_user_config.h file

v-a-d-e-r commented 6 years ago

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 !?