Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:53 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 : Adding firmware version checks to programs

Author Message
realmnm

Newbie

Joined: 07/07/2020
Location: Australia
Posts: 34
Posted: 11:06am 19 Aug 2020
Copy link to clipboard 
Print this post

I tried to add a minimum firmware version check to my software and found that it doesn't work as well as I would have liked.  This may just be floating point issue or ?I don't know what.

Here is what I tried.

dim MINFWVERSION as float
dim CMM2VERSION as float

MINFWVERSION=5.0505
CMM2VERSION=MM.INFO(VERSION)

if CMM2VERSION < MINFWVERSION then
 print:print "Sorry, appear to be running firmware version "+str$(CMM2VERSION)
 print "You need to be running firmware version "+str$(MINFWVERSION)+" or higher.":print
 end
endif



Let me know your thoughts.

Martin
This signature intentionally left blank.
 
yock1960
Senior Member

Joined: 18/08/2020
Location: United States
Posts: 167
Posted: 11:24am 19 Aug 2020
Copy link to clipboard 
Print this post

Have you tried subtracting one from the other to see if you get the expected result?

Steve
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2170
Posted: 11:27am 19 Aug 2020
Copy link to clipboard 
Print this post

looks OK, fairly straightforward test

what don't you like? what was the result of you running this?

Need a bit more wood on the fire to help, print out the two variables so we can see what the If is working with.

I do a similar thing on the Micromite/ArmiteF4/H7 paltform but I use the string form MM.DEVICE$. I am not familiar with the idiosyncrasies of the CMM2.
Edited 2020-08-19 21:28 by CaptainBoing
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 11:30am 19 Aug 2020
Copy link to clipboard 
Print this post

  realmnm said  I tried to add a minimum firmware version check to my software and found that it doesn't work as well as I would have liked.

What is the problem?  What is it that you "would have liked".

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

Joined: 11/12/2012
Location: United Kingdom
Posts: 10315
Posted: 11:31am 19 Aug 2020
Copy link to clipboard 
Print this post

Just a standard floating point rounding issue

Use MINFWVERSION=5.0504999999999
 
realmnm

Newbie

Joined: 07/07/2020
Location: Australia
Posts: 34
Posted: 11:39am 19 Aug 2020
Copy link to clipboard 
Print this post

That’s what I thought it might be. Thanks.
This signature intentionally left blank.
 
realmnm

Newbie

Joined: 07/07/2020
Location: Australia
Posts: 34
Posted: 11:42am 19 Aug 2020
Copy link to clipboard 
Print this post

  Geoffg said  
  realmnm said  I tried to add a minimum firmware version check to my software and found that it doesn't work as well as I would have liked.

What is the problem?  What is it that you "would have liked".

Geoff

Fireworks,  Coins pouring out like I had won a Jackpot.


This signature intentionally left blank.
 
mkopack73
Senior Member

Joined: 03/07/2020
Location: United States
Posts: 261
Posted: 03:40pm 19 Aug 2020
Copy link to clipboard 
Print this post

Yeah this, and a number of other “best practices” really should be used when writing programs for this computer.  

I’m starting to write these best practices up (literally started this morning) as a little book to help people write good, clean, portable and reusable code for the CMM2.
 
mkopack73
Senior Member

Joined: 03/07/2020
Location: United States
Posts: 261
Posted: 03:41pm 19 Aug 2020
Copy link to clipboard 
Print this post

To deal with the FP precision issue you could try to round it up to the nearest .000x before doing the comparison.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 07:34am 20 Aug 2020
Copy link to clipboard 
Print this post

if MM.INFO(VERSION) < (5.0505-0.0001) then print "too old" else print "All good"

VK7JH
MMedit
 
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