удалила лишнее, протестировала

This commit is contained in:
klassents committed 2025-01-25 10:33:14 +07:00
1 parent e7df17c21e
commit 085021b2f7
10 files changed
+87 -277

No files matched your search

@@ -32,7 +32,11 @@
#define USE_TINY_IR_RECEIVER // Recommended, but only for NEC protocol!!! If disabled and IRMP_INPUT_PIN is defined, the IRMP library is used for decoding
//#define TINY_RECEIVER_USE_ARDUINO_ATTACH_INTERRUPT // Requires additional 112 bytes program memory + 4 bytes RAM
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
//#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#define IR_RECEIVE_PIN 2
#define TONE_PIN 3
// Some kind of auto detect library if USE_TINY_IR_RECEIVER is deactivated
#if !defined(USE_TINY_IR_RECEIVER)
# if defined(IR_RECEIVE_PIN)
@@ -55,9 +59,6 @@
*/
#define IR_RECEIVE_PIN 2
#define IRMP_USE_COMPLETE_CALLBACK 1 // Enable callback functionality. It is required if IRMP library is used.
#if defined(ALTERNATIVE_IR_FEEDBACK_LED_PIN)
#define FEEDBACK_LED_PIN ALTERNATIVE_IR_FEEDBACK_LED_PIN
#endif
//#define IRMP_ENABLE_PIN_CHANGE_INTERRUPT // Enable interrupt functionality (not for all protocols) - requires around 376 additional bytes of program memory
@@ -66,9 +67,6 @@
#define IRMP_SUPPORT_NEC_PROTOCOL 1 // this enables only one protocol
//#define IRMP_SUPPORT_KASEIKYO_PROTOCOL 1
# if defined(ALTERNATIVE_IR_FEEDBACK_LED_PIN)
#define IRMP_FEEDBACK_LED_PIN ALTERNATIVE_IR_FEEDBACK_LED_PIN
# endif
/*
* After setting the definitions we can include the code and compile it.
*/
@@ -108,18 +106,10 @@ void doTone2200();
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200);
Serial.begin(9600);
while (!Serial)
; // Wait for Serial to become available. Is optimized away for some cores.
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/ \
|| defined(SERIALUSB_PID) || defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_attiny3217)
delay(4000); // To be able to connect Serial monitor after reset or power up and before first print out. Do not wait for an attached Serial Monitor!
#endif
#if defined(ESP8266)
Serial.println(); // to separate it from the internal boot output
#endif
// Just to know which program is running on my Arduino
#if defined(USE_TINY_IR_RECEIVER)
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing TinyIRReceiver"));
@@ -144,11 +134,6 @@ void setup() {
Serial.print(F("Ready to receive IR signals of protocols: "));
irmp_print_active_protocols(&Serial);
Serial.println(F("at pin " STR(IRMP_INPUT_PIN)));
# if defined(ALTERNATIVE_IR_FEEDBACK_LED_PIN)
irmp_irsnd_LEDFeedback(true); // Enable receive signal feedback at ALTERNATIVE_IR_FEEDBACK_LED_PIN
Serial.println(F("IR feedback pin is " STR(ALTERNATIVE_IR_FEEDBACK_LED_PIN)));
# endif
#endif
Serial.print(F("Listening to commands of IR remote of type "));
@@ -261,22 +246,6 @@ void doTone2200() {
* It currently disables the receiving of repeats
*/
void irmp_tone(uint8_t _pin, unsigned int frequency, unsigned long duration) {
# if defined(__AVR__) && !defined(IRMP_ENABLE_PIN_CHANGE_INTERRUPT)
storeIRTimer();
tone(_pin, frequency, 0);
if (duration == 0) {
duration = 100;
}
delay(duration);
noTone(_pin);
restoreIRTimer();
#elif defined(ESP8266)
// tone() stops timer 1
(void) _pin;
(void) frequency;
(void) duration;
#else
tone(_pin, frequency, duration);
#endif
}
#endif // #if defined(USE_IRMP_LIBRARY)