Earlier in the week, my teammates and I were working on some Photon software. We have an option for a debug mode where the usb cable is plugged in and serial messages are spit out over the USB. During production, the photon is powered by an external line and no serial statements are sent. You could invoke the debug mode by using
#define DEBUG_FLAG
In the code’s body of main.ino, we had several places where print statements would be executed based on
#ifdef DEBUG_FLAG
Serial.println("print state info here");
#endif
This was working as of a few days ago (over the weekend). Recently we have run into issues though were these print statements are never executed. We used the cloud compiler to produce two binaries, one with #define DEBUG_FLAG and one without that define line (commented out). and the cloud produced two executables that are identical. (Running diff with_debug.bin without_debug.bin produces no difference.)
Was the particle cloud changed recently or am I missing something?
Thanks for your suggestions and help - we realized the error.
There was a nested directory in our project folder that also contained a main.ino file. Although we had not run into problems previously with that nested folder, when we renamed the top-level main.ino to program.ino, we suddenly saw the compiler returning errors for the subdirectory/main.ino file. We didn’t realize that the subdirectory’s files were getting pushed to the cloud compiler. It seems like the subdirectory’s main.ino code was superceding the top-level setup() and loop() functions but the compiler wasn’t returning warnings that setup() and loop() were doubly defined.
By moving the subdirectory project out of the top directory, we have regained our determinacy - #ifdef works as expected now. Sorry for the misdirected diagnosis.