Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:17 01 Aug 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 : WEB NTP errors

     Page 1 of 2    
Author Message
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 11:07pm 28 Feb 2023
Copy link to clipboard 
Print this post

Reply to palcal in picomite web lessons thread

  palcal said  Still got the NTP TIMEOUT problem, I tried a pause but that didn't work.


untested but try:
 '
 n = 0
 DO
   DATE$ = "01-04-2000"
   ON ERROR SKIP
   WEB ntp 11
   IF DATE$ = "01-04-2000" THEN PRINT "OOPS!"
   INC n
 LOOP UNTIL DATE$ <>"01-04-2000" OR n > 4


Jim
VK7JH
MMedit
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1993
Posted: 11:28pm 28 Feb 2023
Copy link to clipboard 
Print this post

Thanks Jim that works, do you have any idea why I am getting the line
  Quote  "String is    GET/favicon.ico HTTP"

when I run the program. I did have Peter's program in the Pico previously but it has been reflashed since then.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 01:21am 01 Mar 2023
Copy link to clipboard 
Print this post

  palcal said  
  Quote  "String is    GET/favicon.ico HTTP"

when I run the program. I did have Peter's program in the Pico previously but it has been reflashed since then.

Reflashing doesn't always delete the program in memory.
Try list all to see what is there.

Jim
VK7JH
MMedit
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1993
Posted: 01:37am 01 Mar 2023
Copy link to clipboard 
Print this post

List all only lists the current program from Luc.
Files only shows 'bootcount' and 'first.html'
flash list shows all slots available.
I'm using alpha 19
Edited 2023-03-01 11:39 by palcal
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3378
Posted: 01:40am 01 Mar 2023
Copy link to clipboard 
Print this post

  palcal said  why I am getting the line
  Quote  "String is    GET/favicon.ico HTTP"

Are you entering the picomiteweb's IP address in your browser?

After the program says "String is       GET / HTTP"

you will get the message you showed as the browser retrieves the favicon. If your HTML contains a refresh, you will get it repeatedly. My html calls for a refresh every 120 seconds, and every time the console shows: "String is    GET/favicon.ico HTTP".
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1993
Posted: 01:51am 01 Mar 2023
Copy link to clipboard 
Print this post

Lizby said
  Quote  and every time the console shows: "String is    GET/favicon.ico HTTP".

where is it getting it from it is no longer anywhere in the Pico. And why "favicon.ico' there were other files associated with Peter's code.
Edited 2023-03-01 11:52 by palcal
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 02:58am 01 Mar 2023
Copy link to clipboard 
Print this post

Most web browsers expect the web site to have the file favicon.ico in the root folder of the web site.
This is what gives you the pretty pictures in bookmark list etc.
You don't have to worry about it for now.

There are some PCs that like to be different.
Any MAC will usually ignore the favicon.ico and expect your site to have their equivalent icon file, just because MACs are 'special'

Jim
VK7JH
MMedit
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2640
Posted: 03:42am 01 Mar 2023
Copy link to clipboard 
Print this post

There is a copy of favicon.ico in this zip.

https://www.thebackshed.com/forum/uploads/matherp/2023-02-07_040659_simpleweb.zip

Copy it to A: and SD if one is attached, covering all bases it should find it.
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1993
Posted: 04:48am 01 Mar 2023
Copy link to clipboard 
Print this post

Thanks it sort of makes sense now, I thought Peter had included it in his 'SimpleWeb' for testing purposes. I have the favicon.ico file, I will put it back in A:
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1993
Posted: 09:12pm 02 Mar 2023
Copy link to clipboard 
Print this post

I don't understand this part of the code..
WEB tcp interrupt serverstart
Do
Loop

What triggers the interrupt and why doesn't the program get stuck inside the Do/LOOP
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4044
Posted: 09:28pm 02 Mar 2023
Copy link to clipboard 
Print this post

  palcal said  I don't understand this part of the code..
WEB tcp interrupt serverstart
Do
Loop

What triggers the interrupt and why doesn't the program get stuck inside the Do/LOOP

MMBasic itself does it.

The rest of the program is indeed stuck in the loop. You can add code in the loop if there's anything you want to add.

John
Edited 2023-03-03 07:29 by JohnS
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 09:32pm 02 Mar 2023
Copy link to clipboard 
Print this post

  Quote  WEB tcp interrupt serverstart

This line tells MMBasic to call 'serverstart' sub whenever there is a connection to the pico port.
It is up to the 'serverstart' sub to handle the connection from then on.

The interrupts are usually checked between every line so in the do...loop code, the programs checks to see if the interrupt has bee triggered each time the program goes through the loop.

It is only slow commands (some of the ones that talk to external sensors) that disable the interrupts that cause delays in servicing the 'serverstart' interrupt sub.

Jim
VK7JH
MMedit
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1993
Posted: 09:51pm 02 Mar 2023
Copy link to clipboard 
Print this post

Thanks, I'll understand it all one day, I hope.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
LucV

Regular Member

Joined: 19/02/2023
Location: Netherlands
Posts: 62
Posted: 10:23pm 02 Mar 2023
Copy link to clipboard 
Print this post

Hi Palcal.

Maybe I can simplify it a bit.

I presume you know how an interrupt works. For simplicity let's compare it to your home situation. Imagine you are setting the table for lunch. Then the doorbell rings. That is the interrupt. So you stop what you are doing and go to the door.

Now let's translate that into our program.

The Do-Loop is our program. It is like setting the table. The difference is that our program is actually doing nothing. It is an empty loop. Like you not setting the table but just sitting on the couch doing nothing.

WEB tcp interrupt serverstart


That is part of our total program that starts the interrupt. So this is the part where someone rings the bell. Actually nothing happens all the time till someone rings the bell. Then the interrupt comes to action and switches over to the subroutine with the name serverstart.
In our situation this part compare ringing the bell to the program waiting till you open your web browser, paste in the IP address of the PicoMiteWeb and hit return. That is "ringing the bell". Then the PicoMiteWEb comes into action and starts the serverstart routine which you can compare to you walking to the door and opening it.

When the door is opened and you recdeived a package or whatever you go back to setting the table. So does our program is reusmes what it would be doing in the do-loop.

This means that later on we can add more things in our program like doing calculations or reading sensors etc etc etc and each time someone hits refresh in the browser or someone else on another computer or phone opens his/hers browser and types in the ip-adress the interrupt is activated, sends the web-page to the one requesting it and goes on with what it was doing.

Does this help ???

Luc
Luc's tech Blog
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1993
Posted: 10:40pm 02 Mar 2023
Copy link to clipboard 
Print this post

Thanks Luc, I understand interrupts but could not see how this one was being triggered, it is all clear now and thanks for the good explanation.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9610
Posted: 11:11pm 02 Mar 2023
Copy link to clipboard 
Print this post

Luc, your description is excellent.  You should be a school teacher in understanding code.  Perhaps you are!
Smoke makes things work. When the smoke gets out, it stops!
 
pwillard
Guru

Joined: 07/06/2022
Location: United States
Posts: 313
Posted: 10:55am 03 Mar 2023
Copy link to clipboard 
Print this post

ARGH!!!!

> run
Assigned Address: 192.168.1.224
NTP FAILURE
> run
Assigned Address: 192.168.1.224
NTP FAILURE
> run
Assigned Address: 192.168.1.224
NTP FAILURE
> run
Assigned Address: 192.168.1.224
NTP FAILURE
> run
Assigned Address: 192.168.1.224
NTP FAILURE
> run
Assigned Address: 192.168.1.224
NTP FAILURE
> run
Assigned Address: 192.168.1.224
NTP FAILURE
>
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1993
Posted: 08:43pm 03 Mar 2023
Copy link to clipboard 
Print this post

@pwillard, looks like you havn't added Jim's code to SERVER.01
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
pwillard
Guru

Joined: 07/06/2022
Location: United States
Posts: 313
Posted: 01:03pm 04 Mar 2023
Copy link to clipboard 
Print this post

Oh, that code is in my program... It's what is printing "NTP FAILURE"
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 08:03pm 04 Mar 2023
Copy link to clipboard 
Print this post

  pwillard said  Oh, that code is in my program... It's what is printing "NTP FAILURE"

My code should print OOPS! 5 times if the NTP failed totally.
n = 0
DO
DATE$ = "01-04-2000"
ON ERROR SKIP
WEB ntp 11
IF DATE$ = "01-04-2000" THEN PRINT "OOPS!"
INC n
LOOP UNTIL DATE$ <>"01-04-2000" OR n > 4

I don't see any in your output.

Jim
VK7JH
MMedit
 
     Page 1 of 2    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025