seb821 / espRFLinkMQTT

ESP8266 gateway between RFLink and MQTT server
96 stars 32 forks source link

Compile error witn Arduino IDE/ESP-01 #26

Closed linker3000 closed 3 years ago

linker3000 commented 3 years ago

I have tried IDE 1.8.13 and 1.8.15. ESP8266 library is v2.7.4

Trying to compile the currently published code gives:

/espRFLinkMQTT/espRFLinkMQTT.ino: In function 'void loop()':
espRFLinkMQTT:1466:6: error: 'rflinkSerialRX' was not declared in this scope
   if(rflinkSerialRX.available()) {
      ^

The hardware setup is a standard Mega clone with a custom shield holding the rf modules plus an ESP-01. The setup is currently running an espRFLinkMQTT release from 2019 and I was just aiming to update to a more recent version.

I am using software serial so I have commented/uncommented config.h as follows:

// HardwareSerial & rflinkSerialRX = Serial;        // rflinkSerialRX is used for data from RFLink - uncomment this line to listen on hardware serial (ESP RX pin)
// HardwareSerial & rflinkSerialTX = Serial;        // rflinkSerialTX is used for commands to RFLink
#include <SoftwareSerial.h>                 // rflinkSerialTX is used for commands to RFLink: by default, it uses ESP TX pin ; in order to use another pin, comment previous line and uncomment this line and two following ones to write on software serial (GPIO2/D4) - software serial RX listens on GPIO4/D2 pin (unused)
SoftwareSerial softSerial(4, 2, false);     // software serial TX to RFLink on GPIO2/D4 ; software serial RX from GPIO4/D2 pin (unused) 
SoftwareSerial & rflinkSerialTX = softSerial;   

#define DEFAULT_MEGA_RESET_PIN -1               // ESP pin connected to MEGA reset pin ; this is the default value and it can be changed from the web interface ; examples: -1 for none, 16 for GPIO16 (D0)
#define DEFAULT_MEGA_AUTO_RESET_INTERVAL 0 * 60 * 1000  // Auto reset MEGA if no data is received during this period of time (in ms), 0 to disable ; this is the default value and it can be changed from the web interface

Thanks

linker3000 commented 3 years ago

Confirming that this works (GPIO numbers edited to match my setup):


//HardwareSerial & rflinkSerialRX = Serial;     // rflinkSerialRX is used for data from RFLink - uncomment this line to listen on hardware serial (ESP RX pin)
//HardwareSerial & rflinkSerialTX = Serial;     // rflinkSerialTX is used for commands to RFLink
#include <SoftwareSerial.h>                 // rflinkSerialTX is used for commands to RFLink: by default, it uses ESP TX pin ; in order to use another pin, comment previous line and uncomment this line and two following ones to write on software serial (GPIO2/D4) - software serial RX listens on GPIO4/D2 pin (unused)

//SoftwareSerial softSerial(4, 2, false);    // software serial TX to RFLink on GPIO2/D4 ; software serial RX from GPIO4/D2 pin (unused) 
SoftwareSerial softSerial(3, 2, false);    // NK: To match my wiring

SoftwareSerial & rflinkSerialRX = softSerial; // *** NK ADDED ***
SoftwareSerial & rflinkSerialTX = softSerial;          

#define DEFAULT_MEGA_RESET_PIN 0                // ESP pin connected to MEGA reset pin ; this is the default value and it can be changed from the web interface ; examples: -1 for none, 16 for GPIO16 (D0)
#define DEFAULT_MEGA_AUTO_RESET_INTERVAL 0 * 60 * 1000  // Auto reset MEGA if no data is received during this period of time (in ms), 0 to disable ; this is the default value and it can be changed from the web interface