From ce6113e9b482225785d7c22599409e76a0baa2e9 Mon Sep 17 00:00:00 2001 From: pa-pa <(none)> Date: Mon, 16 Jul 2018 21:22:01 +0200 Subject: [PATCH] use transmitDevTryMax in send loop do not process message with own HMID from radio --- ChannelList.h | 3 +++ Device.h | 6 ++++-- examples/HM-ES-TX-WM/HM-ES-TX-WM.ino | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChannelList.h b/ChannelList.h index fd2a3e2d..b5320e46 100644 --- a/ChannelList.h +++ b/ChannelList.h @@ -232,6 +232,9 @@ class List0 : public ChannelList { setByte(2,0x00); setByte(3,0x00); } + + uint8_t transmitDevTryMax () const { return 6; } + }; diff --git a/Device.h b/Device.h index 32871303..f4ef7aae 100644 --- a/Device.h +++ b/Device.h @@ -198,7 +198,9 @@ class Device { bool pollRadio () { uint8_t num = radio().read(msg); - if( num >= 10 ) { // minimal msg is 10 byte + // minimal msg is 10 byte + // ignore own messages from radio + if( num >= 10 && isDeviceID(msg.from()) == false ) { return process(msg); } return false; @@ -225,7 +227,7 @@ class Device { bool send(Message& msg) { bool result = false; - uint8_t maxsend = 6; + uint8_t maxsend = list0.transmitDevTryMax(); led().set(LedStates::send); while( result == false && maxsend > 0 ) { result = radio().write(msg,msg.burstRequired()); diff --git a/examples/HM-ES-TX-WM/HM-ES-TX-WM.ino b/examples/HM-ES-TX-WM/HM-ES-TX-WM.ino index b8fbdd51..7614c38d 100644 --- a/examples/HM-ES-TX-WM/HM-ES-TX-WM.ino +++ b/examples/HM-ES-TX-WM/HM-ES-TX-WM.ino @@ -111,6 +111,8 @@ public: uint8_t samplesPerCycle () const { return getByte(sizeof(List0Data) + 5); } bool samplesPerCycle (uint8_t value) const { return setByte(sizeof(List0Data) + 5,value); } + uint8_t transmitDevTryMax () const { return 6; } + void defaults () { ((List0*)this)->defaults(); }