Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.
0

AdafruitIO_Feed
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

AdafruitIO_Feed

by ulli_doehler on Fri Jan 01, 2021 5:46 pm

Using a lot of Adafruit feeds (AdafruitIO_Feed) requires a lot amount of RAM (especially when feed names are quite long). I tried to use the PROGMEM keyword for that, but as I could read outside this forum, PROGMEM definitions for feed strings are not supported up to now. Would it be possible to change this behaviour in the next update of the library?
Standard definition works:
Code: Select all | TOGGLE FULL SIZE
AdafruitIO_Feed *T_0 = io.feed("b.t-0");

This defintion throws a compiler error:
Code: Select all | TOGGLE FULL SIZE
AdafruitIO_Feed *T_0 = io.feed(F("b.t-0"));

This definition results in program crash:
Code: Select all | TOGGLE FULL SIZE
const char *b_t_0 PROGMEM = "b.t-0";
AdafruitIO_Feed *T_0 = io.feed(b_t_0);

Thanks a lot for your support.

ulli_doehler
 
Posts: 2
Joined: Wed Nov 18, 2020 12:57 pm

Re: AdafruitIO_Feed

by brubell on Mon Jan 04, 2021 11:49 am

There does exist a small topic format (https://io.adafruit.com/api/docs/mqtt.h ... pic-format) in the Adafruit MQTT API.

Are you using the Adafruit IO Arduino library? How many feeds are you defining?

brubell
 
Posts: 1347
Joined: Fri Jul 17, 2015 10:33 pm

Re: AdafruitIO_Feed

by ulli_doehler on Mon Jan 04, 2021 1:23 pm

The number of feeds had been more than 20. In the beginning I applied quite long names for the feeds.
i.e.:
Code: Select all | TOGGLE FULL SIZE
"beluga.t-0-switch"
"beluga.t-1-switch"
"beluga.h-0-on"
"beluga.h-1-on"
...

and so on. Which resulted in program crash, due to stack overflow. To solve this problem, I changed all names for the topics into shorter strings, as follows:
Code: Select all | TOGGLE FULL SIZE
"b.t-0-swi"
"b.t-1-swi"
"b.h-0"
"b.h-0"
...

and so on. This solved my problem for the moment. But it would be nice when longer names could be applied, which would help for better readability of the program code. Therefore it would be nice when the F("name to a topic") macro could be allowed.

ulli_doehler
 
Posts: 2
Joined: Wed Nov 18, 2020 12:57 pm

Re: AdafruitIO_Feed

by brubell on Wed Jan 06, 2021 11:52 am

Could you file an issue over on https://github.com/adafruit/Adafruit_IO_Arduino/issues requesting that we switch to using short feed names in that library?

brubell
 
Posts: 1347
Joined: Fri Jul 17, 2015 10:33 pm

Please be positive and constructive with your questions and comments.