Bug Fix/Feature Request: Allow Photon app to run without WiFi

Can someone upgrade a Photon firmware to allow a Photon app to run while not connected to a WiFi node?

I can ping the Photon using a laptop by connecting to Photon’s softAP, but TCPServer object does not seem to run. I’ve seen posts of others apps also not running.

To demonstrate the behavior, run the app snippet from the firmware docs for TCPServer. The app echos back whatever you send it. App runs fine when connected to a remote WiFi node. Does not run when in softAP.

Ed

No request needed, just use the features that are already there

SYSTEM_MODE(SEMI_AUTOMATIC)
SYSTEM_THREAD(ENABLED)

The forum and the docs can be searched.

SoftAP and TCPServer is a different topic but doesn’t have anything to do with the title of this thread.

1 Like

What is the trick to making it work? I took those two lines, put them at the top of the TCPServer Example code which makes a telnet echo client, with no success. Here is the actual program. Are you saying if you paste this into your Photon it works when the Photon is in SoftAP mode?

Here is the code:

// EXAMPLE USAGE
SYSTEM_MODE(SEMI_AUTOMATIC)
SYSTEM_THREAD(ENABLED)

// telnet defaults to port 23
TCPServer server = TCPServer(23);

TCPClient client;

void setup()
{
  // start listening for clients
  server.begin();

  // Make sure your Serial Terminal app is closed before powering your device
//  Serial.begin(9600);
  // Now open your Serial Terminal, and hit any key to continue!
//  while(!Serial.available()) Particle.process();

//   Serial.println(WiFi.localIP());
//   Serial.println(WiFi.subnetMask());
//   Serial.println(WiFi.gatewayIP());
//   Serial.println(WiFi.SSID());
}

void loop()
{   
  if (client.connected()) {
    // echo all available bytes back to the client
    while (client.available()) {
      server.write(client.read());
    }
  } else {
      Particle.process();
      
    // if no client is yet connected, check for a new connection
    client = server.available();
    
  }
}

The “problem” is that with these two instructions in place your code runs off immediately without a WiFi connection, but I doubt your TCP objects will be able to do their job without :wink:

The docs do provide insight and samples on the system modes and multi threading tho’.

And no, I didn’t say SoftAP will just work like that. I rather meant with SoftAP you’ll see additional obstacles to overcome (if at all possible?)

1 Like