Particle Dev and build.particle.io flashing different firmware

I have been using the build web interface and want to switch over to Particle Dev but am having some very strange issues.

Issue 1 is that the Particle Dev will compile code that has errors and build catches them i.e. mistaking a colon for a semicolon throws an error in build but not in dev leading me to believe it isn’t really compiling the code in Dev, but code some place in the cloud for the last version I flashed from build.

Issue 2 is that when I flash the device from particle Dev, it compiles the code, flashes the device and the device just goes back to “breathing mode”, not updating the firmware. Copy and paste the code into build and it works as expected.

I have tried deleting the firmware compiled in Dev and recompiling but that doesn’t help. My photon is running firmware 0.5.0.

Exactly, Dev uploads your project files to the cloud where the project gets built and the binary will be downloaded.
But one common misunderstanding leads to such confusion.
Dev doesn't really care which file you've got open in the editor in order to build. You need to select the correct project folder that can only contain one .ino file.

Issue 2 might be a consequence of building the wrong project which actually gets flashed but is supposed to be in "breathing mode" (which BTW is the default mode anyway, so why is this indicating a problem - clarify?)

I understand that the files are being uploaded and compiled in the cloud, or should be. However in this case whatever is getting compiled in the cloud is not the file I have open in dev. I.E. the file in Dev blinks D7 and Serial.println’s Hello World which works when flashed from build, but when flashed from Dev it just goes back to the default mode. Example of order of events:

  • Compile and flash .ino file in build = photon blinks D7 and outputs Hello World to the Serial Monitor.
  • Compile and flash exact same code in Dev = photon goes back to default mode, no serial output, no blinking D7.

Therefore, when I compile and flash from Dev whatever is being compiled and flashed onto the photon is not the code I have in Dev.

Including screen shot for clarity. Note that the hello world you see in the serial monitor is from when I have flashed from build. If I flash the same code from Dev and connect the serial monitor there is no output.

Note the code below compiles in Dev and the device is successfully flashed as well. But clearly it isn’t the code below as I inserted nonsense between setup and loop.

This dot (I put a purple arrow pointing to it) means the file was not saved. I vaguely remember having a problem once where my files weren’t being saved by Command-S. Selecting Save All from the menu worked, but then Save started working again and I forgot about it. Or I might be imagining things, but I think that happened.

Interesting. Saving the file causes the errors to be caught when I compile it, but it doesn’t flash the new file to the device unless I do the following:

  • Save File
  • Delete existing firmware from Dev
  • Compile and Flash

Surely this isn’t the expected work flow? Any ideas on how to simplify this? I went through the settings and I don’t see anything that looks relevant to the process.

Thanks for the help.

That is the “expected” behaviour too.

When there is a bin file present it will be used to flash. If it isn’t it’ll be built first and then flashed.

But you don’t need to delete the file, but press first build in cloud and after that flash.

I know that’s not what you’d expect (especially coming from Particle Build that does the auto-save, build and flash in one go)
But someone thought that was a clever improvement and we’ve tried to vote for making it optional - but well …

I am still struggling with this and I don’t understand what is going wrong. When I Save, Compile, Flash, the project in the image below, it works as expected.

However, when I do the same with the project in the screen shot below, it says it compiles and I see the new firmware in Particle Dev I can flash using the button on the left or right click on the firmware and choose “Flash File OTA”, and the Photon flashes but returns to the default state of the main LED slowly pulsing. I can even insert trash text e.i. “FOO” into the .ino file and it will still compile. If I do the same in the first project I posted it throws and error on compile.


The same project in the online build.particle.io tool compiles and flashes the Photon properly and works as expected.

Any ideas much appreciated.

Have you removed all the examples folders from the libraries you imported there?
If there are other .ino files somewhere in your project folder or subdirectories, one of these might be built instead of your intended one.
BTW, you still have the blue spot next to your file name in the file-tab. So your last edit was not saved yet (as pointed out earlier).

If you provide a screenshot, it should be prove that there are none of the already explaned errors at work.

Yes, see screen shot below. One other thing to note, if the includes are incorrect the project will fail to compile. However, if there are any other errors in the code it compiles fine. Either way, it isn’t flashing with the code in the project. In the example below, I cut and paste the code from the project that works into the one that doesn’t and comment out the other code in the loop. It compiles and still behaves the same, pulsing blue main LED, D7 does nothing.

You might also want to use a particle.ignore file to exclude all non source files (or remove them) -including the .DS_Store files.
How about copying the not working code and the library folders into the working project?

This is very strange. If I compile the blink code like you see below, it compiles, flashes and works as expected.

If I add the include statements in the code, it compiles, flashes, and then doesn't work, it just does the default LED pulse.

Stranger still, if I comment out the includes and compile, it does the exact same thing as if the includes are still there. It compiles, flashes and then gets the default LED pulse.

I can then delete the include statements, compile and flash again and it works, i.e. D7 blinks as expected.

I can't get rid of the .DStore files, those are hidden OS X system files. If you delete them the OS regenerates them. I did however delete one .txt file that wasn't needed with no change.

You need to put the include statements as if the files were in a flat directory (no subdirectpries), since the structure gets flattened on upload.

BTW, the path in your current includes does not fit your file path either :wink:
SparkFun.../firmware/SparkFun....h vs. SparkFun/SparkFun.h

Thanks! That fixed it. All I had to do was get rid or the directories and change the path in the includes. Is there a log or anything I can look at that might help diagnose this type of thing in the future? It is really hard to debug something that compiles with out throwing errors.