Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 05:21 22 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : WiFi Scanner

     Page 2 of 2    
Author Message
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 140
Posted: 10:26pm 15 Sep 2023
Copy link to clipboard 
Print this post

Hi Fred

WiFiScannerV1_7.zip

You'll need to upload the bas and html on this update.

Improved user control of Monitoring WiFi RSSI, Ping success, either or or both and Polling periods for WiFi and Ping depending on your previous choices, all at launch.

Implemented a processor heartbeat on GP15.Along with the WiFi heartbeat you can get an idea if things are still going or something has fallen over. I've experienced WiFI heartbeat going strong and the program has stalled with no indication on the console.

Don't poll faster than 30s.

Chris - about 3-4 years ago I looked into using something like Chart.js and there was another one I can't remember the name of. The problem is the size of the Javascript that needs to be served, Chart.js is over 150kB as I recall. Yes you can trim off all the fat you're not going to use and minify and uglify it but you still end up with about 50+kB of file to serve. The graphs.js I'm using is only 3852 bytes and does all I want it to do, albeit with fewer bells and whistles and less flexibility. I understand the Javascript file can be served from elsewhere but my preference is for  compact self contained solutions which are not dependent on external resources to function.

But, as Lance indicated, post an example and I will gladly have a look and see if it is an improved approach to mine and can be incorporated.
Edited 2023-09-16 08:44 by carlschneider
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
TheMonkeys

Regular Member

Joined: 15/12/2022
Location: Australia
Posts: 59
Posted: 11:03pm 15 Sep 2023
Copy link to clipboard 
Print this post

150kB????

That's more than all my code/files/images combined.

this is actually a tar.gz file, so if winzip won't open it, try renaming it.
adctest.zip

The following is called when "adc.csv" is requested.

Sub doADC 'ADC' simulator Stable
Local samps=768
' Local sample(samps) As float
Local sample As float
RGBled(serv,4,4,4)
' For i=1 To samps 'ADC' code START
'  sample(i)=round(sample(i-1)+0.5-Rnd,2) ' pseudo-random sample placeholder
' Next i 'ADC' code END
Open "adc.csv" For output As #3 ' save results
Print #3, Timer Mod 30;":";sample;
For i=2 To samps
sample=round(sample+0.5-Rnd,2) ' pseudo-random simple placeholder
' Print #3,",";Str$(Timer Mod 30);":";Str$(sample(i));
Print #3,",";Str$(Timer Mod 30);":";Str$(sample);
Next i
Close #3
End Sub


the format of the data is "sawtooth1:trace1,sawtooth2:trace2,sawtooth3:trace3,"
and so on...

two traces of 768 samples each amount to around 6kb.

Cheers,

Chris
 
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 140
Posted: 03:27am 16 Sep 2023
Copy link to clipboard 
Print this post

Hi Chris

Thank you very much for the sample code and attached zip file.

Some clarity please.

The adc.csv file format appears to be a custom format with the interleaved ':', as my understanding is that csv is comma separated data fields with CR/LF separated records?

Can you point me to the source of the javascript or the reference you used to assemble the javascript embedded in the html. I need a better understanding of how you're doing the parsing of the csv data.

My understanding of what you have presented is;
1. It accepts, on 'Read', a predefined 'csv' file of data points [var a];
2. Traces the data points onto a html 5 compliant canvas;
3. Provides a zoomed out view initially;
4. Provides for a single step zoomed in view, which is scrollable; and
5. Is a static display.

As a mechanism for presenting accumulated data, in a formatted string, in this case csv, it is very interesting and I appreciate you bringing this to my attention. Perhaps I can tweak your adc.html into a viewer of the csv data accumulated by the WiFiscanner. This would add an additional viewing option to the utility and offer an alternative to spreadsheet manipulation to graph the data.

The current graphs.js approach I have used, allows for live updating of a line graph while maintaining the previously plotted points and scrolls left as new data is fetched and plotted. It also has scaling (more like a y axis offset though) and y axis labels, but appears to lack the zooming of your solution.

Have you made any attempt at getting your solution to have automated fetch and retention of data points already received and plotted? This may be of interest to the MiteScope group from a storage oscilloscope emulation perspective.

I look forward to your continued input.
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 1815
Posted: 03:41am 16 Sep 2023
Copy link to clipboard 
Print this post

  Quote  my understanding is that csv is comma separated data fields with CR/LF separated records?

The more general term is Character Separated Values, so can be anything.
 
TheMonkeys

Regular Member

Joined: 15/12/2022
Location: Australia
Posts: 59
Posted: 07:25am 16 Sep 2023
Copy link to clipboard 
Print this post

Hi Carl,

csv files usually are "value,value,value"... but I've cheated to save drive space and reduce transfer times - the WebMite's transfer rate is around 3kb/sec.

Apart from the XMLHttpRequest, all the js was written from scratch by me, although I freely admit that I can't get my head around "graphs.js".

Your understanding of my example is correct. It is based on a daily/weekly (updated every 15 mins) log file that I use to track disk usage, temperature and HTTP requests. The file is appended with fresh data every fifteen minutes and rotated at midnight, and on Sunday, the weekly file is also rotated.

Cheers,

Chris
Edited 2023-09-16 17:26 by TheMonkeys
 
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 140
Posted: 01:00am 17 Sep 2023
Copy link to clipboard 
Print this post

Hi Fred

WiFiScannerV1_7.uf2.zip

This uf2 will wipe the Pico [all flash slots, program memory, drive A:, options, etc] and install the WiFiScannerV1_7 complete with all dependencies, including Options. Follow the usual firmware update root using BOOTSEL button.

However you have to setup the Option WIFI ssid$, password$ with your credentials before you can run the program.

Hope this makes loading it easier than previously.
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 842
Posted: 05:56am 17 Sep 2023
Copy link to clipboard 
Print this post

Carl,
Thank you for sharing this. I did have trouble with my attempt to load your first version but this latest was so much easier and is working well.

Can please confirm that the .BAS code that was loaded in the .uf2 was the V1_7 version of several posts above?
(I want to tinker with it to learn more about how you have done what you have).

Cheers,

Andrew
 
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 140
Posted: 03:18pm 17 Sep 2023
Copy link to clipboard 
Print this post

Hi Andrew

Thank you for the kind words.

Practically, from a program perspective, the .uf2 version is the same as the bas version previously posted.

However from a purist perspective they are not the same. I have added a comment in the .uf2 to reflect the need to configure the option wifi, which isn't present in the bas file further up.

I would suggest you use the save "WiFiScannerV1_7.bas" at the MMBasic > prompt and then possibly do a flash save 1 to copy the program memory into flash slot 1.

You will then have a base that you can come back to if your tweaking breaks something irrepairably.

Is the commenting sufficient?

Above all else have fun :)
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 842
Posted: 09:55pm 17 Sep 2023
Copy link to clipboard 
Print this post

Hi Carl,
Thanks for that.
The other option to retrieve the .BAS is to use MMEdit's MCC.
You:

Action/Start Capture
Action/List All
Action/End Capture and enter the file name

- and the file is saved to your PC.

Blank lines are removed but you have been diligent with comments etc.
Thank you once again (and to TassyJim for MMEdit).

Cheers,

Andrew
 
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 140
Posted: 10:22pm 17 Sep 2023
Copy link to clipboard 
Print this post

Hi Andrew

Here is the bas file with the blank lines intact.

WiFiScannerV1_7.bas.zip

Noted that MMCC is stripping out the blank lines as part of your proposed capture process. I wonder if MMEdit removes the blank lines when you commit the bas to the Webmite?

I only have a Mac at my disposal here so MMEdit has not been an option for me. After almost 2 months with the Webmite I'm now comfortable enough with the Mac and the EDITor of MMBasic.

Enjoy
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 842
Posted: 10:57pm 17 Sep 2023
Copy link to clipboard 
Print this post

Thanks Carl.
Much appreciated.

TassyJim is the one to answer MMEdit questions (he is often lurking here but will answer questions posted say here ).

Cheers,

Andrew
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 03:14am 18 Sep 2023
Copy link to clipboard 
Print this post

  Quote  Noted that MMCC is stripping out the blank lines as part of your proposed capture process.

That was a bug which will be fixed in the next release.

  Quote   I wonder if MMEdit removes the blank lines when you commit the bas to the Webmite?

No, it's OK in that direction unless you set it to remove the blanks.

Jim
VK7JH
MMedit   MMBasic Help
 
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 140
Posted: 03:21am 18 Sep 2023
Copy link to clipboard 
Print this post

Thanks for the clarification Jim
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
carlschneider
Senior Member

Joined: 04/08/2023
Location: South Africa
Posts: 140
Posted: 08:10pm 25 Sep 2023
Copy link to clipboard 
Print this post

WiFiScannerV1_8.bas.zip
 
Improved Web Interrupt Servicing (simplified, removed potential race considitons, changed logic for 404 errors), made sure minimum polling interval can't be less than 20s (if too short then the Tick pre-empted the MakeSelection routine) and rearranged the start up logic (to make the graphrssi.html more responsive on first load; loads -100dB if you're too fast on the button, but at least the graph populates).

Hope this is helpful.
Cheers Carl                                                        
Retirement is tough on Hobbies without a day job
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024