MySensors.h error when compiling: "No forward link or gateway feature activated"



  • Hi!

    I am trying to make my first DS18B20 sensor with MySensors and trying the example found here. When compiling I get the error message:

    No forward link or gateway feature activated
    

    Even after trying to configuring MySensors.h by defining the hardware I use (with my logic thinking) in the file. The hardware I'm using at the moment is:

    • Arduino Mini Pro
    • NRF24 tranceiver
    • DS18B20

    Below is the code I am using in MySensors.h. Search for #error to find the failsafe code part.

    /**
     * @file MySensors.h
     *
     * MySensors main interface (includes all necessary code for the library)
     */
    #ifndef MySensors_h
    #define MySensors_h
    
    #include "core/MySensorsCore.h"
    
    // Detect node type
    /**
     * @def MY_GATEWAY_SERIAL
     * @brief Is set for gateway sketches.
     */
    /**
     * @def MY_IS_GATEWAY
     * @brief Is true when @ref MY_GATEWAY_SERIAL is set.
     */
    
       @def MY_NODE_TYPE
       @brief Contain a string describing the class of sketch/node (gateway/repeater/sensor).
       
    #if defined(MY_GATEWAY_SERIAL) || defined(MY_GATEWAY_W5100) || defined(MY_GATEWAY_ENC28J60) || defined(MY_GATEWAY_ESP8266) || defined(MY_GATEWAY_MQTT_CLIENT)
    	#define MY_GATEWAY_SERIAL
    	#define MY_IS_GATEWAY (false)
    	#define MY_NODE_TYPE "gateway"
    #elif defined(MY_REPEATER_FEATURE)
    	#define MY_IS_GATEWAY (false)
    	#define MY_NODE_TYPE "repeater"
    #else
    	#define MY_IS_GATEWAY (true)
    	#define MY_NODE_TYPE "sensor"
    #endif
    
    // Enable radio "feature" if one of the radio types was enabled
    #if defined(MY_RADIO_NRF24) || defined(MY_RADIO_RFM69) || defined(MY_RS485)
    	#define MY_RADIO_NRF24
    #endif
    
    // HARDWARE
    #if defined(ARDUINO_ARCH_ESP8266)
    	// Remove PSTR macros from debug prints
    	#undef PSTR
    	#define PSTR(x) (x)
    	//#undef F
    	//#define F(x) (x)
    	#include "core/MyHwESP8266.cpp"
    #elif defined(ARDUINO_ARCH_AVR)
    	#include "core/MyHwATMega328.cpp"
    #elif defined(ARDUINO_ARCH_SAMD)
            #include "core/MyHwSAMD.cpp"
    #endif
    
    // INCLUSION MODE
    #if defined(MY_INCLUSION_MODE_FEATURE)
    	#include "core/MyInclusionMode.cpp"
    #endif
    
    
    // SIGNING
    #if defined(MY_SIGNING_ATSHA204) || defined(MY_SIGNING_SOFT)
    	#define MY_SIGNING_SOFT
    #endif
    #include "core/MySigning.cpp"
    #include "drivers/ATSHA204/sha256.cpp"
    #if defined(MY_SIGNING_FEATURE)
    	// SIGNING COMMON FUNCTIONS
    	#if defined(MY_SIGNING_ATSHA204) && defined(MY_SIGNING_SOFT)
    		#error Only one signing engine can be activated
    	#endif
    
    	#if defined(MY_SIGNING_ATSHA204)
    		#include "core/MySigningAtsha204.cpp"
    		#include "drivers/ATSHA204/ATSHA204.cpp"
    	#elif defined(MY_SIGNING_SOFT)
    		#include "core/MySigningAtsha204Soft.cpp"
    	#endif
    #endif
    
    
    // FLASH
    #if defined(MY_OTA_FIRMWARE_FEATURE)
    	#include "drivers/SPIFlash/SPIFlash.cpp"
    	#include "core/MyOTAFirmwareUpdate.cpp"
    #endif
    
    // GATEWAY - TRANSPORT
    #if defined(MY_GATEWAY_MQTT_CLIENT)
    	#if defined(MY_RADIO_NRF24)
    		// We assume that a gateway having a radio also should act as repeater
    		#define MY_REPEATER_FEATURE
    	#endif
    	// GATEWAY - COMMON FUNCTIONS
    	// We only support MQTT Client using W5100 and ESP8266 at the moment
    	#if !(defined(MY_CONTROLLER_URL_ADDRESS) || defined(MY_CONTROLLER_IP_ADDRESS))
    		#error You must specify MY_CONTROLLER_IP_ADDRESS or MY_CONTROLLER_URL_ADDRESS
    	#endif
    
    	#if !defined(MY_MQTT_PUBLISH_TOPIC_PREFIX)
    		#error You must specify a topic publish prefix MY_MQTT_PUBLISH_TOPIC_PREFIX for this MQTT client
    	#endif
    	#if !defined(MY_MQTT_SUBSCRIBE_TOPIC_PREFIX)
    		#error You must specify a topic subscribe prefix MY_MQTT_SUBSCRIBE_TOPIC_PREFIX for this MQTT client
    	#endif
    	#if !defined(MY_MQTT_CLIENT_ID)
    		#error You must define a unique MY_MQTT_CLIENT_ID for this MQTT client
    	#endif
    
    	#include "drivers/PubSubClient/PubSubClient.cpp"
    	#include "core/MyGatewayTransport.cpp"
    	#include "core/MyGatewayTransportMQTTClient.cpp"
    #elif defined(MY_GATEWAY_SERIAL)
    	// GATEWAY - COMMON FUNCTIONS
    	#include "core/MyGatewayTransport.cpp"
    
    	// We currently only support one protocol at the moment, enable it.
    	#include "core/MyProtocolMySensors.cpp"
    
    	// GATEWAY - CONFIGURATION
    	#if defined(MY_RADIO_NRF24)
    		// We assume that a gateway having a radio also should act as repeater
    		#define MY_REPEATER_FEATURE
    	#endif
    	#if defined(MY_CONTROLLER_IP_ADDRESS)
    		#define MY_GATEWAY_CLIENT_MODE
    	#endif
    	#if !defined(MY_PORT)
    		#error You must define MY_PORT (controller or gatway port to open)
    	#endif
    	#if defined(MY_GATEWAY_ESP8266)
    		// GATEWAY - ESP8266
    		#include "core/MyGatewayTransportEthernet.cpp"
    	#elif defined(MY_GATEWAY_W5100)
    		// GATEWAY - W5100
    		#include "core/MyGatewayTransportEthernet.cpp"
    	#elif defined(MY_GATEWAY_ENC28J60)
    		// GATEWAY - ENC28J60
    		#if defined(MY_USE_UDP)
    			#error UDP mode is not available for ENC28J60
    		#endif
    		#include "core/MyGatewayTransportEthernet.cpp"
    	#elif defined(MY_GATEWAY_SERIAL)
    		// GATEWAY - SERIAL
    		#include "core/MyGatewayTransportSerial.cpp"
    	#endif
    #endif
    
    
    // RADIO
    #if defined(MY_RADIO_NRF24) || defined(MY_RADIO_RFM69) || defined(MY_RS485)
    	// SOFTSPI
    	#ifdef MY_SOFTSPI
    		#if defined(ARDUINO_ARCH_ESP8266)
    			#error Soft SPI is not available on ESP8266
    		#endif
    		#include "drivers/AVR/DigitalIO/DigitalIO.h"
    	#endif
    
    	#include "core/MyTransport.cpp"
    	#if (defined(MY_RADIO_NRF24) && defined(MY_RADIO_RFM69)) || (defined(MY_RADIO_NRF24) && defined(MY_RS485)) || (defined(MY_RADIO_RFM69) && defined(MY_RS485))
    		#error Only one forward link driver can be activated
    	#endif
    	#if defined(MY_RADIO_NRF24)
    		#if defined(MY_RF24_ENABLE_ENCRYPTION)
    			#include "drivers/AES/AES.cpp"
    		#endif
    		#include "drivers/RF24/RF24.cpp"
    		#include "core/MyTransportNRF24.cpp"
    	#elif defined(MY_RS485)
    		#include "drivers/AltSoftSerial/AltSoftSerial.cpp"
    		#include "core/MyTransportRS485.cpp"
    	#elif defined(MY_RADIO_RFM69)
    		#include "drivers/RFM69/RFM69.cpp"
    		#include "core/MyTransportRFM69.cpp"
    	#endif
    #endif
    
    // Make sure to disable child features when parent feature is disabled
    #if !defined(MY_RADIO_NRF24)
    	#undef MY_OTA_FIRMWARE_FEATURE
    	#undef MY_REPEATER_FEATURE
    	#undef MY_SIGNING_NODE_WHITELISTING
    	#undef MY_SIGNING_FEATURE
    #endif
    
    #if !defined(MY_GATEWAY_SERIAL)
    	#undef MY_INCLUSION_MODE_FEATURE
    	#undef MY_INCLUSION_BUTTON_FEATURE
    #endif
    
    #if !defined(MY_CORE_ONLY)
    	#if !defined(MY_GATEWAY_FEATURE) && !defined(MY_RADIO_FEATURE)
    		#error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
    	#endif
    #endif
    
    #include "core/MyCapabilities.h"
    #include "core/MyMessage.cpp"
    #include "core/MySensorsCore.cpp"
    
    #include <Arduino.h>
    
    #if !defined(MY_CORE_ONLY)
    	#if defined(ARDUINO_ARCH_ESP8266)
    		#include "core/MyMainESP8266.cpp"
    	#else
    		#include "core/MyMainDefault.cpp"
    	#endif
    #endif
    
    #endif
    // Doxygen specific constructs, not included when built normally
    // This is used to enable disabled macros/definitions to be included in the documentation as well.
    #if DOXYGEN
    #define MY_GATEWAY_SERIAL
    #endif
    

    I am greatful for any help


  • Mod

    @chippey5 use the example provided with the library instead (open in the Arduino IDE). The examples at mysensors.org are for version 1.5 and you are using version 2.0 of the library.



  • @mfalkvidd Thanks for your reply!

    I can't find the example including "Temp" nor DS18B20 in the example folder. Is it called something else? Thanks in advance


  • Mod

    @chippey5 oh, sorry about that. All examples that require external libraries (like the DallasTemperature library) now need to be downloaded separately. https://github.com/mysensors/MySensorsArduinoExamples/archive/master.zip



  • Splendid, that did the trick! I received the good ol' millisWaitForConversion error, but using the "DallasTemperature" library included in the Github link fixed the problem.

    Thanks a bunch!


  • Mod

    Great @chippey5 ! Thanks for reporting back.



  • Thanks for the suggestions @mfalkvidd, and @chippey5 - thanks for the update - I had exactly the same issue, and could not work out why I was getting that 'millisWait' error. All good now!


  • Contest Winner

    Just adding this for people who come here by looking for the error "No forward link or gateway feature activated". Since you've to configure MySensors 2.0 before you include the library. You'll need to configure the radio you're using.

    I got this message when I didn't. So just for people who queury for the same error message. Configure you're radio and other options before you include the library. @mfalkvidd do we have a topic with MySensors 2.0 troubleshooting? Might be handy to put this one. I came across this one when I was teaching my colleagues tonight. Not a biggy, put took me a while to sort it out.

    /** 
     * Set configuration options for MySensors 
     */
    #define MY_RADIO_NRF24  
    #define MY_DEBUG // uncomment when compiling for production
    
    /**
     * Include necessary libraries
     */
    #include <MySensors.h> // include MySensors library
    #include <SPI.h>       // include SPI needed for the MySensors Radio
    


  • @TheoL Bump. That's exactly where I'm stuck at the moment. A link here to the future thread would be awesome for other users encountering the same issue


  • Hardware Contributor

    What about changing the message text also ? I guess the programmers get it quickly, but for the common folk this message is a bit cryptic 😉

    What about changing "#error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless."
    to something like :
    "#error No forward link or gateway feature activated. Please define radio type (ex: #define MY_RADIO_NRF24) or gateway type (ex: #define MY_GATEWAY_SERIAL) at the beginning of your sketch" ?


  • Contest Winner

    @Nca78 Good suggestion. But I'm not sure if the reason for this error is always missing configuration. That's something @hek might know more about.


  • Hardware Contributor

    @TheoL it is.
    When you define a radio, it defines MY_RADIO_FEATURE

    // Enable radio "feature" if one of the radio types was enabled
    #if defined(MY_RADIO_NRF24) || defined(MY_RADIO_RFM69) || defined(MY_RS485)
    	#define MY_RADIO_FEATURE
    #endif
    

    Same thing when you define a gateway :

    #if defined(MY_GATEWAY_SERIAL) || defined(MY_GATEWAY_W5100) || defined(MY_GATEWAY_ENC28J60) || defined(MY_GATEWAY_ESP8266) || defined(MY_GATEWAY_MQTT_CLIENT)
    	#define MY_GATEWAY_FEATURE
    

    Then at the end if MY_RADIO_FEATURE and MY_GATEWAY_FEATURE are not defined it generates this compilation error

    	#if !defined(MY_GATEWAY_FEATURE) && !defined(MY_RADIO_FEATURE)
    		#error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
    	#endif
    

 

245
Online

7.8k
Users

8.7k
Topics

93.1k
Posts