Particle Dev Compile time access to type of device?

I’m enjoying the nice tight compose-edit-compile-flash cycle I get with the Photon and Particle Dev. I no longer bother with local compilation which avoids all sorts of version control issues. Thank you.

Some of my code is device dependent, for example:

#ifdef PHOTON
    setADCSampleTime(ADC_SampleTime_112Cycles); // Photon specific code
#endif

It isn’t a big issue but as the compiler obviously knows whether the target is Core or Spark, is there a system defined variable that I can use instead of adding my own #define PHOTON ?
I appreciate it isn’t as important as the bug fixes the clever Particle guys are working on but maybe it is already done and I just haven’t found it.

I think you can try something like:

#if PLATFORM_ID==6
//blah blash
#endif
1 Like

That works @kennethlimcp! Now I only need one version of my software. Thank you.

1 Like