Skip to content

Commit

Permalink
oops
Browse files Browse the repository at this point in the history
  • Loading branch information
Unreal-Dan committed Dec 28, 2023
1 parent 0cd4840 commit dacd0bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
4 changes: 2 additions & 2 deletions VortexEngine/src/Wireless/IRConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#define IR_DIVIDER_SPACE_MIN IR_HEADER_MARK_MIN
#define IR_DIVIDER_SPACE_MAX IR_HEADER_MARK_MAX

#define IR_SEND_PWM_PIN 6
#define IR_RECEIVER_PIN 7
#define IR_SEND_PWM_PIN 0
#define IR_RECEIVER_PIN 2

#endif
18 changes: 0 additions & 18 deletions VortexEngine/src/Wireless/IRReceiver.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "IRReceiver.h"
#include "IRConfig.h"
#include "../Serial/Serial.h"

#if IR_ENABLE_RECEIVER == 1

Expand All @@ -10,10 +9,6 @@
#include "../Modes/Mode.h"
#include "../Log/Log.h"

#ifdef VORTEX_EMBEDDED
#include <Arduino.h>
#endif

BitStream IRReceiver::m_irData;
IRReceiver::RecvState IRReceiver::m_recvState = WAITING_HEADER_MARK;
uint32_t IRReceiver::m_prevTime = 0;
Expand All @@ -22,9 +17,6 @@ uint32_t IRReceiver::m_previousBytes = 0;

bool IRReceiver::init()
{
#ifdef VORTEX_EMBEDDED
pinMode(IR_RECEIVER_PIN, INPUT_PULLUP);
#endif
m_irData.init(IR_RECV_BUF_SIZE);
return true;
}
Expand Down Expand Up @@ -91,18 +83,12 @@ bool IRReceiver::receiveMode(Mode *pMode)

bool IRReceiver::beginReceiving()
{
#ifdef VORTEX_EMBEDDED
attachInterrupt(digitalPinToInterrupt(IR_RECEIVER_PIN), IRReceiver::recvPCIHandler, CHANGE);
#endif
resetIRState();
return true;
}

bool IRReceiver::endReceiving()
{
#ifdef VORTEX_EMBEDDED
detachInterrupt(digitalPinToInterrupt(IR_RECEIVER_PIN));
#endif
resetIRState();
return true;
}
Expand Down Expand Up @@ -181,7 +167,6 @@ void IRReceiver::handleIRTiming(uint32_t diff)
DEBUG_LOGF("Bad header mark %u, resetting...", diff);
resetIRState();
}
SerialComs::write("header mark\n");
break;
case WAITING_HEADER_SPACE:
if (diff >= IR_HEADER_SPACE_MIN && diff <= IR_HEADER_SPACE_MAX) {
Expand All @@ -190,18 +175,15 @@ void IRReceiver::handleIRTiming(uint32_t diff)
DEBUG_LOGF("Bad header space %u, resetting...", diff);
resetIRState();
}
SerialComs::write("header space\n");
break;
case READING_DATA_MARK:
// classify mark/space based on the timing and write into buffer
m_irData.write1Bit((diff > (IR_TIMING * 2)) ? 1 : 0);
m_recvState = READING_DATA_SPACE;
SerialComs::write("data mark\n");
break;
case READING_DATA_SPACE:
// the space could be just a regular space, or a gap in between blocks
m_recvState = READING_DATA_MARK;
SerialComs::write("data space\n");
break;
default: // ??
DEBUG_LOGF("Bad receive state: %u", m_recvState);
Expand Down

0 comments on commit dacd0bc

Please sign in to comment.