Skip to content

Commit 4d44d05

Browse files
committed
Fix errors if LED_BUILTIN is not defined
1 parent b494e0a commit 4d44d05

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

src/IRSend.cpp.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ void IRsend::begin(bool aEnableLEDFeedback, uint8_t aLEDFeedbackPin) {
7777
&& !(defined(NRF5) || defined(ARDUINO_ARCH_NRF52840)) && !defined(ARDUINO_ARCH_SAMD) \
7878
&& !defined(ESP32) && !defined(ESP8266) && !defined(MEGATINYCORE) \
7979
&& !(defined(__STM32F1__) || defined(ARDUINO_ARCH_STM32F1)) && !(defined(STM32F1xx) || defined(ARDUINO_ARCH_STM32))
80+
/*
81+
* This error shows up, if this function is really used/called by the user program. This check works only if lto is enabled.
82+
*/
8083
UsageError(
8184
"Error: You must use begin(<sendPin>, <EnableLEDFeedback>, <LEDFeedbackPin>) if SEND_PWM_BY_TIMER is not defined or USE_NO_SEND_PWM is defined!");
8285
#endif

src/IRremoteInt.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ struct irparams_struct {
105105
# define TRACE_PRINTLN(...) void()
106106
#endif
107107

108+
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
109+
#define COMPILER_HAS_PRAGMA_MESSAGE
110+
#endif
111+
108112
/****************************************************
109113
* RECEIVING
110114
****************************************************/

src/private/IRFeedbackLEDDefs.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@
3737
#define FEEDBACK_LED_ON() (PORTC |= B10000000)
3838
#define FEEDBACK_LED_OFF() (PORTC &= B01111111)
3939

40-
#elif defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega8U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega32U2__)
41-
#define FEEDBACK_LED_ON() (digitalWrite(LED_BUILTIN, HIGH))
42-
#define FEEDBACK_LED_OFF() (digitalWrite(LED_BUILTIN, LOW))
43-
4440
// Arduino Uno, Nano etc
4541
#elif defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328PB__) || defined(__AVR_ATmega168__)
4642
#define FEEDBACK_LED_ON() (PORTB |= B00100000)
@@ -64,8 +60,8 @@
6460

6561
#elif defined(PARTICLE)
6662
#define LED_BUILTIN D7
67-
#define FEEDBACK_LED_ON() digitalWrite(LED_BUILTIN,1)
68-
#define FEEDBACK_LED_OFF() digitalWrite(LED_BUILTIN,0)
63+
#define FEEDBACK_LED_ON() digitalWrite(LED_BUILTIN, 1)
64+
#define FEEDBACK_LED_OFF() digitalWrite(LED_BUILTIN, 0)
6965

7066
// Arduino Zero and BluePill and ESP8266 have an LED which is active low
7167
#elif defined(__STM32F1__) || defined(STM32F1xx) || defined(ESP8266)
@@ -76,9 +72,10 @@
7672
/*
7773
* Default case suitable for most boards
7874
*/
75+
# if defined(LED_BUILTIN)
7976
#define FEEDBACK_LED_ON() digitalWrite(LED_BUILTIN, HIGH)
8077
#define FEEDBACK_LED_OFF() digitalWrite(LED_BUILTIN, LOW)
81-
# ifndef LED_BUILTIN
78+
# else
8279
/*
8380
* print a warning
8481
*/

0 commit comments

Comments
 (0)