gaute
New Member
Posts: 34
|
Post by gaute on Dec 19, 2015 13:33:59 GMT
I got a wierd error message when I tried to upload GW 2.3 today.
RFM_MQTT_GW_23:129: error: 'mqtt_subs' was not declared in this scope
PubSubClient mqttClient(mqtt_server, 1883, mqtt_subs, ethClient );
^
exit status 1
'mqtt_subs' was not declared in this scope
I really have no idea whats wrong. Anyone?
Thanks
|
|
|
Post by papa on Dec 19, 2015 19:59:11 GMT
Yes, baffling isn't it, since Gateway 2.3 does not seem that different than 2.2 & once upon a time, that one compiled correctly, right. Well ...
Are you maybe using the latest version of the Arduino IDE? If so, I think is what may be happening because similar things happened to me lately with that IDE:
Apparently former IDE versions were more forgiving about placing subroutines later than where they are called. Latest IDE seems more strict.
Thus the error is telling you exactly what happened UNDER THE NEW RESTRICTION...
The line that threw an error for you is #129
Indeed, mqtt_subs is not declared until line 350: void mqtt_subs(char* topic, byte* payload, unsigned int length) etc
How to fix this? Move the whole subroutine (looks like 350-485) before where it is called.
Once you fix this, other errors (according to the IDE) may also holler & require you to move declarations before where the item is used.
My understanding is that something should be declared with a void, int, bool, etc. before it is used
Maybe subroutines were excepted before, but not with more current IDE
|
|
gaute
New Member
Posts: 34
|
Post by gaute on Dec 19, 2015 20:29:54 GMT
I see, Simple soluting:
char buff_mess[32]; // MQTT publish message string void mqtt_subs(char* topic, byte* payload, unsigned int length);
RFM69 radio; EthernetClient ethClient; PubSubClient mqttClient(mqtt_server, 1883, mqtt_subs, ethClient );
I'm currently testing the code, but it seems to work.
|
|
|
Post by papa on Dec 19, 2015 22:43:20 GMT
I found the above out by trial & error. Just now I found a post on the Arduino forum which discusses this. Apparently, having ALL things declared before use is preferred. The post raises the possibility that the problem is not the newer version of the IDE, but rather some vague "add-on" that did not make it with the install. At the end of the post is a work around for the error which is to put a copy of the subroutine's first line somewhere before the variable is used. Then the subroutine can be left where it is, but it encourages that we follow the preferred practice. Apparently, gaute, you used the work around.
|
|
gaute
New Member
Posts: 34
|
Post by gaute on Dec 20, 2015 2:32:18 GMT
Thanks, This is definitely not my day..: Of some weird reason, my GW gets stuck whenever I try to send a message to a node. The R LED lights up and stays there. I've tried to go back to the last version of the GW (that worked yesterday!) and tried to use an older IDE.. No solution. The Debug also gets stuck, and stop showing messages. Last message it shows it that it tries to send, and then it freezes. All following commands are ignored. Local commands (Version and uptime) on the GW are working fine (until I try to call a node).
Anyone had similar problems earlier?
G
|
|
|
Post by papa on Dec 20, 2015 2:49:32 GMT
Maybe you took care of this, but are you using the updated node version 2.2 that goes with the updated Gateway? The one that looks like this.
|
|
gaute
New Member
Posts: 34
|
Post by gaute on Dec 20, 2015 10:38:22 GMT
Yepp, I use the new version..
|
|
|
Post by papa on Dec 20, 2015 12:19:23 GMT
I am handicapped a couple ways: have not gone to latest GW & node versions & am away from my network for a couple days, will often be busy with family.
Couple more questions:
When u went back to previous version of GW, did U go back to previous node version, too?
Sounds like GW is connecting to Mqtt server, right, that light comes on GW,right?
|
|
gaute
New Member
Posts: 34
|
Post by gaute on Dec 20, 2015 13:49:59 GMT
Yepp, I get GW request, like version. So that works.
|
|
gaute
New Member
Posts: 34
|
Post by gaute on Dec 20, 2015 21:25:16 GMT
Okey, Now I got connection. But the GW freezes after some time.
I can't figure out the problem from the Debug either. It just freezes too. Seem like it stuck in some kind of loop.
G
|
|
gaute
New Member
Posts: 34
|
Post by gaute on Dec 20, 2015 22:49:54 GMT
This is quite embarrassing... I reinstalled the IDE multiple times, before I did the workaround.
Then, of course... I forgot.. To.. Edit... w5100.h.......
Shame on me!
|
|
|
Post by papa on Dec 21, 2015 2:55:56 GMT
Glad it worked out. Chuckle, when I'm having troubles, also, it's usually something I overlooked. In the their own cryptic ways, the hardware or software is trying to tell me & I am not paying attention to the right thing. Of course, this project has many details to keep track of. What happened for you is maybe another example where it helps to have a list of things to take care of when starting over at some level. In such a starting again somewhere situation, you might skim through my step by steps in my Success... posts starting with Oct 8, 2015 at 6:40pm & see if you missed something. That's pretty detailed on what to do (other than with Raspberry Pi) including editing w5100.h
|
|