Problem compiling sketch on library 1.5 DEVEL



  • Hello,

    I know it's in development, but I've moved to library 1.5 DEVEL to test the MQTT clientforwarder.
    Now, I'm trying to compile an old sketch that worked on previous libraries and it fails here:

    In file included from my-example.ino:17:0:
    
    \arduino-1.6.1\libraries\MySensors/MySensor.h:223:3: error: #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
      #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
       ^
    my-example.ino:109:1: error: 'MySensor' does not name a type
    my-example.ino: In function 'void setup()':
    my-example.ino:129:3: error: 'gw' was not declared in this scope
    my-example.ino: In function 'void loop()':
    my-example.ino:190:3: error: 'gw' was not declared in this scope
    my-example.ino: In function 'void incomingMessage(const MyMessage&)':
    my-example.ino:298:6: error: 'gw' was not declared in this scope
    

    Line 109 is where i declare MySensor outside any void:

    MySensor gw;
    

    Line 129 in void setup() :

    gw.begin(incomingMessage, 20, true, 0);
    

    Line 190 - in void loop() :

    gw.process();
    

    Line 298 - in void incomingMessage(const MyMessage &message) {:

    gw.saveState(message.sensor, message.getBool());
    

    Any suggestion?

    Thanks!

    Simon


  • Hero Member

    Looking at the MySensors example sketches from the develoupment branch it seems like you can remove:

    MySensor gw;
    

    and from the rest just remove

    gw.
    


  • Thanks @korttoma but, if I remove:

    MySensor gw;
    

    and then move from:

    gw.begin(incomingMessage, 20, true, 0);
    

    to:

    begin(incomingMessage, 20, true, 0);
    

    I get

    \arduino-1.6.1\libraries\MySensors/MySensor.h:223:3: error: #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
      #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
       ^
    my-example.ino: In function 'void setup()':
    my-example.ino:128:37: error: 'begin' was not declared in this scope
    (...)
    

  • Hero Member

    I think you need to include MySensor.h after any configuration defines

    I found a post by @hek pointing to the following document -> https://docs.google.com/document/d/1NKq5uuNdnxF5jWnum7VT32mbKLjuvqlx2A5D1qQ-H3Q/edit#

    There I read:

    Converting sketch from 1.5 to to 2.0
    
    Add the following to activate NRF-radio support
    #define MY_RADIO_NRF24
    
    Remove MySensor constructor 
    MySensors gw; 
    
    Remove MySensors setup() call 
    gw.setup(....);
    
    If node expects incoming messages, add the following function to handle data:
    void receive(const MyMessage &msg) {}
    
    Move present() and sendSketchInfo() from setup() to a new function called presentation().
    void presentation() {
         sendSketchInfo(...)	
         present(...);
    }
    
    If you’re using static ids , add:
    #define MY_NODE_ID xx
    
    If static parent node is used, add:
    #define MY_PARENT_NODE_ID xx
    
    If you want node to be a repeater, add
    #define MY_REPEATER_FEATURE
    
    Remove all “gw.” before MySensors library calls.
    
    If node requests time using requestTime(), remove callback argument define define the following function to handle time response:
    void receiveTime(unsigned long ts) {
    }
    
    Make sure to include MySensor.h after any configuration defines.


  • Thanks a lot for pointing me to the right place! Now it compiles correctly.
    It's only to understand if it works. Cannot test it here right now. I'll do it soon!
    Thank you 😉

    Simon


Log in to reply
 

Suggested Topics

11
Online

11.4k
Users

11.1k
Topics

112.7k
Posts