Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 05:43 02 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 : CMM2: Restoring options after a firmware update

Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 12:03pm 24 Jul 2020
Copy link to clipboard 
Print this post

Hi folks,

I thought I had a clever way to restore my options after a firmware update:
> list "/config.bas"
If Mm.Info$(Search Path) = "" Then
 Print "one"
 option f11 "chdir " + chr$(34) + "/zmim/src" + chr$(34) + chr$(13) + chr$(10)
 option f12 "chdir " + chr$(34) + "/mbt/src" + chr$(34) + chr$(13) + chr$(10)
 option search path "/bin/"
 ' so this script will run again on reset
 option autorun on
 ' this will cause a reset
 option sd timing fast
Else
 Print "two"
 ' so this script will not run again
 option autorun off
 ' this will cause a reset - note even if autorun was still on it wouldn't
 ' take effect because running from RAM means that there will be no current
 ' program after the reset
 option ram
EndIf


So the idea is that after updating the firmware you reset the CMM2 and just type *config.

I use the AUTORUN trickery because both OPTION SD TIMING and OPTION RAM cause a reset.

But it doesn't seem to work, the script doesn't get run a second time.

Can anyone explain ?

... it looks like the AUTORUN doesn't occur after a reset due to changing SD TIMING or RAM. Are there different types of reset going on?

Regards,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
mkopack73
Senior Member

Joined: 03/07/2020
Location: United States
Posts: 261
Posted: 12:39pm 24 Jul 2020
Copy link to clipboard 
Print this post

Are you sure the search path setting gets maintained after the first reboot so as to cause the else clause to get invoked?

You might want to have the code print the current search path right at the start so you'll see what it thinks it is both times...

Only thing I can think of...
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 02:16pm 24 Jul 2020
Copy link to clipboard 
Print this post

  mkopack73 said  Are you sure the search path setting gets maintained after the first reboot so as to cause the else clause to get invoked?


Yes, I am sure.

And if I then do a hard reset the second part of the config script will be executed.

It looks like there is a difference between the reset performed when OPTION SD TIMING FAST, or OPTION RAM, or OPTION USBKEYBOARD are used and a hard reset of the Waveshare.



Regards,

Tom
Edited 2020-07-25 00:16 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 04:06pm 24 Jul 2020
Copy link to clipboard 
Print this post

So in another thread Peter told me that AUTORUN deliberately doesn't occur after changing an option which requires a reset

So instead I'm using this:
SEARCH_PATH$ = "/bin/"

s$ = Mm.Info$(Search Path)

If LCase$(Mm.CmdLine$) = "reset" Or LCase$(Mm.CmdLine$) = "clear" Then
 Print "OK"
 option reset

ElseIf LCase$(Mm.CmdLine$) = "list" Or s$ = SEARCH_PATH$ Then
 option list

ElseIf Mm.CmdLine$ <> "" Then
 Error "Unknown command line option"

ElseIf s$ = "" Then
 option f11 "chdir " + chr$(34) + "/zmim/src" + chr$(34) + chr$(13) + chr$(10)
 option f12 "chdir " + chr$(34) + "/mbt/src" + chr$(34) + chr$(13) + chr$(10)
 option search path "/magic/"

 Print "Please run *config again to complete setup"

 ' This will cause a reset
 option sd timing fast

ElseIf s$ = "/magic/" Then
 option search path SEARCH_PATH$

 Print "OK"

 ' This will cause a reset
 option ram

Else
 Error "Unknown state"

EndIf


It's not especially pretty, but it does the job.

Regards,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Print this page


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

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025