I built a small datafield to learn about ANT+ for ebikes (LEV - Light Electric Vehicel) on the base of the sample "Moxy Datafield".
My test datafield works pretty well - but there is a (small) problem:
When the Edge was sent to sleep - after wakeup the ANT channel does not exist anymore and needs to be re-initialized.
GARMIN says (years ago...):
...the issue is that when the Edge enters low power, we power down the ANT module and forget the state of all running channels (we also reset the state of the ANT radio stack). Then when the Edge exits low power mode the data field expects its channel to still be open. Calling open/close after exiting low power wouldn't work in this case as the original channel would have been reset.
Until we get a fix in for this an app developer will need to set up a watchdog for their channel where if they don't receive a message for X seconds (with X being larger than their search timeout), the developer will reinitialize their channel.
So, I built a watchdog in view.mc which works.
/// WATCHDOG: //lastMessage = sensor.getData().getLastMessage(); // see line above! timeNow = Time.now().value(); if (lastMessage != null) { if ( lastMessage < timeNow - 5 ) { // WatchDog barks levStatus = 0; lastMessage = null; // now reInitialize the ANT channel - BUT HOW TO DO????? } }
But I don't find a way to call a re-initialize of the ANT channel in LEVSensor.mc.
I submit the whole (small) datafiedl, so - if you want - can better see.
And a screenshot of the Edge for better information:
I would be glad if any of you can show me the solution.
Many thanks in advance!