Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:15 13 Jul 2025 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 : Webmite driving me crackers...

     Page 1 of 2    
Author Message
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7871
Posted: 03:52pm 28 Nov 2024
Copy link to clipboard 
Print this post

Latest version of firmware, but this has never worked. It's based on Geoff's simple web server. The server runs, it gets the time etc. I can connect to it via a browser and get Index.html. However, click a button and the fun begins. In Brave the button flips back. Brave also sends /favicon.ico after each click - I tried to trap it but it seems harmless. Edge and Chromium will accept the flip but then, after a delay, they claim that there's been no reply and I have to reload the page - the button has flipped back.

I'm a beginner with the Webmite and I know virtually nothing about TCP etc. so I'm trying to work from first principals.

'basic web server

'get the time
WEB ntp
Pause 1000
Print "Server started at "Time$
Print

Dim buff%(4096/8)

Off$ = "checked='checked'"
Onn$ = ""

WEB TCP INTERRUPT WebInterrupt


Do
'<do your processing here>'
CurrentTemp=26
Loop


' sub to handle all web server requests
Sub WebInterrupt
 Local a%, p%, t%, s$
 For a%=1 To MM.Info(max connections)
   WEB tcp read a%, buff%()

   'LongString print buff%()

   p%=LInStr(buff%(),"GET")
   t%=LInStr(buff%(),"HTTP")

   'Print "GET position  "p%
   'Print "HTTP position "t%

   If (p%<>0) And (t%>p%) Then
     WEB transmit page a%, "/index.html"
     s$ = LGetStr$(buff%(), p%+4, t%-p%-5)

     Print "Command "s$

     Select Case s$
     Case "/"
       WEB transmit page a%,"/index.html"
     'ElseIf s$ = "/page2.html" Then
     '  WEB transmit page a%, "/page2.html"
     'ElseIf s$ = "/pix.html" Then
     '  WEB transmit file a%, "pix.jpg","image/jpeg"
     Case "/?RB=ON"
       'add code to switch on
       off$="": onn$="checked='checked'"
       Pause 100
       WEB transmit page a%, "/index.html"
     Case "/?RB=OFF"
       'add code to switch off
       off$="checked='checked'":onn$=""
       Pause 100
       WEB transmit page a%, "/index.html"
     Case "/favicon.ico"
       WEB transmit page a%, "/index.html"
       Pause 100
     Case Else
       WEB transmit code a%, 404
       Pause 100
     End Select
   EndIf
 Next a%
End Sub      

Mick

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

Joined: 18/11/2011
Location: United Kingdom
Posts: 4038
Posted: 04:51pm 28 Nov 2024
Copy link to clipboard 
Print this post

You probably need to include the files involved.  Especially any non-image ones (images as well if smallish).

John
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7871
Posted: 04:58pm 28 Nov 2024
Copy link to clipboard 
Print this post

There's only this. References to page2.html and pix.html are commented out

> list "index.html
<html>

<head>
<title>WebMite</title>
</head>

<body>
<h1>Aquarium Control</h1>
<h2>{date$}  {time$}</h2>
<p>The tank temperature is {ttemp}C
<br>
The current lighting preset is number {colr}
</p>
<br>
<br>
<br>
<form method='get'>
 Coloiured Lighting
 <input name='RB' type='radio' value='OFF' {off$} onClick='this.form.submit()'> Off
 <input name='RB' type='radio' value='ON'  {onn$} onClick='this.form.submit()'> On
</form>
</body>

</html>
Mick

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

Joined: 07/11/2023
Location: United Kingdom
Posts: 1361
Posted: 05:23pm 28 Nov 2024
Copy link to clipboard 
Print this post

Following with interest. I was in the same boat and just gave up.

Got my Pico 2-W but not powered it up yet.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4038
Posted: 05:25pm 28 Nov 2024
Copy link to clipboard 
Print this post

Somewhat random thoughts:

Stray /html at end

No variables ttemp or colr

Typo Coloiured

Sorry, they won't fix it the way you want :(

John
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4038
Posted: 05:27pm 28 Nov 2024
Copy link to clipboard 
Print this post

I don't have a webmite so... what gets printed for s$ as each radio button is clicked?

John
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4038
Posted: 05:29pm 28 Nov 2024
Copy link to clipboard 
Print this post

D'oh - ignore sorry

And I was wrong about the stray /html :(

John
Edited 2024-11-29 03:32 by JohnS
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4038
Posted: 05:34pm 28 Nov 2024
Copy link to clipboard 
Print this post

Could you just use

onn$="checked"

(etc)

rather than the longer stuff you have now?

John
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7871
Posted: 06:01pm 28 Nov 2024
Copy link to clipboard 
Print this post

I don't know. I was following the instructions in the manual. Like I said, I'm a complete newbie at this. :)

The radio buttons change over, but then either flip back or flip back after the browser has thrown its dummy out of the pram.

I also get an error on the console from the Chromium browser (just before it bombs out - IIRC Edge does the same but more violently!):
Warning: No response to request from connection no. 2
Warning: LWIP send data timeout
Mick

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

Regular Member

Joined: 13/11/2016
Location: Australia
Posts: 43
Posted: 01:07am 03 Dec 2024
Copy link to clipboard 
Print this post

Well mixtel90, ditto here. Now I'm going to give my experience directly as buying Webmite & just 5.08 rev 3 manual and .uf V5.08 offer.

With both that manual typos and poor example of using TCP serving it all failed on my project of which I kindly informed Geoff hoping for help. I was especially miffed that demo reading temp in SC magazine did also not present function to me.

Anyway, I gave up and created my own TCP server although in infancy, actually works with stability.

The problem is now exasperated further (new manual, multiple Webmites good) as Geoff example is too simplified not meeting the requirements of the very commands he presents nor making them useable, testable etc, nor teaching anyone new they even work, generates frustration dismay and disappointment.

TPC must be seperatly properly explained  in factual use given HTML is infinatly served on way more details than just Get & Put Geoff introduces it as, as if he doesn't know himself, this he seems oblivouis to.

Anyway, that is my reply.
Take care. Supertech.
 
Supertech

Regular Member

Joined: 13/11/2016
Location: Australia
Posts: 43
Posted: 01:09am 03 Dec 2024
Copy link to clipboard 
Print this post

Try TCP...
 
Supertech

Regular Member

Joined: 13/11/2016
Location: Australia
Posts: 43
Posted: 01:38am 03 Dec 2024
Copy link to clipboard 
Print this post

Oh, in fact it was me who highlighted the radio button viables in previous V5.08 R3 manual were published wrong actually matching a mmbasic known command, thus crashing TCP serving inttrupted procedure as soon as the RB on HTML was live served! Just crashed time over, but why? Geoff manual why.

So example was published at fault, impossible to even demo. This I finally saw as killing the demo Geoff published for the masses, making Webmite seem a failure, espically to those new.

Why I put my topic with Geoff permission of all R3 V5.08 manual faults for ALL to see, ONLY Geoff responded to? And these were found by ME only in 1. Trying to use in my now 1081 line project serving HTML5 (learnt & written on my own) stable 2. Collecting Manual bugs on a spreadsheet as I wrote in Tassy Jim awsome editor!!!!!

The member who just listed faults he has found is AWSOME WORK! And along with him, I AM NOT PAID in any $ OR Time either!! For those nasty comments back at me!

The only thing I find is some pepole rubuke me for this toward future support of Webmite? Um....I ignore idiots. And newbe? Peoples, you have no idea.
 
grumpyoldgeek
Newbie

Joined: 30/07/2018
Location: United States
Posts: 36
Posted: 02:06am 03 Dec 2024
Copy link to clipboard 
Print this post

Making the popcorn...
 
Malibu
Senior Member

Joined: 07/07/2018
Location: Australia
Posts: 260
Posted: 05:42am 03 Dec 2024
Copy link to clipboard 
Print this post

I'm not real good at reading other peoples code style, so I may be misunderstanding...
What are these lines:

off$="": onn$="checked='checked'"
off$="checked='checked'":onn$=""

Wouldn't it just be

off$="": onn$="checked"
off$="checked": onn$=""


Here's what I have in my code for WebMite

case "TimerType"
 timertype(ChNum) = Value
 select case Value
   case "Period"
     Period(ChNum) = "checked"
     Cyclic(ChNum) = ""
     Special(ChNum) = ""
   case "Cyclic"
     Period(ChNum) = ""
     Cyclic(ChNum) = "checked"
     Special(ChNum) = ""
   case "Special"
     Period(ChNum) = ""
     Cyclic(ChNum) = ""
     Special(ChNum) = "checked"
 end select

Seems to work well for me... Either set it as "" or "checked"

Edit: Hmmm... JohnS already pointed out the same thing, sorry...
Edited 2024-12-03 15:44 by Malibu
John
 
Malibu
Senior Member

Joined: 07/07/2018
Location: Australia
Posts: 260
Posted: 06:03am 03 Dec 2024
Copy link to clipboard 
Print this post

A couple of other things too
  Quote  Warning: No response to request from connection no. 2
Warning: LWIP send data timeout

are not as frequent as they used to be, but they are still present. On my WebMite, I'm using it as a 6-channel, 24 hour, multifunction timer. As such, I let it run for days to check the timing operations.
MMbasic runs and the WebMite behaves itself, BUT maybe, 25% of the time when I click something in the browser, it will generate those faults.
I can't confirm, but it's as though the WiFi gets into sleep mode after some sort of timeout period. (Just my wild theory ATM, but that's what it appears to me)

Re: Favicon
I added this to my code in the Web Int (Opera does the same thing)
elseif linstr(ConnData(), "favicon") > 0 then
  web transmit file ConnNum, "/favicon.jpg", "image/jpeg"

and just add a small jpeg to your files to use as a favicon (I thing they are usually about 48x48 in size)
John
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7871
Posted: 08:08am 03 Dec 2024
Copy link to clipboard 
Print this post

I think it may be something that is over-simplified in the demo code in some way. If I ran the very minimal example it seemed top be ok IIRC, the problems only arising when it is asked to accept connections from a browser that command things. I've not tested it but I believe that Geoff's code for the watering system is stable and runs ok, this is why I think the problem is over-simplification. I tried to get my head round the watering system code but it's way beyond me at my current stage.

Supertech: Thanks for your comments, but nothing prior to version 6.00 is relevant now. There's little point in looking at or using the prior versions as even the hardware is changing now (Pico 2) so there are all sorts of differences. I'm only using the demo code from an old manual because that's what I have. :)

I have some experience in hand coding HTML, so those files I'm happy with.

Just as a matter of interest, and it may not be relevant, I've been having a bit of a play with Annex RDS on a ESP32-C3 Super mini. The RDS has a log window open constantly and it is showing short wireless dropouts periodically. It reconnects immediately, but it's making me wonder if it could be a wireless stability issue that doesn't get trapped in the simple code.
Mick

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

Joined: 11/12/2012
Location: United Kingdom
Posts: 10246
Posted: 08:11am 03 Dec 2024
Copy link to clipboard 
Print this post

Supertech

Can I suggest you check the contents of the 6.00.01 draft manual against the 6.00.01RC4 firmware and post on the manual thread any errors/improvements. That way they will be corrected going forward.
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3360
Posted: 02:02pm 03 Dec 2024
Copy link to clipboard 
Print this post

  Mixtel90 said  The RDS has a log window open constantly and it is showing short wireless dropouts periodically. It reconnects immediately, but it's making me wonder if it could be a wireless stability issue that doesn't get trapped in the simple code.


Francesco has said that this occurs because Chrome-based browsers (at least) "sleep" inactive windows to save resources.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Supertech

Regular Member

Joined: 13/11/2016
Location: Australia
Posts: 43
Posted: 09:36am 07 Dec 2024
Copy link to clipboard 
Print this post

  Quote  Supertech

Can I suggest you check the contents of the 6.00.01 draft manual against the 6.00.01RC4 firmware and post on the manual thread any errors/improvements. That way they will be corrected going forward.


Thank you matherp, excellent comment. See if I can. I was going to test ALL this new wonderful work you, Geoff been adressing behind scenes. Please support Tassy Jim, without his editor which is awsome, it must be updated too!

I notice Geoff has links in new manual re "mmbasic" seemingly addressing diffrent hardware feature compatibility finnally addressing running in windows mmbasic.exe published by you two guys?
Really I thought this would be a link traslation to your 6.01 releases, but please forgive me if it ant that simple.
Thank you all. Supertech.
 
Supertech

Regular Member

Joined: 13/11/2016
Location: Australia
Posts: 43
Posted: 09:46am 07 Dec 2024
Copy link to clipboard 
Print this post

I need to clarify re Tassy Jim Editor comment to wording "update" him.
I mean specific give him or us programmers DOS selection referal .exe files from V5.08 onward when available, that can be set refered in his mmedit 5.2.9

I put unintended pressure on him that really should have been adressed to Geoff, but sadly, i didnt know that at the time while sorting issue. He deserves better.
All take care. Supertech.
 
     Page 1 of 2    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025