V7.0 is noticeably less stable than 6.3

Hi, I I use photons in a classroom setting with many wifi phones and other devices. (70 students with phones and devices, plus one or two photons)

7.0 is noticeably less stable in this environment. Publish and subscribe are noticeably degraded and far less reliable. They were usable before and seemed to publish/subscribe reliably. Now getting a publish/subscribe to work requires some luck.

Also, we have noticed the particle variables are reliably unreliable. If you query for a variable value the photon will flash red and reboot. I have attached the code below with the variables.

code:

#include <math.h>;

SYSTEM_THREAD(ENABLED);


double counts =0;
double inches =0;
double filterinch=0;
double filtercount=0;
double filterconstant=60; //increase this term in increase filtering.  0 = no filtering.. do not get too high or you get bad data and errors from rounding


void setup() {
 Particle.variable("countsseen",counts);
 Particle.variable("filtercount",filtercount);
 Particle.variable("inchesseen",inches);
 Particle.variable("filterinch",filterinch);
 Serial.begin(230400);
 delay(5000);
 Serial.print("Hello World Distance Test Photon ");
 Serial.print("a demo for MEGR3171, Example analog non-linear sensor calibration");
 delay(5000);
}

void loop() {

 counts = analogRead(A0);
 //calibration entered from excel spreadsheet.
 
 inches = 0.0000012*pow(counts,2) - 0.0085665*counts + 18.345940;
 //y = 0.00000120x2 - 0.00856652x + 18.34594023
 
 filterinch = ((filterinch*filterconstant)+inches)/(filterconstant+1);
 filtercount = ((filtercount*filterconstant)+counts)/(filterconstant+1);
 Serial.print("counts ");
 Serial.print(counts);
 Serial.print(" inches ");
 Serial.println(inches);
 delay(50);
}

Please remove the delay in setup() since this can interfere with variable registration. https://github.com/particle-iot/firmware/issues/738

1 Like

Another suggestion would be to rearrange things a bit and use SYSTEM_MODE(SEMI_AUTOMATIC); to ensure you register variables and functions before handshaking with the cloud.

void setup() {
 Serial.begin(230400);
 delay(5000);
 Serial.print("Hello World Distance Test Photon ");
 Serial.print("a demo for MEGR3171, Example analog non-linear sensor calibration");
 delay(5000);

 Particle.variable("countsseen",counts);
 Particle.variable("filtercount",filtercount);
 Particle.variable("inchesseen",inches);
 Particle.variable("filterinch",filterinch);
 Particle.connect(); // ensures we connect and send the describe message after variables and functions are registered.
 waitUntil(Particle.connected); // optional
}