Closed Peerke1 closed 3 years ago
I think you have to enable the watchdog interrupt after every execution
I have a lot of "OFF Message: 1" and "ON Message: 1" in the console. I have wireshark open at the same time and nothings enters there at the time of a new "XX Message: 1" (my swicth can do port-mirroring for ingress and egress traffic). I asumed the watchdog int would be working an firing the int every 8 sec as of the OFf and On messages or am i missing something here?
after some time i recieve a RST message from the broker, i would asume because of the lack of publish messages within the timeout. When i reset the Arduino it connects again and then same behaviour.
I removed the watchdog and added 2 - 20bit counters (uint32_t). When counter1 == 1 sent a message and when counter2 == 1sent a mesage. every =/- 5 sec there is a message sent. Same behaviour, only the first after init is sent out the ethernet interface.
can i see with some debug what is causing the packet not to be put on the wire? (i have a bit of coding experience, this goes beyond my knowledge)
// simple var counter
if (MqttRegisterCounter <= 1048576) {
if (MqttRegisterCounter == 1048576) {
Serial.println("MqttRegisterCounter at max");
}
MqttRegisterCounter = MqttRegisterCounter+1;
} else if (MqttRegisterCounter == 1048577) {
if (MqttRegisterCounter2 < 1048576) {
MqttRegisterCounter2 = MqttRegisterCounter2+1;
} else {
// reset all
MqttRegisterCounter = 0;
MqttRegisterCounter2 = 0;
Serial.println("Reset Counters");
}
} else{
Serial.println("Something unexpected happend");
}
try to add Ethernet.maintain();
as first in the loop()
working now!
Can Ethernet.maintain() stay there or do i need a specific part? i read that tis functions is mainly used for DHCP?
EthernetENC must handle all network traffic targeted to its MAC address and some broadcast packets too. EthernetENC uses every function of the library to do this. If your sketch doesn't call the functions of the library all the time (like with server.available() or client.available()), then put Ethernet.maintain(); as first in loop(). https://github.com/jandrassy/EthernetENC/wiki/Limitations
I have a Nano running withknolleary/pubsubclient (using a ENC28J60) connecting to HomeAssistent's add-on MQTT broker. I use Wireshark to monitor the network interface of the Nano. The code I am using in the Arduino as a test test-setup
The connect is sent, and the first publish message too, after that its quite in Wireshark. The response (rc) from mqttClient.publish in the serial.print is 1, where it looks like the publish made it to the broker. In Wireshark the packet is not there.
How can I see what actually happens when the publish is being executed?