Skip to content

Commit

Permalink
correct long press event sending and processing
Browse files Browse the repository at this point in the history
  • Loading branch information
pa-pa committed Nov 2, 2017
1 parent 8d0265b commit 1fef8c4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class Device {
virtual bool process(__attribute__((unused)) Message& msg) { return false; }

bool isBoardcastMsg(Message msg) {
return msg.isPairSerial() || ( msg.isBroadcast() && msg.isRemoteEvent() );
return (msg.to() == HMID::broadcast && msg.isPairSerial()) || ( msg.isBroadcast() && msg.isRemoteEvent() );
}

bool send(Message& msg,const HMID& to) {
Expand Down
3 changes: 0 additions & 3 deletions Message.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@ class Message {
flag |= BCAST;
flag &= ~BIDI;
}
else {
flag &= ~BCAST;
}
}

const HMID& to () const {
Expand Down
4 changes: 2 additions & 2 deletions MultiChannelDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class ChannelDevice : public Device<HalType,List0Type> {
void initDone () {
// trigger initial config changed - to allow scan/caching of list data
this->configChanged();
for( uint8_t cdx=1; cdx>=channels(); ++cdx ) {
for( uint8_t cdx=1; cdx<=channels(); ++cdx ) {
channel(cdx).configChanged();
}
}
Expand Down Expand Up @@ -210,7 +210,7 @@ class ChannelDevice : public Device<HalType,List0Type> {
ChannelType* ch = 0;
HMID devid;
this->getDeviceID(devid);
if( msg.to() == devid || (msg.to() == HMID::broadcast && this->isBoardcastMsg(msg))) {
if( msg.to() == devid || this->isBoardcastMsg(msg) ) {
// we got a message - we do not answer before 100ms
this->radio().setSendTimeout(100);
DPRINT(F("-> "));
Expand Down
6 changes: 3 additions & 3 deletions Remote.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ class RemoteChannel : public Channel<HALTYPE,RemoteList1,EmptyList,DefList4,PEER
void configChanged () {
peerself = false;
extpeer = 0xff;
for( int i=0; i<this->peers(); ++i ){
for( uint8_t i=0; i<this->peers(); ++i ){
Peer p = this->peer(i);
if( p.valid() == true ) {
if( this->device().isDeviceID(p) == true ) {
peerself |= true;
}
else {
extpeer = i; // store offset to an external peer
else if (extpeer == 0xff ) {
extpeer = i; // store offset to first external peer
}
}
}
Expand Down

0 comments on commit 1fef8c4

Please sign in to comment.