Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 12:57 29 Nov 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 : PicoMiteWEB V5.07.07a24+ - Now with TFTP

     Page 1 of 5    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9139
Posted: 06:39pm 12 Mar 2023
Copy link to clipboard 
Print this post

V5.07.07a24


PicoMiteWebV5.07.07a24.zip

Note the times taken and the file size
See here for how to enable TFTP on windows (tested on W11). Linux users: you are on your own

The TFTP server is automatically enabled if you are connected to wifi and makes transferring files easy and fast. NB: The protocol TFTP does not support directory listing etc. so don't ask. It is also completely insecure so only use on your local network.



  Quote   tftp

Transfers files to and from a remote computer running the TFTP service.

TFTP [-i] host [GET | PUT] source [destination]

 -i              Specifies binary image transfer mode (also called
                 octet). In binary image mode the file is moved
                 literally, byte by byte. Use this mode when
                 transferring binary files.
 host            Specifies the local or remote host.
 GET             Transfers the file destination on the remote host to
                 the file source on the local host.
 PUT             Transfers the file source on the local host to
                 the file destination on the remote host.
 source          Specifies the file to transfer.
 destination     Specifies where to transfer the file.

 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3152
Posted: 07:18pm 12 Mar 2023
Copy link to clipboard 
Print this post

Super. Goodbye, XMODEM.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 722
Posted: 09:17pm 12 Mar 2023
Copy link to clipboard 
Print this post

Wow, that makes Tbi gs much easier and faster!
Very helpfull Feature.
Thank you Peter.!
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 722
Posted: 09:17pm 12 Mar 2023
Copy link to clipboard 
Print this post

Wow, that makes Tbi gs much easier and faster!
Very helpfull Feature.
Thank you Peter.!
 
Michal
Senior Member

Joined: 02/02/2022
Location: Poland
Posts: 123
Posted: 09:24pm 12 Mar 2023
Copy link to clipboard 
Print this post

It's fast over tftp.
Thanks

Michal
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1101
Posted: 10:21pm 12 Mar 2023
Copy link to clipboard 
Print this post

Info for Linux users on tftp here

  Tongue in cheek -      some command line needed but then again, isn't PowerShell just another terminal!

My Pico-W modules arrive this week - can't wait to experiment - thanks Peter for another great contribution,

Doug.
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
Hans

Senior Member

Joined: 18/10/2022
Location: Canada
Posts: 116
Posted: 01:38am 13 Mar 2023
Copy link to clipboard 
Print this post

  matherp said  V5.07.07a24


PicoMiteWebV5.07.07a24.zip

Linux users: you are on your own





Hi All;

Watch for a topic called "TFTP Pi to PICO". I'm in the process of creating a document and it is so simple you beginners will be able to do it too.

Happy TFTPing,

Hans ...
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6102
Posted: 06:40am 13 Mar 2023
Copy link to clipboard 
Print this post

Works from Linux after installing tftp package
Works from Windows 11 after enabling tftp client in apps and features.

I like the way it can run and transfer files while still having the web server active.

Well done.

Jim
VK7JH
MMedit   MMBasic Help
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3152
Posted: 01:28pm 13 Mar 2023
Copy link to clipboard 
Print this post

  TassyJim said  Works from Windows 11 after enabling tftp client in apps and featuresJim


Thanks for that. I struggled with the installation of the SolarWinds TFTP server. It ran through most of the steps, then said the installation had failed. I ran it again, and it asked if I wanted to Repair or Remove. I chose Repair, but TFTP from the PowerShell didn't work. I uninstalled and repeated: again failed, again repaired.

Now with Jim's suggestion, after searching for Windows Features, I went here:



Clicked TFTP Client and OK, and now it works. Great improvement in speed of transfer and ease of use.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9139
Posted: 02:04pm 13 Mar 2023
Copy link to clipboard 
Print this post

Just to be clear to anyone else.

You need to install a TFTP client and not a server to use the new functionality. The link I provided explains both and I should have made it clear that only the client is needed and in windows that is just a matter of enabling it.
 
Michal
Senior Member

Joined: 02/02/2022
Location: Poland
Posts: 123
Posted: 03:19pm 13 Mar 2023
Copy link to clipboard 
Print this post

Here is a neat client and server for Win32 and Win64:
http://philippe.jounin.pagesperso-orange.fr/tftpd32_download.html

Michal
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 359
Posted: 07:26pm 13 Mar 2023
Copy link to clipboard 
Print this post

TFTP is really very fast for transfer to PicoMiteWEB's flash memory
-it seems not to like filenames with spaces.
-I thought that it would load to Pico's program memory directly (and start), but loading to the flash is of course much more useful!

Thanks again Peter for the new tool!  

With earlier versions my Pico got "****PANIC****" after a few (5...15) updates from openweathermap. Haven't run V5.07.07a24 long enough yet to see any possible problems.
What is generally causing the ****PANIC****? Any risk of destroying the Pico? Is just telling me that it is overloaded?

/Pluto
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 359
Posted: 08:06pm 13 Mar 2023
Copy link to clipboard 
Print this post

*** PANIC *** again with V5.07.07a24 after reading 15 times from openweathermap. MMCC output:
Weather for Porvoo
Temperature is         -1.08
Pressure is    990
light snow
Connected
Weather for Kaskinen

Temperature is         -1.77
Pressure is    978
light snow
Connected

*** PANIC ***

Out of Heap memory

Error: Invalid address - resetting
Port: COM6 removed

Disconnected
Port: COM6 inserted

Connected to COM6 at 115200
PicoMiteWeb MMBasic Version 5.07.07a24
Copyright 2011-2023 Geoff Graham
Copyright 2016-2023 Peter Mather

Connecting to WiFi...
Connected 192.168.8.189
Starting server at 192.168.8.189 on port 80


...and "light snow" has now turned into heavy snow. Time to use the shovel again. The piles are getting quite high and I can soon take a big step up on the roof.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9139
Posted: 10:22pm 13 Mar 2023
Copy link to clipboard 
Print this post

Your program would be useful - are you closing the connection?
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2141
Posted: 12:53am 14 Mar 2023
Copy link to clipboard 
Print this post

  Pluto said  -it seems not to like filenames with spaces.

It works if you enclose them in quotes

E:\>tftp 192.168.1.100 get "PicoWeb Test 1.bas"

Edit
The length may be an issue.
This transfers:-

E:\PicoMiteWeb>tftp -i 192.168.1.100 get "Compr img test.bas"
Transfer successful: 1205 bytes in 1 second(s), 1205 bytes/s

But this won't - same file different name:-

E:\PicoMiteWeb>tftp 192.168.1.100 get "Compressed image test.bas"
Connect request failed

You can however send if the target name is shorter.

E:\PicoMiteWeb>tftp 192.168.1.100 put "Compressed image test 2.bas" "cmp2.bas"
Transfer successful: 1205 bytes in 1 second(s), 1205 bytes/s
Edited 2023-03-14 12:59 by phil99
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9139
Posted: 07:59am 14 Mar 2023
Copy link to clipboard 
Print this post

maximum name length for tftp is 20 chars - don't know why
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 359
Posted: 08:20am 14 Mar 2023
Copy link to clipboard 
Print this post

Peter, here is the program and the options in use.
'openweathermap
CLS
Dim buff%(512)
Dim APIKEY$="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"


WEB ntp 2

Dim report$="weather?q=Porvoo,FI"
Dim b$= "GET /data/2.5/"+report$+"&APPID="+APIKEY$+Chr$(10)+Chr$(13)
SETTICK 1000*60,Klocka
Klocka
DO
update=0
report$="weather?q=Porvoo,FI"
b$= "GET /data/2.5/"+report$+"&APPID="+APIKEY$+Chr$(10)+Chr$(13)
WEB open tcp client "api.openweathermap.org",80
WEB TCP CLIENT REQUEST b$,buff%(),10000
WEB close tcp client
Print "Weather for " + Json$(buff%(),"name")
Print "Temperature is ",Val(Json$(buff%(),"main.temp"))-273
Print "Pressure is ",Json$(buff%(),"main.pressure")
Print Json$(buff%(),"weather[0].description")
TEXT 0,10,"Hemma:",,,2,rgb(blue),rgb(White)
text 0,40,"Temperatur:"+str$(Val(Json$(buff%(),"main.temp"))-273)+"'C",,,1

TEXT 0,60,"Lufttryck: "+Json$(buff%(),"main.pressure")+"mBar"
text 0,80,Json$(buff%(),"weather[0].description")
WindDir
TEXT 0,100,"Vind: "+Json$(buff%(),"wind.speed")+" m/s "+riktning$
TEXT 0,120,"Regn: "+Json$(buff%(),"rain.1h")+" mm/h"
Update=1
pause 60000*2
Update=0
report$="weather?q=Kaskinen,FI"
b$= "GET /data/2.5/"+report$+"&APPID="+APIKEY$+Chr$(10)+Chr$(13)
WEB open tcp client "api.openweathermap.org",80
WEB TCP CLIENT REQUEST b$,buff%(),10000
WEB close tcp client
Print "Weather for " + Json$(buff%(),"name")
Print "Temperature is ",Val(Json$(buff%(),"main.temp"))-273
Print "Pressure is ",Json$(buff%(),"main.pressure")
Print Json$(buff%(),"weather[0].description")
TEXT 160,10,"Holmin:",,,2,rgb(blue),rgb(White)
text 160,40,"Temperatur:"+str$(Val(Json$(buff%(),"main.temp"))-273)+"'C"
TEXT 160,60,"Lufttryck: "+Json$(buff%(),"main.pressure")+"mBar"
text 160,80,Json$(buff%(),"weather[0].description")
WindDir
TEXT 160,100,"Vind: "+Json$(buff%(),"wind.speed")+" m/s "+riktning$
TEXT 160,120,"Regn: "+Json$(buff%(),"rain.1h")+" mm/h"
Update=1
'Klocka

pause 60000*2
loop
end

SUB WindDir
grad=val(+Json$(buff%(),"wind.deg"))
riktning$=""
if grad>337.5 or grad<=22.5 then riktning$="Nord"
if grad>22.5 and grad<=67.5 then riktning$="N-O"
if grad>67.5 and grad<=112.5 then riktning$="Ost"
if grad>112.5 and grad<=157.5 then riktning$="S-O"
if grad>157.5 and grad<=202.5 then riktning$="Syd"
if grad>202.5 and grad<=247.5 then riktning$="S-V"
if grad>247.5 and grad<=292.5 then riktning$="V"
if grad>292.5 and grad<=337.5 then riktning$="N-V"
end sub

sub Klocka
If Update then
Tid$=left$(time$,5)
text mm.hres/2,mm.vres*7/8,Tid$,CM,,3,rgb(blue),rgb(white)
end if
end sub


option list
PicoMite MMBasic Version 5.07.07a24
OPTION SYSTEM SPI GP18,GP19,GP16
OPTION CPUSPEED (KHz) 252000
OPTION LCDPANEL ILI9341, LANDSCAPE,GP17,GP14,GP13
OPTION WIFI ZZZZZZZZZ, ***********
OPTION TCP SERVER PORT 80
OPTION TOUCH GP12,GP11
GUI CALIBRATE 0, 3921, 3913, -894, -632
>  


/Pluto
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9139
Posted: 08:36am 14 Mar 2023
Copy link to clipboard 
Print this post

I don't like the SETTICK which is asynchronous to complex web and json activity - both very stack intensive. Please try it a different way and then let me know.
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 359
Posted: 09:18am 14 Mar 2023
Copy link to clipboard 
Print this post

Removed the SETTICK and all calls to SUB Klocka (for displaying time). It run for 8 updates of the first location and got panic at the 8th update of the second position.

Will now strip it to only read data for one location.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6102
Posted: 09:26am 14 Mar 2023
Copy link to clipboard 
Print this post

Pluto,
Try this version.
The settick sets a flag and alternates between the two locations. My system is up to 14 reads so far. I don't have a display so all output is to PRINT.

 'openweathermap
 ' CLS
 DIM buff%(512)
 DIM APIKEY$="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
 
 
 WEB ntp 2
 
 DIM report$="weather?q=Porvoo,FI"
 DIM b$= "GET /data/2.5/"+report$+"&APPID="+APIKEY$+CHR$(10)+CHR$(13)
 SETTICK 1000*120,Klocka
 Klocka
 DO
   IF update THEN getfirst
   IF update2 THEN getsecond
   
 LOOP
 
SUB getfirst
 update = 0
 report$="weather?q=Porvoo,FI"
 b$= "GET /data/2.5/"+report$+"&APPID="+APIKEY$+CHR$(10)+CHR$(13)
 WEB OPEN tcp client "api.openweathermap.org",80
 WEB TCP CLIENT REQUEST b$,buff%(),10000
 WEB CLOSE tcp client
 PRINT "Weather for " + Json$(buff%(),"name")
 PRINT "Temperature is ",VAL(Json$(buff%(),"main.temp"))-273
 PRINT "Pressure is ",Json$(buff%(),"main.pressure")
 PRINT Json$(buff%(),"weather[0].description")
 PRINT "Hemma:" ',,,2,rgb(blue),rgb(White)
 PRINT "Temperatur:"+STR$(VAL(Json$(buff%(),"main.temp"))-273)+"'C" ',,,1
 
 PRINT"Lufttryck: "+Json$(buff%(),"main.pressure")+"mBar"
 PRINT Json$(buff%(),"weather[0].description")
 WindDir
 PRINT "Vind: "+Json$(buff%(),"wind.speed")+" m/s "+riktning$
 PRINT "Regn: "+Json$(buff%(),"rain.1h")+" mm/h"
 
END SUB
 
SUB getsecond
 update2 = 0
 report$="weather?q=Kaskinen,FI"
 b$= "GET /data/2.5/"+report$+"&APPID="+APIKEY$+CHR$(10)+CHR$(13)
 WEB OPEN tcp client "api.openweathermap.org",80
 WEB TCP CLIENT REQUEST b$,buff%(),10000
 WEB CLOSE tcp client
 PRINT "Weather for " + Json$(buff%(),"name")
 PRINT "Temperature is ",VAL(Json$(buff%(),"main.temp"))-273
 PRINT "Pressure is ",Json$(buff%(),"main.pressure")
 PRINT Json$(buff%(),"weather[0].description")
 PRINT "Holmin:" ',,,2,rgb(blue),rgb(White)
 PRINT "Temperatur:"+STR$(VAL(Json$(buff%(),"main.temp"))-273)+"'C"
 PRINT "Lufttryck: "+Json$(buff%(),"main.pressure")+"mBar"
 PRINT Json$(buff%(),"weather[0].description")
 WindDir
 PRINT "Vind: "+Json$(buff%(),"wind.speed")+" m/s "+riktning$
 PRINT "Regn: "+Json$(buff%(),"rain.1h")+" mm/h"
END SUB
 
SUB WindDir
 grad=VAL(+Json$(buff%(),"wind.deg"))
 riktning$=""
 IF grad>337.5 OR grad<=22.5 THEN riktning$="Nord"
 IF grad>22.5 AND grad<=67.5 THEN riktning$="N-O"
 IF grad>67.5 AND grad<=112.5 THEN riktning$="Ost"
 IF grad>112.5 AND grad<=157.5 THEN riktning$="S-O"
 IF grad>157.5 AND grad<=202.5 THEN riktning$="Syd"
 IF grad>202.5 AND grad<=247.5 THEN riktning$="S-V"
 IF grad>247.5 AND grad<=292.5 THEN riktning$="V"
 IF grad>292.5 AND grad<=337.5 THEN riktning$="N-V"
END SUB
 
SUB Klocka
 STATIC choice
 choice = 1 - choice
 IF choice THEN
   update = 1
 ELSE
   update2 = 1
 ENDIF
 
END SUB



VK7JH
MMedit   MMBasic Help
 
     Page 1 of 5    
Print this page
© JAQ Software 2024