@robvk said in MySensors 2.3 and RFM69 new driver. Problems and solutions:
#define MY_PASSIVE_NODE
Oh no I totally missed this line! This statement disables ACK and other transport-related stuff. Case closed.
@robvk said in MySensors 2.3 and RFM69 new driver. Problems and solutions:
#define MY_PASSIVE_NODE
Oh no I totally missed this line! This statement disables ACK and other transport-related stuff. Case closed.
I have been struggling with sending multiple messages and came across this topic. I disabled the software-ACK but still when sending multiple messages without a wait(100) in between many of them fail.
Even if send() returns true the gateway doesnt seem to receive or proces the message.
By accident I also discovered that if a make the node sleep(1) between messages they all arrive.
I have an Arduino-node and a Wemos MQTT-gateway.
Node:
#define MY_DEBUG
#define MY_PASSIVE_NODE
#define MY_NODE_ID 60
#define MY_RADIO_RFM69
#define MY_RFM69_NEW_DRIVER
#define MY_RFM69_FREQUENCY RFM69_868MHZ // Set your frequency here
#define VERSION "v001.0"
//limit time to wait for connection to GW
#define MY_TRANSPORT_WAIT_READY_MS 3000
#include <MySensors.h>
#define cnt_CHILD 0
MyMessage cntMsg(cnt_CHILD, V_VAR1);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);
}
void presentation() {
sendSketchInfo("Count RFM69", VERSION);
present(cnt_CHILD, S_CUSTOM, "", true);
}
void loop() {
int cnt=1;
for(int cnt=0;cnt<100;cnt++)
{
cntMsg.set(cnt, 2);
resend(cntMsg, 3);
//wait(100);
//sleep(1);
}
sleep(5000);
}
void resend(MyMessage &msg, int repeats) {
int repeat = 1;
const int repeatDelay = 100;
boolean sendOK = false;
while ((sendOK == false) and (repeat <= repeats)) {
if (send(msg) == true) {
sendOK = true;
Serial.println("Send OK!");
} else {
sendOK = false;
Serial.print(F("Send error: "));
Serial.println(repeat);
repeat++;
wait(repeatDelay);
}
}
}
Node log:
15:32:54.437 -> 137299 MCO:SLP:WUP=-1
15:32:54.437 -> 137302 TSF:TRI:TSB
15:32:54.437 -> 137312 ?TSF:MSG:SEND,60-60-255-0,s=0,c=1,t=24,pt=7,l=5,sg=0,ft=0,st=OK:0.00
15:32:54.437 -> Send OK!
15:32:54.437 -> 137328 ?TSF:MSG:SEND,60-60-255-0,s=0,c=1,t=24,pt=7,l=5,sg=0,ft=0,st=OK:1.00
15:32:54.437 -> Send OK!
15:32:54.470 -> 137345 ?TSF:MSG:SEND,60-60-255-0,s=0,c=1,t=24,pt=7,l=5,sg=0,ft=0,st=OK:2.00
15:32:54.470 -> Send OK!
15:32:54.470 -> 137361 ?TSF:MSG:SEND,60-60-255-0,s=0,c=1,t=24,pt=7,l=5,sg=0,ft=0,st=OK:3.00
15:32:54.470 -> Send OK!
15:32:54.470 -> 137377 ?TSF:MSG:SEND,60-60-255-0,s=0,c=1,t=24,pt=7,l=5,sg=0,ft=0,st=OK:4.00
15:32:54.470 -> Send OK!
15:32:54.470 -> 137394 ?TSF:MSG:SEND,60-60-255-0,s=0,c=1,t=24,pt=7,l=5,sg=0,ft=0,st=OK:5.00
15:32:54.470 -> Send OK!
15:32:54.504 -> 137412 ?TSF:MSG:SEND,60-60-255-0,s=0,c=1,t=24,pt=7,l=5,sg=0,ft=0,st=OK:6.00
15:32:54.504 -> Send OK!
(and so on until 99)
Gateway:
15:32:54.449 -> 1538573 TSF:MSG:READ,60-60-0,s=0,c=1,t=24,pt=7,l=5,sg=0:0.00
15:32:54.449 -> 1538579 GWT:TPS:TOPIC=868gateway/out/60/0/1/0/24,MSG SENT
15:32:54.449 -> 1538589 TSF:MSG:READ,60-60-0,s=0,c=1,t=24,pt=7,l=5,sg=0:2.00
15:32:54.449 -> 1538595 GWT:TPS:TOPIC=868gateway/out/60/0/1/0/24,MSG SENT
15:32:54.483 -> 1538606 TSF:MSG:READ,60-60-0,s=0,c=1,t=24,pt=7,l=5,sg=0:4.00
15:32:54.483 -> 1538611 GWT:TPS:TOPIC=868gateway/out/60/0/1/0/24,MSG SENT
15:32:54.483 -> 1538622 TSF:MSG:READ,60-60-0,s=0,c=1,t=24,pt=7,l=5,sg=0:6.00
15:32:54.483 -> 1538628 GWT:TPS:TOPIC=868gateway/out/60/0/1/0/24,MSG SENT
and so on...