Any chance to find out about device type (Argon, Xenon, Photon) at runtime?


#1

Hi all!

I’d like to supply Information about the device type. How can I get it in my firmware?

Thx alot,

. J


#2

At run-time, I think you can only grab the device ID using System.deviceID();. I don’t know if you can grab the device type from the OS API. There’s a good example of getting device information as a Particle.variable in this post:

As far as knowing the Argon/Xenon/Boron device type, you can do that at compile-time using the example in this post which uses PLATFORM_ID:


#3

@Herkules AFAIK there is no System. call.

Since you need to compile for a specific platform you would know from your code either by using #if (PLATFORM_ID == PLATFORM_ARGON) etc. where you could define a variable to use at runtime.


#4

PLATFORM_ID is just a #define macro and will give you a number which you just can use as any other number literal too.
There also is a SYSTEM_VERSION number if you want that (although there are also System.version() and System.versionNumber())
e.g.

  Serial.printlnf("%d (System %06x)", PLATFORM_ID, SYSTEM_VERSION);