OpenSeizureDetector / Garmin_SD

Garmin Watch Seizure Detector - A seizure detector data source based on Garmin IQ watches such as Vivoactive HR
http://openseizuredetector.org.uk
GNU General Public License v3.0
12 stars 8 forks source link

Typechecking v2 #66

Closed pmithrandir closed 6 months ago

pmithrandir commented 7 months ago

Adding type checking over the entire code. OK for level 2.

Sadly, one warning can't be removed preventing to go to level 3.

WARNING: vivoactive4: /home/pmithrandir/PycharmProjects/Garmin_SD/source/GarminSDDataHandler.mc:184,4: Cannot find symbol 'SENSOR_PULSE_OXYMETRY' on type '$.Toybox.Sensor'.

This sensor is only available on SDK 3.2 and more.

We compile in 2.4

jones139 commented 6 months ago

Also, please change the version number in strings.xml to v2.0.2

pmithrandir commented 6 months ago

I changed the version to 2.0.2.

But I don't reproduce the error you have.

Which SDK version do you have ? Are you compiling with a manifest close enough to the manifest.xml.template ?

jones139 commented 6 months ago

My Manifest.xml is exactly the same as Maniest.xml.template.

I use the vscode MonkeyC extension, so am not calling the sdk directly. Checking the compile command line I can see it is using sdk 6.2.0 - I am not sure where I specify that we should use that one though! (I have never really got the hang of IDEs, Makefiles are my comfort zone!)

pmithrandir commented 6 months ago

You can check your env variable. You should have the MB_HOME targeting your SDK.

I have : MB_HOME=/home/pmithrandir/.Garmin/ConnectIQ/Sdks/connectiq-sdk-lin-6.4.2-2024-01-04-a1dd13ee0/

I checked with 6.2 and I get the same error as you do. I think the best would be to upgrade to the last version, as Typing really sucks on monkey-C (it's really crazy strict) and they are improving it version after version.

jones139 commented 6 months ago

I just did a bit more digging. I am getting the error: ERROR: venusq2: /home/graham/osd/Garmin_SD/source/GarminSDComms.mc:59,4: Invalid '$.Toybox.Lang.Method(responseCode as $.Toybox.Lang.Number, data as $.Toybox.Lang.String) as Void' passed as parameter 4 of type 'PolyType<($.Toybox.Lang.Method(responseCode as $.Toybox.Lang.Number, data as Null or $.Toybox.Lang.Dictionary or $.Toybox.Lang.String) as Void) or ($.Toybox.Lang.Method(responseCode as $.Toybox.Lang.Number, data as Null or $.Toybox.Lang.Dictionary or $.Toybox.Lang.String, context as $.Toybox.Lang.Object) as Void)>'.

In several places if I use any typechecking - I have to set type checking to OFF to get it to compile and run.

I see now that you can specify the type checking on either the command line or in the monkey.jungle file. vscode is using he command line version which is overriding the monkey.jungle. "WARNING: A type check level was specified both at the command line and in a jungle file. The jungle file specification will be ignored."

jones139 commented 6 months ago

Our emails crossed in the post, sorry! I'll try the newer version of the sdk to check. If that is the case, would you mind adding something into the README file to warn people about the minimum compatible sdk? Thanks!

pmithrandir commented 6 months ago

I'm using the mb_runner.sh executable on the root folder. (I'm working on pycharm)

jones139 commented 6 months ago

Yes, upgrading to V6.4.2 using the Garmin sdkmanager to set that to the default SDK fixed the issue. There was a V7 sdk published today, but I have had enough bad experiences of Garmin that I do not rush to install the latest version of anything!