Acknowledged
CIQQA-3377

impossible to keep ANT+ sensors paired to the simulator

I'm running Connect IQ Device Simulator 8.2.2 the most recent version on my Mac, and I have a Garmin ANT+ stick.

I'm able to pair ANT+ sensors; but I have no idea how to keep them paired.

Currently the flow goes like this:

- Start datafield simulator

- Open Settings -> Manage Sensors menu

- Search and pair ANT+ sensors (this process kills the running app, but does allow me to pair the sensors).

- But now we have to somehow restart our app because the app is not running; so I kill the simulator and restart it

- Now my app is running but my ANT+ sensors are all in the "Disconnected" state. There is no obvious way to get them to search mode or reconnect without going through the same flow as before which will kill my app; clicking Unpair or RemoveAll will kill the app. Then I can repair the sensors but I will have to reboot the simulator to get my app running again and then it will not be disconnected.

Sometimes, with shear luck, when I restart the simulator my app will be successfully paired with the ANT+ sensor(s). No idea why this sometimes works, it's about 1 in 20. Makes it very cumbersome to test and develop locally. Am i doing something wrong? What is the recommended approach to get your app restarted after the pairing menu kills the app?

  • yes I reproduced this exact behavior; I think it's a bug

    Yeah, I guess there's some kind of communications issue with the sim. Probably when you press Run enough times, it finally forces the previous run attempt to finally go through, but then you have to cancel the final run attempt (unless you feel like waiting a few more seconds).

    Also not the best user experience.

  • No problem!

    Yeah, I agree that the whole user experience is less than ideal. Kinda like how the Simulation > Activity Data dialog in the simulator still causes confusion for devs. At least they finally fixed the issue where you could save a FIT file without saving the activity first, which caused the FIT file to be corrupt.

    > the button to "Reset Simulator" seems to do nothing

    Seems like it deletes ConnectIQ/simulator.ini which contains things like the last window size and position, without closing or restarting the sim itself. I'm not sure if this has any real effect, because as soon as you close the sim, it recreates simulator.ini anyway (and not with defaults).

    Also, if you select the menu item 2 times in a row, it complains that simulator.ini doesn't exist.

    Seems like it would be better to just get rid of that menu item.

  • Funnily enough, I've found that when the app gets stuck like this, the *2nd-last* attempt at running the app usually works - the final attempt is seemingly what causes the 2nd-last attempt to finally go through, as at this point, VS Code will tell me that the app is already running and it asks me if I want to start another instance. Or maybe I'm just not waiting long enough, idk.

    yes I reproduced this exact behavior; I think it's a bug

  • Thanks!!

    Yeah, there's multiple things here making it confusing...

    First, in the ConnectIQ Device Simulator nav bar File menu, there's no way to "Restart App" and the button to "Reset Simulator" seems to do nothing.

    Second, like you said, if go to the VS code nav bar Run menu, (without first closing the simulator, so I still have the simulator open), and then if click "Start Debugging" or "Run without Debugging" these sometimes don't work. Now that I know the trick i'll just keep clicking those until the app actually reboots in the simulator without closing the simulator.

  • On a related note, the Eclipse Monkey C plugin allowed you to start the sim without running an app. It's too bad they took this feature away from the VS Code extension, as it would be more convenient for your use case (where you want to manage sensors before running the app).

    Sure, you could start the simulator by running the exe in the SDK bin/ folder, but that causes an annoying "extra" console window to open as well.

    Anyway, to be clear, the simulator can be started without running an app, and an app can be run multiple times without restarting the sim. The sim doesn't close (or need to close) after an app is killed.