Heart intervals broken on Venu firmware update (and now other devices)

Hi,

My app has been working consistently for quite a long period. Venu had a firmware update and I started to get reports of the app displaying zero results. The cause of this is that no interval data is being generated / seen by the app though BPM is being reported. A user has tried many other HRV like apps and they all FAIL as well.

I've tried various changes to the sensor handling to see if this fixes the issue to no avail. I am now in the situation that a) the simulator shows no issues and works perfectly every time (even with original code that stopped working after the firmware update and b) users are now in the situation that if they run the app twice then they will get interval/beat data. This remains the case for a period of time ie subsequent runs work every time and then reverts to having the app run twice.

These on device issues (simulator has no issues and no crashes) are almost impossible to debug now as the ability to read the LOG file has been removed (they no longer exist - someone said because of MTP file system). Either the simulator needs to get up with API and firmware iterations or there needs to be better tools for live debug. ERA doesn't report anything of course.

original code (has worked OK for months):

var _ans;
if (Sensor has :enableSensorType) {
Sys.println(">=CIQ 3.2 detected");
_ans = Sensor.enableSensorType( Sensor.SENSOR_HEARTRATE);
if (_ans) {
Sys.println("Strap enabled");
} else {
Sys.println("no strap");
_ans = Sensor.enableSensorType( Sensor.SENSOR_ONBOARD_HEARTRATE);
if (_ans) { Sys.println("OHR enabled");} else {Sys.println("no OHR either");}
}
} else {
_ans = Sensor.setEnabledSensors( [Sensor.SENSOR_HEARTRATE]);
Sys.println("Enable response ="+_ans);
}
Sensor.registerSensorDataListener(self.method(:onHeartRateData), options);
Note: sensors are disabled on exit of app.
Current code ( various versions of this have been tried with enabling both together and separately as here)
if (Sensor has :enableSensorType) {
Sys.println(">=CIQ 3.2 detected");
//_ans = Toybox.Sensor.setEnabledSensors( [Sensor.SENSOR_HEARTRATE, Sensor.SENSOR_ONBOARD_HEARTRATE]);
// USE enableSensor as it doesn't disable other sensor types
_ans = Toybox.Sensor.enableSensorType( Sensor.SENSOR_HEARTRATE);
Sys.println("Enable3.2a ="+_ans);
_ans = Toybox.Sensor.enableSensorType( Sensor.SENSOR_ONBOARD_HEARTRATE);
Sys.println("Enable3.2b ="+_ans);
// ONBOARD only works on > 3.2.0 devices
} else {
_ans = Toybox.Sensor.setEnabledSensors( [Sensor.SENSOR_HEARTRATE]);
Sys.println("Enable ="+_ans);
}
Any ideas welcome!!! This has broken 3 different apps.
Regards,
David
  • 1. Do you know that you can insert code? Because this is hard to read

    2. Can you indicate where do you get "zero results"?

    3. Do i understand correctly that on those devices it is 100% reproducible and it works on every odd run and doesn't work on every pair run?

    4. Can you also include the code that disabled on exit?

    5. There's no problem reading the logs on MTP file System. What OS they use? Is it an old version of MacOS?

  • Hi,

    My fault entirely on code insert - it's been a very long time since I used that functionality.

    Original code:

    		var _ans;
    		
    		if (Sensor has :enableSensorType) {
    			Sys.println(">=CIQ 3.2 detected");
    			_ans = Sensor.enableSensorType( Sensor.SENSOR_HEARTRATE);
    			if (_ans) { 
    				Sys.println("Strap enabled"); 
    			} else {
    				Sys.println("no strap");
    				_ans = Sensor.enableSensorType( Sensor.SENSOR_ONBOARD_HEARTRATE);
    				if (_ans) { Sys.println("OHR enabled");} else {Sys.println("no OHR either");}
    			}
    		} else {
    			_ans = Sensor.setEnabledSensors( [Sensor.SENSOR_HEARTRATE]);
    			Sys.println("Enable response ="+_ans);
    		}

    Updated code:

    		if (Sensor has :enableSensorType) {
    			Sys.println(">=CIQ 3.2 detected");
    			//_ans = Toybox.Sensor.setEnabledSensors( [Sensor.SENSOR_HEARTRATE, Sensor.SENSOR_ONBOARD_HEARTRATE]);
    			// USE enableSensor as it doesn't disable other sensor types
    			_ans = Toybox.Sensor.enableSensorType( Sensor.SENSOR_HEARTRATE);
    			Sys.println("Enable3.2a ="+_ans);
    			_ans = Toybox.Sensor.enableSensorType( Sensor.SENSOR_ONBOARD_HEARTRATE);
    			Sys.println("Enable3.2b ="+_ans);
    		// ONBOARD only works on > 3.2.0 devices
    		} else {
    			_ans = Toybox.Sensor.setEnabledSensors( [Sensor.SENSOR_HEARTRATE]);
    			Sys.println("Enable ="+_ans);
    		}
    		
    		Toybox.Sensor.registerSensorDataListener(self.method(:onHeartRateData), options);

    2. Can you indicate where do you get "zero results"?

    The data listener :onHeartRateData must never be called or has no interval data as the processing that follows this never updates. I have a screen showing count of intervals received and this stays at 0. The onHeartRateData contains...

    		if (sensorData has :heartRateData && sensorData.heartRateData != null) {
    			heartBeatIntervals = sensorData.heartRateData.heartBeatIntervals;

    This code has not changed since the first version of the app.

    3. Do i understand correctly that on those devices it is 100% reproducible and it works on every odd run and doesn't work on every pair run?

    This now appears to be the case besides on Venu 2S devices after the firmware update where it doesn't work ever.

    4. Can you also include the code that disabled on exit?

    I have removed this in the latest version and this makes no difference. It used to look like ... ideally if should disable the sensor it actually found connected (future fix). Having this code in or out makes no difference.

    		var _ans = false;
    		if (_self has :disableSensorType) {
    			Sys.println("Stop: >=CIQ 3.2");
    			_ans = Toybox.Sensor.disableSensorType( Sensor.SENSOR_HEARTRATE);
    			if (_ans) { 
    				Sys.println("Strap disabled"); 
    			} 
    		}
    		
    		Toybox.Sensor.unregisterSensorDataListener( );

    5. There's no problem reading the logs on MTP file System. What OS they use? Is it an old version of MacOS?

    I use a windows machine. Prior to my Fenix 7x I could always create a LOG file with name of the PRG file downloaded by Connect (alphanumeric filename). I was told on the forum that with MTP these would no longer be visible/usable. I've tried numerous times to create TXT file in the LOGS folder, including for every single app/widget etc loaded but the corresponding xxx.TXT file is never anything other than 0 bytes. If you could tell me how to make this work again I would be externally grateful.

    Thanks,

    David

  • In the new code you enable both the external and internal HR. IMHO what can happen is something i saw happening sometimes to me (even though I don't have code to enable or disable them) is that when the external strap disconnects from my ANT channel then after a few seconds it connects to the watch and that becomes the 'regular' HR instead of the optical. It can also happen the other way around.

    I can also imagine that it takes a second or so to establish this connection so depending on the circumstances the 2nd connection can fail or be successful. This might explain why every 2nd time it works.

    If you have the device that can reproduce it then try it when the connection in the watch menu is disabled. I bet it won't happen then

  • Hi,

    What you describe is what should happen. The strap is preferentially selected by Garmin sensor hub if one is available. I also removed my ANT driver and went to using the internal sensor hub as well. People got confused about not having an external strap listed in accessories when using that mode.

    I'm tempted now to try initial what you suggested and double initialise.

    I have no strap on holiday so it should only find the optical sensor. 

    More bizarrely thought it all worked fine until a Venu firmware update a week or so ago! I also neglected to bring a USB-B -> USB-C on holiday to try new options on device. It also works perfectly in the simulator.

    How can you get the LOG files on a device?????? Nothing I try seems to work!

    Regards,

    David

  • I had an older Mac a year ago, an Ubuntu until a month ago and a newer Mac now. They all see the files and I am able to copy in both directions. Maybe different watches use different protocol and maybe different versions of the computer OS do or don't have the necessary driver

  • Hi

    i can see the app and logs directory no problem on PC. Issue is that either I haven’t found the correct filename for my app to create a log file that will then be used or i can no longer write txt files. As above I gave every app in the apps directory a corresponding logs file. No data. 

    is there another directory on the watch that contains the apps for mtp based systems? Ie not garmin/apps?? Jim on the forums I think had said logs files jo longer available/visible. 

    thanks

    david

  • If you have a store version of the app and then install a sideload, it will use the 8 character store name, and that's what you need to use for the log file.  If you have a store version, uninstall it first before copying over a sideload. and then the log file will use the name of the sideload.

  • Hi Jim

    that is what I have always done but doesn’t seem to work anymore. I tried it for every loaded app ie created corresponding txt in log directory and no files were more than 0 bytes. This was to ensure I had my app covered

    thanks

    david. 

  • Thanks. Will look when I can connect to watch.