Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 01:39 28 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 : Webmite V5.07.08 betas : UDP and other stuff

     Page 2 of 5    
Author Message
andreas

Senior Member

Joined: 07/12/2020
Location: Germany
Posts: 207
Posted: 01:34pm 30 May 2023
Copy link to clipboard 
Print this post

  Volhout said  Hi Andreas,

What is OPTION LIBRARY_FLASH_SIZE 14000 ????
This is not listed in the user manual...
I thought the library was fixed size (1 flash slot)

Volhout


hi Volhout,

this option was not created by will but seems to occur as soon as you start using the library after a "library save"

-andreas
 
JanVolk
Senior Member

Joined: 28/01/2023
Location: Netherlands
Posts: 145
Posted: 06:46pm 30 May 2023
Copy link to clipboard 
Print this post

What am I doing wrong?

I'm trying to load a .html file with WebMite Version 5.07.08b1 and get a
Error : Not enough memory.
This works with .bas, .ico, .jpg files with load and save.

Jan
 
JanVolk
Senior Member

Joined: 28/01/2023
Location: Netherlands
Posts: 145
Posted: 07:03pm 30 May 2023
Copy link to clipboard 
Print this post

> files
A:/
  <DIR>  .
  <DIR>  ..
20:39 30-05-2023          4  bootcount
20:32 30-05-2023        267  favicon.ico
20:29 30-05-2023       1353  simpleweb.bas
20:31 30-05-2023       2833  small.jpg
23:35 22-03-2023        896  test4.html
20:22 30-05-2023        528  web_ntp_zomer_winter.bas
20:26 30-05-2023       1010  web_tcp.bas
20:27 30-05-2023        221  web_udp.bas
2 directories, 8 files, 585728 bytes free
> option list
WebMite MMBasic Version 5.07.08b1
OPTION SYSTEM SPI GP10,GP11,GP12
OPTION SYSTEM I2C GP4,GP5
OPTION COLOURCODE ON
OPTION DISPLAY 40, 90
OPTION SDCARD GP15
OPTION RTC AUTO ENABLE
> new
> load "test4.html"
Error : Not enough memory
>

Jan
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4247
Posted: 07:17pm 30 May 2023
Copy link to clipboard 
Print this post

Hi Jan,

Works for me. Did you edit this file before ?
Is this a file that you copied onto the a:/ drive from another system ?
I can only think the file is corrupt in some way.
Try if you can transfer it to a PC (MMCC file transfer) and check file size.
You can also try CPU RESTART and try again with the build in editor.

Volhout
PicomiteVGA PETSCII ROBOTS
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4247
Posted: 07:19pm 30 May 2023
Copy link to clipboard 
Print this post

  Andrew_G said  Hi all,
This thread doctored Captain's code for the Southern Hemisphere for non-WebMites.
Geoff's code using Openweather now works for me and is far simpler.

Cheers,

Andrew



This is a working version for Europe. Yes, using the weather app is easier. But I wanted to try myself. Finally see use of the EPOCH() function in MMBasic. Never to old to learn....


' IsDst() uses global date$ and time$ to determine if today is daylight savings.
' The algorithm uses the european transition at last sunday in March and October at 02:00 am
' Volhout

Print IsDst()

End

Function IsDst()
 'uses time$ and date$
 Local m,o,md,od,d,y,dd$

 'this is today, this hour
 d=Epoch(Date$+" "+Time$)

 y=Val(Right$(Date$,4))

 'start of dst on last sunday in March in current year at 02:00
 md=31-dow%(y,3,31) 'March has 31 days
 dd$=Str$(md,2,0)+"-03-"+Str$(y)
 m=Epoch(dd$+" 02:00:00")

 'end of dst on last sunday in October in current year at 02:00
 od=31-dow%(y,10,31) 'October has 31 days
 dd$=Str$(od,2,0)+"-10-"+Str$(y)
 o=Epoch(dd$+" 02:00:00")

 IsDst = (m<d) And (o>d)
End Function


Function dow%(y,m,d)       'day of week
 'returns day of the week (0 sunday .. 6 saturday)
 Local t%(11)=(0,3,2,5,0,3,5,1,4,6,2,4)
 If m<3 Then y=y-1
 dow%=(y+y\4-y\100+y\400+t%(m-1)+d) Mod 7
End Function

Edited 2023-05-31 05:22 by Volhout
PicomiteVGA PETSCII ROBOTS
 
andreas

Senior Member

Joined: 07/12/2020
Location: Germany
Posts: 207
Posted: 06:30am 31 May 2023
Copy link to clipboard 
Print this post

LIBRARY_FLASH_SIZE  14000 findings


> library delete
> option list
WebMite MMBasic Version 5.07.07
OPTION AUTORUN 3
OPTION COLOURCODE ON
OPTION DISPLAY 50, 100
OPTION WIFI FritzBox, *********************
OPTION TELNET CONSOLE ON
> library save
Library Saved 184 bytes
> option list
WebMite MMBasic Version 5.07.07
OPTION AUTORUN 3
OPTION LIBRARY_FLASH_SIZE  14000
OPTION COLOURCODE ON
OPTION DISPLAY 50, 100
OPTION WIFI FritzBox, *********************
OPTION TELNET CONSOLE ON

-andreas
 
aFox
Regular Member

Joined: 28/02/2023
Location: Germany
Posts: 76
Posted: 02:08pm 31 May 2023
Copy link to clipboard 
Print this post

  matherp said  V5.07.08b0



The second functional enhancement implements a simple way of communicating over UDP

The new commands are:

OPTION UDP SERVER PORT n
WEB UDP INTERRUPT intname
WEB UDP SEND addr$, port, data$


OPTION UDP SERVER PORT sets up a listening socket on the port specified. Any UDP datagrams received on that port will be processed and the contents saved in MM.MESSAGE$. The IP address of the sender will be stored in MM.ADDRESS$. Note: If the UDP datagram is longer than 255 characters then any extra is discarded.

WEB UDP INTERRUPT sets up a BASIC interrupt routine that will be triggered whenever a UDP datagram is received

WEB UDP SEND is used to send a datagram to a remote receiver. In this case the IP address must be specified and can be either a numeric address (e.g. "192.168.1.147") or a normal text address (e.g. "google.com"). The port number of the receiver must also be specified and, of course, the message itself. The SEND command can be used as a response to an incoming message or stand-alone.

e.g.

WEB udp interrupt myint
WEB udp send "192.168.1.155",77,"starting udp echo"
Do
Loop
Sub myint
Print "received "+mm.message$+" from "+mm.address$
WEB udp send mm.address$,77,mm.message$
End Sub




Hi Peter

Why do you shrink the payload from official (RFC 768) around 65,000 bytes to 255 characters?
Could you increase the limit to 512 bytes by LONGSTRING because the already implemented TFTP uses also a fixed data length of 512 bytes up to the penultimate packet?

Bests
Gregor
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3150
Posted: 02:47pm 31 May 2023
Copy link to clipboard 
Print this post

  aFox said  Why do you shrink the payload from official (RFC 768) around 65,000 bytes to 255 characters?
Could you increase the limit to 512 bytes by LONGSTRING because the already implemented TFTP uses also a fixed data length of 512 bytes up to the penultimate packet?


I have used UDP a fair amount to send data from sensors to an accumulator. The messages are quite short--usually less than 30 characters including a 12-character date/time stamp. What is your use-case for more than 255 characters?
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9127
Posted: 03:06pm 31 May 2023
Copy link to clipboard 
Print this post

The only sensible way to do interrupt driven receive is to use a string variable, hence 255 chars. This isn't going to change.
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 897
Posted: 11:29pm 31 May 2023
Copy link to clipboard 
Print this post

  andreas said  LIBRARY_FLASH_SIZE  14000 findings


> library delete
> option list
WebMite MMBasic Version 5.07.07
OPTION AUTORUN 3
OPTION COLOURCODE ON
OPTION DISPLAY 50, 100
OPTION WIFI FritzBox, *********************
OPTION TELNET CONSOLE ON
> library save
Library Saved 184 bytes
> option list
WebMite MMBasic Version 5.07.07
OPTION AUTORUN 3
OPTION LIBRARY_FLASH_SIZE  14000
OPTION COLOURCODE ON
OPTION DISPLAY 50, 100
OPTION WIFI FritzBox, *********************
OPTION TELNET CONSOLE ON

-andreas

The library is fixed size of 1 flash slot which can vary between the various Picos (Picomite,PicomiteVGA,Webmite).
OPTION LIBRARY_FLASH_SIZE in the printout is actually showing the library start address.It should just be used as an indication that you are using the library.
Latest F4 Latest H7
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3194
Posted: 09:24am 01 Jun 2023
Copy link to clipboard 
Print this post

  matherp said  
I've done a complete re-compile and this version will force an option reset. let me know if this fixes the issue.
This version should also work both sending and receiving broadcast UDP packets

WebMiteV5.07.08b1.zip

This version does not seem to work with Telnet.  I get "Connection refused".
Going back to 5.07.07 - everything is fine.

Geoff
Geoff Graham - http://geoffg.net
 
aFox
Regular Member

Joined: 28/02/2023
Location: Germany
Posts: 76
Posted: 12:49pm 01 Jun 2023
Copy link to clipboard 
Print this post

  matherp said  The only sensible way to do interrupt driven receive is to use a string variable, hence 255 chars. This isn't going to change.


The next documentation should refer to this circumstance.

Gregor
 
ville56
Regular Member

Joined: 08/06/2022
Location: Austria
Posts: 95
Posted: 02:30pm 01 Jun 2023
Copy link to clipboard 
Print this post

Geoff, are you sure you have OPTION TELNET CONSOLE ON as 5.07.08b1 works with telnet for me without any issue. Had all kind of network issues with 5.07.08b0. Maybe clear_flash is worth a try.
I also think that 08b1 needs more attepts to connect to my Fritzbox as the final 07 version. Have no idea what the reason could be, as the log in the router is not very informative, but it may be in conjunction with my repeater mesh.

Reagrds,
Gerald
                                                                 
73 de OE1HGA, Gerald
 
JanVolk
Senior Member

Joined: 28/01/2023
Location: Netherlands
Posts: 145
Posted: 05:12pm 01 Jun 2023
Copy link to clipboard 
Print this post

Volhout,

It is true that there was an error in my html file and I have corrected it. Now works fine with html and Notepad++.
Also updated the Custom syntax highlighting for PicoMite and MMB4W which works very fast and nice. Especially the search and replace function in Notepad++ is useful.

Jan
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3194
Posted: 12:43pm 02 Jun 2023
Copy link to clipboard 
Print this post

  Geoffg said  This version does not seem to work with Telnet.  I get "Connection refused".

My mistake, I had an issue with the WebMite's startup.
V5.07.08b1 now works fine.

Geoff
Geoff Graham - http://geoffg.net
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9127
Posted: 02:01pm 02 Jun 2023
Copy link to clipboard 
Print this post

V5.07.08b2


WebMiteV5.07.08b2.zip


Fixes memory leak in WEB MQTT connect
 
andreas

Senior Member

Joined: 07/12/2020
Location: Germany
Posts: 207
Posted: 02:50pm 02 Jun 2023
Copy link to clipboard 
Print this post

  matherp said  V5.07.08b2


WebMiteV5.07.08b2.zip


Fixes memory leak in WEB MQTT connect


confirmed! "General RAM" is not increasing! Thank you Peter!

-andreas
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 351
Posted: 07:20pm 03 Jun 2023
Copy link to clipboard 
Print this post


Hello Peter,

I don't check the forum for a few days and then you come along with the fulfilment of my wishes. And you didn't want to work on a new version right away ;-)

Version WebMiteV5.07.08b2 is great! UDP works without problems.

With TCP I still have a (comprehension) problem. How can I determine whether a TCP connection has been established to the WebMite without having to receive anything (i.e. without the client sending anything)? Because without an existing connection, the WebMite cannot send without crashing. The crash happens even if I send and the connection is terminated from the client side :-( Hence my question about the possibility to check this "connection status" or to react to it.

Matthias
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3802
Posted: 01:22pm 04 Jun 2023
Copy link to clipboard 
Print this post

  homa said  How can I determine whether a TCP connection has been established to the WebMite without having to receive anything (i.e. without the client sending anything)? Because without an existing connection, the WebMite cannot send without crashing. The crash happens even if I send and the connection is terminated from the client side :-( Hence my question about the possibility to check this "connection status" or to react to it.

Matthias

If you could check, it would still be a "race" condition, wouldn't it? (Where the connection could be terminated between the check and whatever the program did based on the check saying it's connected.)

John
Edited 2023-06-04 23:23 by JohnS
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 351
Posted: 03:31pm 04 Jun 2023
Copy link to clipboard 
Print this post

Hi John,
you are right, but not yet.

I would like to get information about the status that a TCP connection exists and I am allowed to send, see also here: https://en.wikipedia.org/wiki/Transmission_Control_Protocol#Connection_establishment

Of course the sending can fail because the connection is broken, but it should not crash the WebMite, maybe a timeout occurs and the status changes to "no connection", then I can stop sending.
I'm not thinking of using it as a web server/website, but for other services.

Like I said, UDP works great! With TCP it still hangs a bit...

At the moment I am responding to a WEB interrupt and just remembering that I can send now. This works so far for testing. I can send for minutes, but it needs a character from the client to start - to trigger the interrupt.
As I said, closing the connection from the client side causes a crash, because i am still sending.  

So I hope for the help of @Peter  

Matthias

Adding: this shows it even better...
https://upload.wikimedia.org/wikipedia/commons/f/f6/Tcp_state_diagram_fixed_new.svg
Edited 2023-06-05 01:35 by homa
 
     Page 2 of 5    
Print this page
© JAQ Software 2024