Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 21:57 26 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 : Watering Controller - Updated Firmware (V1.3)

     Page 2 of 2    
Author Message
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2135
Posted: 04:52am 19 Jan 2024
Copy link to clipboard 
Print this post

  Quote  Sub MM.STARTUP is only executed if the program is running (ie, OPTION AUTORUN worked).

whatever is in Sub MM.STARTUP seems to get executed whenever the Pico restarts, regardless of AUTORUN. If OPTION AUTORUN is set MM.STARTUP runs first.

On my WebMite AUTORUN isn't set, just MM.STARTUP as above and the program runs every time.

Edit. This works reliably for me. After a power outage the WebMite first waits for the modem to boot then waits for the internet to reconnect before starting the main program.
> option list
WebMite MMBasic Version 5.08.00RC4
OPTION SYSTEM SPI GP18,GP19,GP16
OPTION COLOURCODE ON
OPTION DISPLAY 55, 132
OPTION WIFI WiFi-6BAC, ***************, PICOE6614104031
OPTION TCP SERVER PORT 80
OPTION TELNET CONSOLE ON
OPTION SDCARD GP17

> LIST
Sub MM.STARTUP
 Pause 200
 On error skip 4     'test for WiFi link
 If (MM.Info(ip address) = "0.0.0.0") Or (MM.Info(ip address) = "") Then
   Pause 8000
   CPU restart
 EndIf

 Local float TZ = 10, DS = 1    'Time Zone, Daylight Saving
 Do While Right$(Date$,4) = "2000" 'test for internett connection
  On error skip 2
  WEB NTP TZ+DS, "162.159.200.123"
  Pause 2000
 Loop

 Run 'start main program
End Sub

Edited 2024-01-20 22:18 by phil99
 
     Page 2 of 2    
Print this page


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

© JAQ Software 2024