From c4000d6b75e0c8e9d02037421eb3263efa217d82 Mon Sep 17 00:00:00 2001 From: DashyFox Date: Wed, 14 Aug 2024 17:43:12 +0300 Subject: [PATCH] test --- IR-protocol.ino | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/IR-protocol.ino b/IR-protocol.ino index 051759a..3415397 100644 --- a/IR-protocol.ino +++ b/IR-protocol.ino @@ -4,8 +4,8 @@ #include "MemoryCheck.h" /////////////// Pinout /////////////// -#define encForward_PIN 5 -#define encBackward_PIN 6 +#define encForward_PIN 0 +#define encBackward_PIN 5 #define LoopOut 12 #define ISR_Out 10 @@ -32,9 +32,9 @@ void decForwardISR() { decForward.isr(); } -// void decBackwardISR() { -// decBackward.isr(); -// } +void decBackwardISR() { + decBackward.isr(); +} static uint8_t* portOut; ISR(TIMER2_COMPA_vect) { @@ -42,9 +42,9 @@ ISR(TIMER2_COMPA_vect) { // encBackward.isr(); // encTree.isr(); //TODO: Сделать выбор порта - *portOut = (*portOut & 0b11001111) | + *portOut = (*portOut & 0b11111110) | ( - encForward.ir_out_virtual << 5U + encForward.ir_out_virtual << 0U // | encBackward.ir_out_virtual << 6U // | encTree.ir_out_virtual << 2U ); @@ -60,7 +60,7 @@ uint32_t loopTimer; uint8_t sig = 0; uint16_t targetAddr = IR_Broadcast; -Timer t1(500, millis, []() { +Timer t1(750, millis, []() { // Serial.println(sig); @@ -151,7 +151,7 @@ Timer t2(500, millis, []() { ///////////////////////////////////////////////////////////////////// void setup() { IR_Encoder::timerSetup(); - portOut = &PORTD; + portOut = &PORTB; Serial.begin(SERIAL_SPEED); Serial.println(F(INFO)); @@ -182,7 +182,7 @@ void setup() { attachInterrupt(0, decForwardISR, CHANGE); // D2 - // attachInterrupt(1, decBackwardISR, CHANGE); // D3 + attachInterrupt(1, decBackwardISR, CHANGE); // D3 } void loop() { @@ -193,7 +193,7 @@ void loop() { decBackward.tick(); status(decForward); - // status(decBackward); + status(decBackward); // Serial.println(micros() - loopTimer); @@ -227,7 +227,7 @@ void loop() { //test void status(IR_Decoder& dec) { - if (dec.gotData.available()) { + if (dec.gotData.available() && dec.gotData.getAddrFrom() != 42) { String str; if (/* dec.gotData.getDataPrt()[1] */1) { str += ("Data on pin "); str += (dec.isrPin); str += "\n";