Skip to content

Commit

Permalink
use transmitDevTryMax in send loop
Browse files Browse the repository at this point in the history
do not process message with own HMID from radio
  • Loading branch information
pa-pa committed Jul 16, 2018
1 parent 01c4fcf commit ce6113e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ChannelList.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ class List0 : public ChannelList<List0Data> {
setByte(2,0x00);
setByte(3,0x00);
}

uint8_t transmitDevTryMax () const { return 6; }

};


Expand Down
6 changes: 4 additions & 2 deletions Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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());
Expand Down
2 changes: 2 additions & 0 deletions examples/HM-ES-TX-WM/HM-ES-TX-WM.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit ce6113e

Please sign in to comment.