It runs my program normally but when I need to program it OTA, it does nothing, just continues to run the program.
When I place it safe mode, I can then program it.
Any ideas?
I am using SYSTEM_THREAD(ENABLED) and SYSTEM_MODE(SEMI_AUTOMATIC).
Since I am working with MQTT, I created a command “place in safe mode”.
After I sent that command, then electron goes into safe mode and then I can program it.
void loop() {
if (mqtt_client.isConnected()) {
mqtt_client.loop();
/*more code here, if, else, digitalWrite, sprintf, serial print*/
mqtt_client.publish("asdf", msg);
}
/*there are some other if/else statements, but program doesn't enter there*/
}
There is also one software timer that is running and it overflows every minute.
Do you think the mqtt_client.loop() may cause the problem?
I noticed something strange. The Particle cloud cannot ping my electron.
This is weird. In my loop() I have the following:
if (!Particle.connected()) {
debug_print(“Particle is not connected?n”);
Particle.connect();
waitUntil(Particle.connected);
}
And it never gets there.
So, how is this possible?
Not to change the subject, but have you tried dfu-util flashing? It’s more convenient if you’re working locally and it saves data in the long run because you won’t be flashing firmware OTA.
In Web IDE you should find a GitHub link for most libraries which will lead you to the contributors repository. There you can file an "issue" report.
In this case here GitHub - hirotakaster/MQTT: MQTT for Photon, Spark Core
Update:
I see you've already found that out yourself
I already did that, some hours ago, it is the last one.
But I am afraid that this is not only a library problem. Perhaps Particle has a small bug there.
On the other hand, perhaps it is only my fault
Something that bothers me is that I don’t see other people complaining about this. So perhaps they don’t see it because it does not happen to them. I suspect that I might be doing something completely wrong.
Is it possible for someone from this forum to verify this by running the mqtttest.ino from this library and then try to program it?
Thanks.
edit: So, in order to raise a bug issue in Particle, I would like a verification from someone here, it someone has time and doesn’t mind testing it, I would like to hear !
I, too, cannot flash OTA with units running MQTT. This is with 0.7.0. I haven’t tried the route of disconnecting from MQTT yet.
My $0.02 is that this seems like a bug which Particle should stay on top of, even if at its root cause it is due to bad behavior of the MQTT library. OTA seems like something which should be sacrosanct, with mechanisms in place to protect it from anything which would defeat it or otherwise prevent it from working.