Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Particle.publish() hangs on Photon when called in listening mode with SYSTEM_THREAD(ENABLED) #761

Closed
dfukumori opened this issue Dec 9, 2015 · 2 comments

Comments

@dfukumori
Copy link

commented Dec 9, 2015

I'm using the following to test:

#include "application.h"

SYSTEM_MODE(MANUAL);
SYSTEM_THREAD(ENABLED);

#define PUBLISH_PERIOD_MS 2000

int last_publish_attempt_ms;

void setup() {
  Serial.begin(9600);
  Particle.connect(); // Should be run without credentials present.
  last_publish_attempt_ms = 0;
  delay(2000);
}

 void loop() {
   if (millis() - last_publish_attempt_ms >= PUBLISH_PERIOD_MS) {
     last_publish_attempt_ms = millis();
     Serial.println("pre-publish");
     Particle.publish("test");
     Serial.println("post-publish");
   }
 }

When monitoring the serial output over USB, a single "pre-publish" message is printed, but "post-publish" is never printed. Furthermore, the blinking blue light of listening mode becomes very slow after ~10 seconds. This issue is present in MANUAL, SEMI_AUTOMATIC, and AUTOMATIC modes.

@ScruffR

This comment has been minimized.

Copy link
Contributor

commented Dec 10, 2015

Particle.publish() should check for Particle.connected() (or any privat flags for that reason) and just return false if there is no connection.

@m-mcgowan

This comment has been minimized.

Copy link
Contributor

commented Dec 14, 2015

Sure. for now I agree that Publish should fail if in listening mode or the cloud is not connected. In future, we may use different strategies, such as queuing the publish until the cloud is connected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.