Author Topic: Cannot change the connection to another device in Run or Stopped mode?  (Read 679 times)

kbrooking

  • Full Member
  • ***
  • Posts: 104
    • View Profile
When testing the reed switch on the mc-mod120, I keep getting a pop window with the following error when I move the magnet away from the mod120.

            "Cannot change the connection to another device in Run or Stopped mode."

mc-studio seems to freeze at this point and when I click on the red button to stop the debugger I get this  error...

            "Stop debugging Failed. This popup window is from System.Windows.Forms.

I have to end mc-studio via task manager and restart mc-studio. Attached is a screen shot of the error with the code I'm running.

Any suggestions what I'm doing wrong?



« Last Edit: February 14, 2017, 04:53:32 pm by mc-T2 »

Share on Facebook Share on Twitter


kbrooking

  • Full Member
  • ***
  • Posts: 104
    • View Profile
UPDATE: I re-coded the previous reed switch example above to the new version shown on the attached mc-studio snap shot along with the error.

This code is a combination of Tom's example code he uses in his reed switch video with Nick's MQTT and TempSensor libraries.

In the code there are two ways to send the data. Either using Lplan.Publish method as in Tom's example or by using MQTT.Publish method in the MQTT library.
When testing I comment out one or the other depending which one I'm testing.

However, Doesn't matter which one I use. Both methods cause the error to appear on the attached snap shot. When I comment out both lines and don't send the data, the code seems to work great based on how the led is flashing when the magnet moves in and out.

One last thing I need to mention and not sure if it's important but when I do un-comment out one of the two methods to send data, I notice the red led flashes really quickly twice right before the error pop window displays.

mc-John

  • Global Moderator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Very strange. The error that you get is an error that the device is disconnected while you are in run mode. It was setup to prevent that people from switching to another device. Switching is a disconnect /connect operation.
I tested this and it will give you that error also when the device is being reset when you are in run mode.

There was a bug with long messages which resulted in a reset but that has been solved in the latest code. Check if you have the latest code.
If so then you device must go into a reset.


 

kbrooking

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Thanks John. Y

es I am using the latest firmware for both GW ant mc-mod120. This is happening on all my 120 modules when running the attached code. When running in the debugger I see it happening upon the Lplan.Publish command.

Any suggestions on how I can track down what is causing the reset?

mc-John

  • Global Moderator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Before you publish you should find out what the length of the message and topic is. Just let me know and I will try to reproduce it.

kbrooking

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Oh Man!  :o  I would really appreciate your help John. I’ve been trying to figure this out for the past few days and unable to resolve the error message.  :'(

 Attached are the project files. I’m using Nick’s libraries for the MQTT and Temperature stuff.

I have tried using different length messages and topics but, same result. After about 6 or 7 iterations I get the "Cannot change the connection to another device in Run or Stopped mode." Error message.

This happens on all four of my 120 modules (with battery clips). I have the newest firmware for both the modules and GW and running the latest mc-studio.

Resetting the GW, trying various ways to connect the module via mc-studio and erasing via the dongle seem to have no effect. The code started out as a learning experience for the reed switch
But, I have since whittled away most of that code trying to track down what is causing the error. The best I have so far it that after a random number of Lplan.Publish’s that error pops up.

mc-John

  • Global Moderator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Are you sure that you have loaded 372 on the mcMod110 or 411 on the mcMod120? It looks exactly at the error that has been solved in 372/411. This error is related to the GC and starts after a number of iterations.



kbrooking

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Yes, sure. Attached is an OTA screen shot showing the firmware version of one of the 120 that I get the error on.

mc-John

  • Global Moderator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
I will try to recreated the problem. This will take some time but I will keep you informed.

kbrooking

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Just wanted to check in to see if you were able to recreate the problem with the source code provided?

mc-John

  • Global Moderator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Not yet. I will have some time tomorrow though

kbrooking

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Just checking to see if you had a chance to try and reproduce the error?

mc-John

  • Global Moderator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
No but it could be a compiler error. I have to create an installer. Will do that Monday

kbrooking

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Any updates on this issue John?

kbrooking

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Just checking for any updates again