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

[Photon] Strange serial (and app) behavior in Listening Mode #669

Closed
pomplesiegel opened this issue Oct 5, 2015 · 1 comment

Comments

@pomplesiegel
Copy link

commented Oct 5, 2015

When running SYSTEM_THREAD(ENABLE) and SYSTEM_MODE(MANUAL) and Photon is put into listening mode following a normal setup + loop, we're seeing scattered serial output in addition to expected listening mode output when invoking serial commands like i or v. This is strange, as at the moment (even using SYSTEM_THREAD(ENABLE) ) Listening mode blocks all user app code from executing.

Perhaps does the user's loop() run for a brief moment surrounding fielding a serial command?

Code to reproduce

#include "application.h"

SYSTEM_MODE(MANUAL);
SYSTEM_THREAD(ENABLED);

void setup()
{
  Serial.begin(9600);
  delay(2000);
  Serial.println("Beginning Listening mode test!");

  WiFi.on();
  WiFi.connect();
  Particle.connect();
}

int timeOfLastSerialMessage = 0;

void loop()
{
  //once per second
  if( timeOfLastSerialMessage != Time.now() ) 
  {
    //Output a message over serial 
    Serial.println("outputting a message to serial...");
    timeOfLastSerialMessage = Time.now();
  }

  Particle.process();

  //Possible delay of a program
  delay(5);
}

Steps to reproduce

  1. Set up a Photon running the code above, which outputs data using Serial.println() once per second.
  2. Allow the app to go through setup() and loop()
  3. Place the Photon in listening mode using the "setup/mode" button
  4. Call out commands like i or v over serial and observe the scrambled output, and the fact that the user app must be running in a somewhat limited capacity.

Expected output

outputting a message to serial...
<now device placed into listening mode>
device id is <deviceID>
system firmware version: 0.4.6

Observed output

Youtpoutting a umessage tro serial. ..
device id is <deviceID>
system firmware version: 0.4.6

o
utputtingsystem firmware version: 0.4.6

 a 
message tsystem firmware version: 0.4.6

o se
rial...
system firmware version: 0.4.6

system firmware version: 0.4.6

outp
utting a 

This can also be quite strange when attempting to set up WiFi creds on a Photon over serial if the user app has a bunch of data queued up to output over serial.

@m-mcgowan

This comment has been minimized.

Copy link
Contributor

commented Mar 14, 2016

Fixed in 0.4.9

@m-mcgowan m-mcgowan closed this Mar 16, 2016

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