[SOLVED] Particle DEV Compile Errors with SYSTEM_THREAD(ENABLED) and SYSTEM_MODE(AUTOMATIC)

Hello Particle Forum,

Yesterday my code on particle dev that was previously working began giving a strange compile error. It goes away when I comment out the top lines of my code.

Compile Error:

Commenting out this part removes the compile error:

What I have tried.

My device target is set to 6.1 in Particle Build, and the device is running 6.1.
I re-installed with the latest Particle Dev from particle website.

Other than those checks I’m stuck on what to do. These commands work just fine on the web IDE however, the program I have currently is very large with multiple files and trying to get in to web IDE would be very difficult.

This error was not showing up until 3/14/17. On 3/11/18 It compiled without error.

Is anyone else experiencing difficulty with Particle Dev and System_Thread() and System_Mode() ?

Do you get the same error when building your project with particle-cli?

This might have something to do with a recent update to the Wiring preprocessor.
Can you try swapping around SYSTEM_MODE() and SYSTEM_THREAD(), adding/removing blank lines before/after, remove the semicolon after the instructions.

What are the next few instructions?

1 Like

Hi nrobinson2000,

I tried with compiling with Particle CLI and got the same error as before. I thought that was a good idea.

Hi ScruffR,

I tried reversing the order of the commands, as well as removing the spaces, and that did not change the error.

I do get something different when I remove the semi-colon of the one above. It seems to only color in the lower command (SYSTEM_MODE in this case) when there is a semi colon.

The rest of the code prior to setup is a series of include statements for other library files I would like to use.

SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(AUTOMATIC);

#include "CanUart.h"
#include "DebugLevel.h"
#include "SDLogger.h"
//#include "GPSWrap.h"
#include "Motor.h"
#include "Behavior.h"
#include "Led.h"
#include "Buzzer.h"
#include "Particle.h"
#include "UbidotsValue.h"
#define DEBUG_BAUDRATE 115200

void setup(){

I’m just really not sure why it has stopped working from this past Sunday.

As I said, it might be in conjunction with this

You can also try

#praga SPARK_NO_PREPROCESSOR
#include <Particle.h>

and add function prototype for your functions in the main project file.

Maybe this is also something @jvanier wants to chime in on in connection with the possible impact of his bug-fix.

Hi ScruffR,

Thank you for the suggestions,

Where can I get more information on this tip though, I'm not sure what you are saying to do.

add function prototype for your functions in the main project file

That’s a common C/C++ term

Hi ScruffR,

Thanks for the info on the Function Prototypes.

everything is working now.

2 Likes