How to pass the #define for MySensors
-
I need to use the same technique in my library but is not working.
I am using in my config.h#ifdef ODEV_API_KEY #define ODEV_API_KEY_REAL ODEV_API_KEY #endif #ifndef ODEV_API_KEY #define ODEV_API_KEY_REAL "*" #endif const char MQTT_TOPIC[] = ODEV_API_KEY_REAL "/in/ModuleName";
If I put a #error at first condiftion, it really indicates is falling in this first condition, but MQTT_TOPIC is as if he had fallen in second
-
The "trick" we use in the mysensors library is to include code files (cpp) in the MySensors.h header file. A bit ugly but as the Arduino IDE has a very limited build system, it's the only way you can make defines in sketch visible in the code.
-
If I knew it could include cpf in a .h file I had done before ... =]
Thanks for the tip.
-
I have found some alternatives that can be used:
https://electrohobby.ca/forum/showthread.php?tid=214&pid=1281
3 out of 4
Suggested Topics
-
Day 1 - Status report
Announcements • 23 Mar 2014, 22:45 • hek 24 Mar 2014, 20:12 -
JSN-SR04T-V3.0 Coax cable extended
Troubleshooting • 19 Mar 2025, 21:00 • bocalexandru 21 Mar 2025, 12:05 -
Compiling Sensor code using BME280 and ESP8266
Troubleshooting • 26 Feb 2025, 00:32 • dpcons 26 Feb 2025, 06:22 -
Getting system time from the controller
Troubleshooting • 27 Feb 2025, 01:39 • dpcons 3 Mar 2025, 01:00 -
NODs stop responding, but ping works.
Troubleshooting • 8 Mar 2025, 19:47 • Marcin 8 Mar 2025, 19:47 -
JSN SR04T - Temperature Influencing Readings
Troubleshooting • 6 Sept 2019, 07:51 • Timbergetter 26 days ago