Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RX debug #230

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion RCSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static const RCSwitch::Protocol PROGMEM proto[] = {
{ 100, { 30, 71 }, { 4, 11 }, { 9, 6 }, false }, // protocol 3
{ 380, { 1, 6 }, { 1, 3 }, { 3, 1 }, false }, // protocol 4
{ 500, { 6, 14 }, { 1, 2 }, { 2, 1 }, false }, // protocol 5
{ 450, { 23, 1 }, { 1, 2 }, { 2, 1 }, true }, // protocol 6 (HT6P20B)
{ 450, { 23, 1 }, { 1, 2 }, { 2, 1 }, true }, // protocol 6 (HT6P20B)
{ 150, { 2, 62 }, { 1, 6 }, { 6, 1 }, false } // protocol 7 (HS2303-PT, i. e. used in AUKEY Remote)
};

Expand Down Expand Up @@ -677,6 +677,7 @@ void RECEIVE_ATTR RCSwitch::handleInterrupt() {
// with roughly the same gap between them).
repeatCount++;
if (repeatCount == 2) {
if (onRxBufferDebug) onRxBufferDebug(changeCount, RCSwitch::timings);
for(unsigned int i = 1; i <= numProto; i++) {
if (receiveProtocol(i, changeCount)) {
// receive succeeded for protocol i
Expand All @@ -698,4 +699,7 @@ void RECEIVE_ATTR RCSwitch::handleInterrupt() {
RCSwitch::timings[changeCount++] = duration;
lastTime = time;
}

void (*RCSwitch::onRxBufferDebug)(int, unsigned int*) = NULL;

#endif
10 changes: 8 additions & 2 deletions RCSwitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
#include "WProgram.h"
#endif

#define HAS_RC_ONRXBUFFER

#include <stdint.h>


Expand All @@ -58,7 +60,7 @@

// Number of maximum high/Low changes per packet.
// We can handle up to (unsigned long) => 32 bit * 2 H/L changes per bit + 2 for sync
#define RCSWITCH_MAX_CHANGES 67
#define RCSWITCH_MAX_CHANGES 131

class RCSwitch {

Expand Down Expand Up @@ -176,9 +178,13 @@ class RCSwitch {
* timings[0] contains sync timing, followed by a number of bits
*/
static unsigned int timings[RCSWITCH_MAX_CHANGES];

#ifdef HAS_RC_ONRXBUFFER
public:
static void (*onRxBufferDebug)(int count, unsigned int *timings);
#endif


#endif
};

#endif