Members | Sign In
Legacy MOVI User Community Forum (readonly) > MOVI Question & Answers
avatar

Versioncheck not returning the API shown in MOVIshield.h

posted Mar 19, 2018 04:32:58 by SteveO'Shaughnessy
Version check is giving me
MOHVEE's firmware is version 1.1
MOHVEE's Arduino library is version 1.12
MOHVEE's hardware is version 1.0

but MOVIshield.h here C:\Users\Steve\Documents\arduino\libraries\MOVI has
#ifndef API_VERSION
#define API_VERSION 1.13f
#endif

Is there some caching going on? or is there another place that MOVIshield.h exists?
page   1
4 replies
avatar
GeraldFriedland said Mar 25, 2018 05:17:12
I am pretty sure you are loading your MOVIShield.h from another place. I would search your entire directory tree for MOVIShield.h

Gerald
avatar
SteveO'Shaughnessy said Mar 31, 2018 01:17:02
I am sure I have only one version of MOVIshield.h on my system. I have a screen dump that shows only one file with that name. I also re-named that file and tried recompiling and that threw an error, file not found.

Also deleted the tmp/ arduino files and recompiled.

This is very weird.

avatar
SteveO'Shaughnessy said Mar 31, 2018 02:18:19
I have this code in my init

Serial.println("MOHVEE's firmware is version "+float2string(recognizer.getFirmwareVersion(),1));
Serial.println("MOHVEE's Arduino library is version "+float2string(recognizer.getAPIVersion(),2));
Serial.println("MOHVEE's hardware is version "+float2string(recognizer.getHardwareVersion(),1));
}

// Helper function that works across Arduino platforms that converts float to String
String float2string(float f, int places)
{
int beforepoint=(int) f;
int afterpoint=(f-beforepoint)*pow(10,places);
return String(beforepoint)+"."+String(afterpoint);
}

String sjo(float f, int places)
{
int beforepoint=(int) f;
int afterpoint=(f-beforepoint)*pow(10,places);
return String(beforepoint)+"."+String(afterpoint);
}

This produces
MOHVEE's firmware is version 1.1
MOHVEE's Arduino library is version 1.12 ////////// wrong api version
MOHVEE's hardware is version 1.0


When I change the code as follows
Serial.println("MOHVEE's firmware is version "+float2string(recognizer.getFirmwareVersion(),1));
Serial.println("MOHVEE's Arduino library is version "+sjo(recognizer.getAPIVersion(),2)); ///////////////////// Changed here
Serial.println("MOHVEE's hardware is version "+float2string(recognizer.getHardwareVersion(),1));
}
This is produced
MOHVEE's firmware is version 1.1
MOHVEE's Arduino library is version 1.13 ///////// correct api version!
MOHVEE's hardware is version 1.0



avatar
GeraldFriedland said Apr 04, 2018 03:54:13
Wow. You just found a rounding bug in float2string!

I googled it and found this:
http://forum.arduino.cc/index.php/topic,37391.0.html


It seems we are dicouraged from using this function.

Gerald
Login below to reply: