Yes.
BTW, the "offending" lines referenced in the compiler errors do not appear in any of the individual files associated with the NCD2Relay.h library.
Yes.
BTW, the "offending" lines referenced in the compiler errors do not appear in any of the individual files associated with the NCD2Relay.h library.
and that is the only line you are changing? if you rollback the change it builds fine?
That was the only change. I rooled it back but it still won't compile (same errors).
Here is the entire file that will not compile but which is in production on a different device (I have removed beaucoup comments for clarity):
// This #include statement was automatically added by the Particle IDE.
#include <NCD2Relay.h>
NCD2Relay controller;
SYSTEM_THREAD(ENABLED);
String data = String(10);
int status;
int GPIOStatus3;
int publishInterval = 600000; // 10 minutes
int lastPublish = millis();
float lastReset = millis();
bool Restart = true;
bool Disable = false;
int setZone (String zone);
int PhotonOff = 0;
//STARTUP(WiFi.selectAntenna(ANT_AUTO));
void setup(){
//WiFi.setCredentials("MTWA", "Cr3st0n!");
waitUntil(Particle.connected);
controller.setAddress(0,0,0);
int status = controller.readInputStatus(3); // Read input terminal 3
Particle.publish("Tank", String(status));
lastReset = System.millis();
Particle.function("Disable", DisableAuto);
Particle.variable("GPIO3", GPIOStatus3);
Particle.variable("Is_Disabled", PhotonOff);
Time.zone(-5);
}
// Function to disable or enable transmissions
int DisableAuto(String command){
String Command = command;
if (Command.equalsIgnoreCase("yes")){
Disable = true;
int (PhotonOff = 1);
Particle.publish ("Disabled", "Photon disabled manually");
return 1;
}
if (Command.equalsIgnoreCase("no")){
Disable = false;
int (PhotonOff = 0);
Particle.publish ("Disabled", "Photon re-enabled manually");
return 1;
}
return -1;
}
void loop(){
int(GPIOStatus3 = controller.readInputStatus(3));
if ( Particle.connected() ){
if ( Restart == true){
Particle.publish("Restart", "Photon restarted"); // Send status to log
Restart = false;
}
}
if ( millis() > lastReset + 3600000 ){
controller.setAddress(0,0,0); // Reinitialize the MCP23008 chip on the NCD relay board
lastReset = millis(); // Reset last initialization time to current program time
}
if (millis() >= lastPublish + publishInterval){ // If it's been 10 minutes since last publish
int status = controller.readInputStatus(3); // Read input terminal
Particle.publish("Tank", String(status));
lastPublish = millis();
}
}
}
that's weird, so maybe this is not the program you were using before?
It is. Copied it directly from the IDE and pasted it directly into a new app and made that single edit.
Just for the hell of it, I started all over. I copied the production file and pasted it into yet another new app. I had to delete the "#include <NCD2Relay.h>" line or else I'd get an error about duplication when trying to include that library. After deleting that line, I then included the library and the thing still will not compile. Same errors.
if you feel comfortable, can you share it here or via a DM?
Here ya go: Particle Web IDE
Note that I have a similar compiler error situation with my Boron code that I was going to mention here in the forum but I have been concentrating on the Photon issue first to avoid confusion (see attached screenshot). But the fact that for the first time in years I am seeing illogical and unresolvable compiler errors forces the question: is there any resource whatsoever on my Mac that the Particle compiler(s) employ for any purpose, i.e. might I have an issue with my computer? I would think/hope not, but I thought I'd ask.
the problem lies in an extra library called string that this program has added - which I have no clue what it does, but you remove it and off you go:
I concur with @gusgonnet since I can compile when I remove it. Also, you seem to have a redundant NCD library. I compiled using the NCD2Relay library.
BINGO!! Many thanks guys. But in a sense it is a bit comical that it would suddenly appear and no one knows what it does. Where do these changes originate? Particle? NCD? The Holy Ghost?
Update: To all those who have offered insights and/or suggestions regarding my issue, here is the current status:
I first made sure that my test Photon 2 was running code that is precisely identical to that running on my 'production' Photon 300 miles away (flashed the same file to both). I had played around a bit with the watchdog option but removed that code since I did not want to ever place into production a device that was so unreliable that it would periodically and randomly reboot.
Once I had both devices on the same firmware, I left the test unit powered up for several days during which it still locked up two or three times (status LED displaying steady cyan, no 'breathing'). On each such occasion, I powered it off and on again and it would re-sync with the cloud immediately, suggesting that the inability to connect to the cloud was not related to any problem with my ISP or any blacklisting by the Particle Cloud. But just to be sure, I took the Photon to a neighbor's home to remove my personal Internet service as a potential factor; no change. Still locked up after a while.
The test unit had been imbedded on an NCD relay board (to perfectly replicate the production environment) and was being powered from it. So in the very unlikely case that the NCD board was playing some kind of role in the problem, I removed the Photon from it and, instead, powered it via USB. No change in behavior, i.e. it still locked up.
Once or twice, the Photon completely shut down, i.e. no status LED at all. Completely dark except for the blue power LED. Even in those cases, a power cycle would bring everything back to life immediately.
While all testing so far tends to point at the Photon itself as the underlying cause of the lock-ups, I remain skeptical. If there is a hardware fault, I would expect that the symptom would be regular and predictable; it is not.
Note, again, that the production Photon hasn't skipped a beat, ever. In fact, at one point a couple of days ago, Spectrum's Internet service went down for over 6 hours. When it was restored, the production Photon reconnected to the cloud instantly and resumed normal operation.
So I am about to give up unless anyone has other suggestions as to cause or experiments to run.
What Device OS are you on? This might be part of a bug that may have been fixed in 6.2.1. I've not thoroughly tested it - but I had been using 5.8.0 and it was mostly stable for this specific issue. It also seems to happen when there are multiple wifi APs with the same SSID, not sure if that's your case at home.
Both my problematic "test" Photon and the perfectly-stable production Photon are running 5.9.0. I have 3 SSIDs, all different.
A single router for all 3? No mesh or repeater?
Either way I would try your test Photon at 5.8.0 or 6.2.1 and see if it makes a difference.
Production Photon - 300 miles from me - is connected to a single AP and is rock-solid. My test unit is connected here to a mesh WiFi network with 3 APs. Note, though, that I took the test Photon to a friend's home (single AP, different ISP) with no change in symptoms. I doubt if changing device OS would have any benefit since, as mentioned, the production Photon does not exhibit any issues.