Photon offline mode

It’s always good to keep the code tidy and avoiding multiple #include statements for the same header is never good style and scattering them all over the place doesn’t help keeping them in check :wink:

Consequently haveing dedicated sections in the code files for different kinds of definitions is something that helps me keeping track of things.
I 'm usually following this order

  • SYSTEM_..... macro instances as far up in the file as possible
  • includes in one place
  • #define statements together (possibly avoiding them where possible and rather use constants)
  • const declarations
  • variable definitions
  • object instances
  • forward declarations for functions (if required)
  • setup(), loop(), functions pertaining to Particle.xxxx() handlers
  • primary “business” logic functions
  • suplemental functions

Even when re-using older or (especially) when using someone else’s code, I first tidy up that code to match my “habitual” style which then makes it a lot easier for me to get a feeling for the code when reading that code in order to first understand what it’s doing before extending it to my needs. This way navigation and eventually debugging will be much more intuitive.

The first bullet in above order would have helped see the issue on first glance.

BTW, #include <Wire.h> is not needed, nor are some of the extra RFMxxxxx.h includes
one single ( :wink: ) #include <RFM69-Particle.h> will do.

4 Likes