Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 02:32 28 Apr 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 : Is the Webmite server example in the manual right?

Author Message
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5727
Posted: 08:49am 13 Mar 2024
Copy link to clipboard 
Print this post

I've set up the first example (p26) in the manual and it works fine. I've then extended it using the additional lines on p27 for additional pages (but not actually used them).

Then I extended it again for radio buttons as described on p29 and incorporated the necessary lines into index.html. The buttons work, but there is a problem with the response to the request from the browser. Usually I get the correct response (with OFF or ON in the header) but the buttons haven't updated or it's very slow or both. Sometimes the request times out and I have to attempt to reload the page.

I have previously tried the "Complete General Purpose Server" on P28 but I never got that to work satisfactorily either.

Have there been changes to MMBasic that haven't been incorporated into the examples? I seem to remember Peter saying something about having to close TCP connections after each use but that doesn't appear (to me) to be happening. This stuff is foreign to me and I'm having to try to pick it up as I go along. I'm happy enough in html, but not the server stuff.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 09:22am 13 Mar 2024
Copy link to clipboard 
Print this post

The examples do work (I fully tested them all) and I doubt that Peter has done anything to break them.

Your problem with the slow speed and erratic radio buttons is strange and sounds like a browser issue.  Normally the response is amazingly snappy.  Most of my testing was with Chrome although I also used the latest version of Edge.  I have heard of people having difficulty with Safari.

The "Complete General Purpose Server" needs a lot of customising and that may be your issue there.  

A good debugging technique is to put the line LONGSTRING PRINT b() just after the WEB TCP READ line.  
For Example:
SUB WebInterrupt
 LOCAL a%, p%, t%, s$
 FOR a% = 1 To MM.INFO(MAX CONNECTIONS)
   WEB TCP READ a%, buff%()
   LONGSTRING PRINT buff%()
   ...


This will show exactly what the browser is sending and can be very educational.

Finally, if you want to reassure yorself that a web server actually works you could load the code for the Garden Watering Controller and see how that works (no special hardware is required).  The code is probably too complex for your needs but it will demonstrate what can be done and will test your environment and browser at the same time.

Geoff
Geoff Graham - http://geoffg.net
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5727
Posted: 09:31am 13 Mar 2024
Copy link to clipboard 
Print this post

Thanks, Geoff. I'll start with a different browser as that's easy. :)

The initial index.html loads very fast, as expected. I can insert values into the page with no problem too. It's just when I want to control things. I downloaded the garden watering controller code but at the moment it's a bit advanced for me. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5727
Posted: 11:18am 13 Mar 2024
Copy link to clipboard 
Print this post

I've now tested with un-Googled Chromium, Brave and Edge. Results are the same. The error message says no response from that IP address. Sometimes it gets it after 5 or ten seconds and the page loads, but not always with the radio buttons correct.

The message sent from the browser to the Pico seems to be correct.

--------------

I'll take the Webmite out later and try it with the garden watering program. I don't think it would be wise to leave its IO connected to the aquarium. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Hans

Regular Member

Joined: 18/10/2022
Location: Canada
Posts: 98
Posted: 08:19pm 13 Mar 2024
Copy link to clipboard 
Print this post

@Mick

What version of MMBasic are you using?

Hans ...
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5905
Posted: 08:27pm 13 Mar 2024
Copy link to clipboard 
Print this post

It can be slow to serve pages which include big images.
For a start, keep any such images small.
Pages which have a lot of elements can cause the browser to fetch more pages than the pico can handle. So not too many images etc on a page.

If you want to bundle all the html and support files with the basic program, I have a WEBmite free to test things with.

No aquarium but we are planning on having fish for dinner tonight...

Jim
VK7JH
MMedit   MMBasic Help
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5727
Posted: 09:18pm 13 Mar 2024
Copy link to clipboard 
Print this post

The Webmite firmware is version 5.08.00 as I didn't want to go "cutting edge". This application doesn't need it. It also happens to be the same version as the manual that I have. :)

There are no images, only a few lines of text and the radio buttons.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Print this page


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

© JAQ Software 2024