[Start]: I am using the Particle CLI to compile code from the command line.
particle compile photon --target 3.1.0
[Problem]: However, I am getting an error where Ethernet
is not recognized and it is blocking compilation.
[Repeatable?]: This error does not occur when I compile using the Particle Workbench extension in VS Code.
[Code]: Here is the code file I am compiling with Particle CLI
#define CLOUD_CHECK_MS 5000
SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(AUTOMATIC);
SerialLogHandler logHandler(LOG_LEVEL_WARN, {{"app", LOG_LEVEL_INFO}});
long now = 0;
long lastCloudCheck = 0;
void setup() {
System.enableFeature(FEATURE_ETHERNET_DETECTION);
}
void loop() {
now = millis();
if(now - lastCloudCheck > CLOUD_CHECK_MS){
lastCloudCheck = now;
if (WiFi.ready() || Ethernet.ready()) {
Log.info("Internet OK");
}
}
}