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
1 out of 4
Suggested Topics
-
Day 1 - Status report
Announcements • 23 Mar 2014, 22:45 • hek 24 Mar 2014, 20:12 -
DHT22 wrong sensor type in Home Assistant
Troubleshooting • 9 days ago • Commodoreuno 4 days ago -
Ghost Child
Troubleshooting • 15 Mar 2025, 07:44 • FcNanoLed 18 Mar 2025, 18:36 -
Can not compile MySensors on esp8266
Troubleshooting • 24 Aug 2024, 15:35 • TheoL 29 Aug 2024, 20:47 -
Getting system time from the controller
Troubleshooting • 27 Feb 2025, 01:39 • dpcons 3 Mar 2025, 01:00 -
Compiling Sensor code using BME280 and ESP8266
Troubleshooting • 26 Feb 2025, 00:32 • dpcons 26 Feb 2025, 06:22