mc-Things

mc-Products => mc-Module => Topic started by: kbrooking on November 26, 2016, 01:54:43 pm

Title: Cannot change the connection to another device in Run or Stopped mode?
Post by: kbrooking on November 26, 2016, 01:54:43 pm
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?



Title: Re: Cannot change the connection to another device in Run or Stopped mode?
Post by: kbrooking on November 26, 2016, 09:25:23 pm
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.
Title: Re: Cannot change the connection to another device in Run or Stopped mode?
Post by: mc-John on November 28, 2016, 09:47:00 am
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.


 
Title: Re: Cannot change the connection to another device in Run or Stopped mode?
Post by: kbrooking on November 28, 2016, 04:19:37 pm
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?
Title: Re: Cannot change the connection to another device in Run or Stopped mode?
Post by: mc-John on November 28, 2016, 06:20:34 pm
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.
Title: Re: Cannot change the connection to another device in Run or Stopped mode?
Post by: kbrooking on November 28, 2016, 07:45:42 pm
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.
Title: Re: Cannot change the connection to another device in Run or Stopped mode?
Post by: mc-John on November 28, 2016, 09:47:48 pm
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.


Title: Re: Cannot change the connection to another device in Run or Stopped mode?
Post by: kbrooking on November 29, 2016, 08:48:32 am
Yes, sure. Attached is an OTA screen shot showing the firmware version of one of the 120 that I get the error on.
Title: Re: Cannot change the connection to another device in Run or Stopped mode?
Post by: mc-John on November 29, 2016, 10:58:45 am
I will try to recreated the problem. This will take some time but I will keep you informed.
Title: Re: Cannot change the connection to another device in Run or Stopped mode?
Post by: kbrooking on December 05, 2016, 02:53:38 pm
Just wanted to check in to see if you were able to recreate the problem with the source code provided?
Title: Re: Cannot change the connection to another device in Run or Stopped mode?
Post by: mc-John on December 06, 2016, 09:24:56 pm
Not yet. I will have some time tomorrow though
Title: Re: Cannot change the connection to another device in Run or Stopped mode?
Post by: kbrooking on December 09, 2016, 08:54:05 am
Just checking to see if you had a chance to try and reproduce the error?
Title: Re: Cannot change the connection to another device in Run or Stopped mode?
Post by: mc-John on December 11, 2016, 10:38:59 am
No but it could be a compiler error. I have to create an installer. Will do that Monday
Title: Re: Cannot change the connection to another device in Run or Stopped mode?
Post by: kbrooking on December 20, 2016, 03:54:11 pm
Any updates on this issue John?
Title: Re: Cannot change the connection to another device in Run or Stopped mode?
Post by: kbrooking on December 29, 2016, 12:54:13 pm
Just checking for any updates again
Title: Re: Cannot change the connection to another device in Run or Stopped mode?
Post by: mc-John on December 29, 2016, 04:51:38 pm
I was out of the office for 2 weeks but I am back and I actually looked into this today. The problem is that the device resets during publish. There are something like 10 things that can reset the device. It is also strange that other users don't have this problem. I need to talk to somebody else on the team to see how we can tackle this.
It could be something completely unrelated and I am going into the wrong direction and it is another error. We just have solved a large number of connection issues in our last release and you should try to install that. (mc-OTA, mc-Module and mc-Gateway host) If something goes wrong in the connection the system resets to so it is good to try it out.
Because the person I need to talk to is back next Tuesday, you should try the latest version and let me know if that solves the problem. If not than I will discuss the issue further with my college on Tuesday.
Title: Re: Cannot change the connection to another device in Run or Stopped mode?
Post by: Nick_W on January 04, 2017, 08:34:22 pm
Interesting, I was having this same problem, but it only happens during debugging (at least you can only see the error then).

So I was just avoiding debugging, and accepting that we still get random reboots. I updated to the latest firmware yesterday, and while I haven't tried debugging yet, my modules are still publishing with no reboots so far.

The longest module has been publishing now for 1 day 7 hours without a reset - a new record!

I'll test the debugging tomorrow and see how it goes. I'm also testing the 120 module battery life, with high hopes.
Title: Re: Cannot change the connection to another device in Run or Stopped mode?
Post by: kbrooking on January 04, 2017, 10:49:05 pm
Yep, I check for updates daily and make sure I'm always running the latest version of everything. I also noticed that with the latest 120 firmware and host processor it seems the modules are having a lot problems connecting. I don't recall having this problem prior to the new firmware release.