RedBear Duo and DS18B20 Library gives "Platform" error

Trying to compile code using the DS18B20 Library on a RedBear gives me a platform not supported error.

How do I go about getting the library updated? Is this the right place to ask for this?

Thanks in advance for any help

@Jseiler, the Particl-OneWire library included in the DS18B20 code uses the PLATFORM flag to decide which device it is running on. Since the DUO is new, the author of the library did not include the DUO PLATFORM as part of the code. You may want to contact @LukeUSMC directly to see if he can make the necessary updates. :smile:

Or till then you could just copy the lib files add them to your project as seperate files and add the PLATFORM_ID to the respective code blocks.

1 Like

Hi,
I experienced exactly the same issue with the OneWireSpark library from @Hotaman, I logged an issue on his github repository.

I hope we see some quick updates on these libraries.
Thanks for updating

I must say I hadnā€™t really tried this feature in the web IDE before and was a little hesitant.

Wow, it actually worked! I learned something new today. That alone is scary, at my age one new thing learned usually means four other things forgotten. :laughing:

Thanks a million.:grinning:

2 Likes

Send me what you added/changed and Iā€™ll get it in the lib. Thanks!

Hi Luke,

I change only one line in OneWire.h

This

elif PLATFORM_ID == 6 || PLATFORM_ID == 8 || PLATFORM_ID == 10 // Photon, P1 & Electron

to this

elif PLATFORM_ID == 6 || PLATFORM_ID == 8 || PLATFORM_ID == 10 || PLATFORM_ID == 88 // Photon, P1 & Electron & RedBear Duo

Everything compiled without further errors after that.

Thanks for getting back so quickly,
Joerg

To spare yourself the trouble of having to cater for all kinds of platforms to come, you could drop your own functions and rather go for the meanwhile established functions
https://docs.particle.io/reference/firmware/photon/#low-level-input-output

And only check for the older firmware versions prior the introduction of these.

This is what I use for that reason

#if (SYSTEM_VERSION < 0x00040400)  // no fast pin functions before 0.4.4
# if defined(STM32F2XX)            // for the Photon and friends
#  define pinResetFast(_pin)	       (PIN_MAP[_pin].gpio_peripheral->BSRRH = PIN_MAP[_pin].gpio_pin)
#  define pinSetFast(_pin)	       (PIN_MAP[_pin].gpio_peripheral->BSRRL = PIN_MAP[_pin].gpio_pin)
# elif defined(STM32F10X_MD)       // for the Core
#  define pinResetFast(_pin)	       (PIN_MAP[_pin].gpio_peripheral->BRR = PIN_MAP[_pin].gpio_pin)
#  define pinSetFast(_pin)	       (PIN_MAP[_pin].gpio_peripheral->BSRR = PIN_MAP[_pin].gpio_pin)
# endif
# define digitalWriteFast(_pin, _hilo) (_hilo ? pinSetFast(_pin) : pinResetFast(_pin))
# define pinReadFast(_pin)             (PIN_MAP[_pin].gpio_peripheral->IDR & PIN_MAP[_pin].gpio_pin ? 0xFF : LOW)
#endif

And you can add the missing read functions just the same

Excellent Idea @ScruffR, Iā€™ll change the lib to look for the old types only. I donā€™t want to have to go looking for platform ID numbers for products I donā€™t use. Looks like an interesting device (P1 with a BT radio?), but I added BT to my particles long ago and I really like how zippy my Photons are :).

I wish they would think to let us know when a new device is being released. Instead we get bad mouthed for something we had nothing to do with or even knew about. Now thatā€™s gratitude for ya. LOL

1 Like

Itā€™s not always easy for Particle to know when exactly a third party product will hit the shelves and also which user contributed libraries would not work with them.
But if any of the generous lib contributors should ever get bad mouthed for something they couldnā€™t know or help, itā€™d be the fault of the one opening the mouth and weā€™d be telling them :wink:

They should only open their mouth if they can do it better and then only in a constructive way.

We are prepared to keep the forum culture positive.

But if you find a inappropriate post, you can always flag it and an Elite or ā€œParticleliteā€ will take care of it.

2 Likes

@ScruffR,

Nice response :wink:

Iā€™m guessing you know me well enough by now to know I like to joke around and give folks a hard time to promote deeper thought. Iā€™m a coder/hardware engie, I have very thick skin by default :smile:

Iā€™d say Particle is doing a pretty good job of dealing with growing pains. There is always going to be rough spots. Perhaps a mail list or private forum for maintainers would work to get the word out about new devices in a timely manor?

At this point my go to development devices are: RPi, Photon, Electron, Teensy, and Arduino Pro Mini/AVR. Soon to be joined by the Pine64. Iā€™m a little apprehensive about Microchip buying Atmel. I left the PICs in the dust once the AVR design stabilized. The AVR was just much easier to work with. Iā€™m thinking a price jump will hit once the deal is done.

Sorry, off topic, back to the issue at handā€¦

For anyone interested, I have updated the OneWire lib to v1.4
It should now work with the Core and all future STM32F2ā€¦ devices (I hope ;)) It looks for the Core, otherwise, itā€™s the current platform. The unsupported platform error has been removed.

FYI it has NOT been tested yet by myself. Iā€™ll test it out this coming weekend on the Photon and Electron, but I thought maybe someone might want to use it now and it should work just fine unless I fat fingered something.

@rudyvan (I think) indicated he would test it out on the Redbear DUO next week. I wonā€™t be able to get one to test with until they are available to order.

Enjoy Life!

4 Likes

Since I have a OneWire project on the go and a RedBear DUO on hand, Iā€™ll give it a shot tonight and report back in the morning.

Thanks for doing this, life is more enjoyable already! :smiley:

1 Like

@Hotaman, hi, thanks for updating your librabry and as promised I just gave it a try, I linked the Onewirelib 1.4 to an example and compiled it.

So I included the library from Github and it compiles for Duo :smile:

Thanks

It appears that the updated library hasnā€™t migrated to the web IDE yet. Github has the latest version.

@rudyvan, Thanks, Good to here it is working for you DUO users!

@Jseiler, If you have the lib (v1.3) attached to an existing project in the webIDE. To use the new version you need to remove the lib from the project, then add it back in. It wonā€™t update automatically, keeps things from breaking unexpectedly when a lib is updated. I just added v1.4 to a project in the webIDE so I know it is there.

The IDE is being a little brain dead for me, it is showing me both 1.3 and 1.4 under ā€˜my libsā€™. In the community list I do get 1.4 so that is what you should see. you may also be able to click the info button and select the version you want.

Let me know if you still canā€™t get to it, I may need to have someone at Particle give it a kick in the pants.

1 Like

Aha! Had to clear the cache, now it shows up for me too.

Thanks again.

@Jseiler, Glad itā€™s working for you now.

Good luck with your project!

Just got home, walked the dog on a beautiful sunny evening and flashed the new OneWire library to one of my RedBear DUOs and it works like a charm.

Seriously, what more could you want. :sunny: Life is good.

Thanks. :+1:

1 Like

I have created pull request for the change so hopefully it will get accepted soon, in the meantime the modified version is here: https://github.com/rafiki270/ds18b20-photon