ESP8266 Gateway logic conflict MY_GATEWAY_CLIENT_MODE & MY_USE_UDP



  • Scenario: GatewayESP8266 with UDP

    If you clone the development version from github and try to compile the GatewayESP8266 with MY_USE_UDP it will fall over a bunch of compilation errors.
    The reason is found in the MySensors.h around line 153, GATEWAY - TRANSPORT

    #if (defined(MY_CONTROLLER_IP_ADDRESS) || defined(MY_CONTROLLER_URL_ADDRESS))
    	#define MY_GATEWAY_CLIENT_MODE
    #endif
    #if defined(MY_USE_UDP) && !defined(MY_GATEWAY_CLIENT_MODE)
    	#error You must specify MY_CONTROLLER_IP_ADDRESS or MY_CONTROLLER_URL_ADDRESS for UDP
    #endif
    

    Once you define MY_USE_UDP you will also want to define MY_CONTROLLER_IP_ADDRESS to send the packages to your controller,
    However as you see in the first line if MY_CONTROLLER_IP_ADDRESS is defined then MY_GATEWAY_CLIENT_MODE will be auto defined and this
    will conflict with UDP use.

    I've fixed it changing to:

    #if (defined(MY_CONTROLLER_IP_ADDRESS) || defined(MY_CONTROLLER_URL_ADDRESS)) && !defined(MY_USE_UDP)
    	#define MY_GATEWAY_CLIENT_MODE
    #endif
    #if defined(MY_USE_UDP) && (!defined(MY_CONTROLLER_IP_ADDRESS) && !defined(MY_CONTROLLER_URL_ADDRESS))
    	#error You must specify MY_CONTROLLER_IP_ADDRESS or MY_CONTROLLER_URL_ADDRESS for UDP
    #endif
    

Log in to reply
 

Suggested Topics

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts