Photon softAP usage?

@mebrunet, have you given the links in this post a read?

Right, @mdma had linked me to that last week and talked about turning those SoftAP pages into a library. Curious to play with it when released and stable, but pretty over loaded with other stuff right now.

@nexxy , I have downloaded the softap-setup-js from github but I noticed that config.js is missing when I looked at basic-setup.js in the example folder. Would you add or let me know that config.js file. thanks.

Hi @mebrunet, I hosted on Digital Ocean and it doesn't work. What am I missing? I simply modified the HTML to my branding and hosted it and nothing is working. Thanks!

Any noteworthy output in the console perhaps?

Hi @Moors7, thanks for responding. There is no error....I should have been clearer. The HTML page works. I sent you a private message with the IP address. I just spun up the server on Digital Ocean yesterday to do a test - so I havent disable root login, secured the server, etc..

Here's a picture of the "error":

I feel as though this isn't an error, but rather I need to change something somewhere to "initiatie" a service. I have no idea how to technically explain this, since I am new.

My Photon already has the softap @mebrunet created flashed. But when I got to the HTML page and click the next button, the above dialogue appears.

Shouldn't I be prompted to enter the device ID or search for nearby Photons first? So it cannot be as simple as just modify the HTML and host the files.

In the script.js from the zip file, you will find the following:

var base_url = 'http://192.168.0.1/';

Should I change that to my IP address? I must have to do more than just host files, there has to be more configurations.... In some way I feel that there is not an error per se, but a step I am missing because experienced developers understand it to be implied, whereas I need a detailed step by step instruction.

Hope that made sense!

@dancingpearl -

There are two ways to use the repository of SoftAP setup tools I put together.

  1. Hosted from an external server: In this case the user should visit the url where you are hosting the setup page, e.g. this demo I have setup, and follow the instructions. The first step requires they connect their device to the Photonā€™s hotspot, which is emitted while it is Listening Mode (blinking blue). No special application firmware (i.e. the code you write) is required on the device, it just needs to be running system firmware 0.5.0 or above, which should be the case if it has already connected to the cloud once.

  2. Hosted from the Photon. In this case you need to connect to the Photon first, then visit a page its hosting. The method requires you write and flash application firmware, as described in the Firmware docs.

Which method are you trying? In the past, a had two separate SoftAP scripts for each case. The latest version I pushed to the repo two days ago should do both.

1 Like

Thank you! I understand now. I do have a remaining question. How did you change the name of the device from Photon-XXXX to Blinders-XXXX?

See this thread to change SSID.

3 Likes

Thank you!

I hope you did read down in that thread, to actually get to the dedicated function that got introduced since

System.set(SYSTEM_CONFIG_SOFTAP_PREFIX, "prefix");
System.set(SYSTEM_CONFIG_SOFTAP_SUFFIX, "suffix");

Hmmm. I donā€™t follow.

I was able to change the SSID using the steps here: Change Photon SSID.

Yes that works, but is less comfortable and a bit more difficult to remember IMHO than using above statements in a normal firmware code.
As said above - these commands are shown in the same thread, just a few posts down from yours

This way you could even have a Particle.function() to do that remotely :wink:
Not that easy via dfu-util

Thanks a million! Makes sense and I am adding it now!

@mebrunet, did you set up a login as well (one legged oauth, for example)?

Or simply adding the photons as a product is sufficient provisioning to start? This is my first ever product and I am looking for a simple solution to use in a private beta that I can build myself. Once I have the enough resources I will make a more secure solution.

@G65434_2 & @ScruffR I welcome your insight as well :smile:

Hello! :grinning:

I hope this is the correct thread. I just have a simple question.

I recently added the SoftAP example by @mebrunet I found in Particle Reference Docs. And I love it :yum: it works great.

But I noticed when I add #pragma SPARK_NO_PREPROCESSOR I have to re-arrange the functions in the firmware (I can only call functions written above). I can definitely work this out, but I like to keep a certain order.

Is there any way to either, not have to write the #pragma line or adding some code so I can sort the functions how I prefer?

Thanks everybody!

You can add function prototypes/forward declarations.
Thatā€™s one thing the preprocessor would do for you without the pragma.

just write


void someFn();
...
// all your other stuff
...
void someFn() {
  // implementation here
}
1 Like

@Kevin @dancingpearl - Iā€™ve added the ability to set the claim code. Simply navigate to the page with query parameter claim_code. e.g. http://mebrunet.github.io/softap-setup-page/src/?claim_code=1234

2 Likes