Merge pull request #10301 from s-hadinger/ir_add_compile_options

Add IR_SEND_INVERTED and IR_SEND_USE_MODULATION compile options
This commit is contained in:
Theo Arends 2020-12-29 10:50:49 +01:00 committed by GitHub
commit 2278d5894e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -719,6 +719,10 @@
// -- IR Remote features - subset of IR protocols --------------------------
#define USE_IR_REMOTE // Send IR remote commands using library IRremoteESP8266 and ArduinoJson (+4k3 code, 0k3 mem, 48 iram)
#define IR_SEND_INVERTED false // Invert the output. (default = false) e.g. LED is illuminated when GPIO is LOW rather than HIGH.
// Setting inverted to something other than the default could easily destroy your IR LED if you are overdriving it.
// Unless you REALLY know what you are doing, don't change this.
#define IR_SEND_USE_MODULATION true // Do we do frequency modulation during transmission? i.e. If not, assume a 100% duty cycle.
#define USE_IR_SEND_NEC // Support IRsend NEC protocol
#define USE_IR_SEND_RC5 // Support IRsend Philips RC5 protocol
#define USE_IR_SEND_RC6 // Support IRsend Philips RC6 protocol

View File

@ -128,7 +128,7 @@ IRsend *irsend = nullptr;
void IrSendInit(void)
{
irsend = new IRsend(Pin(GPIO_IRSEND)); // an IR led is at GPIO_IRSEND
irsend = new IRsend(Pin(GPIO_IRSEND), IR_SEND_INVERTED, IR_SEND_USE_MODULATION); // an IR led is at GPIO_IRSEND
irsend->begin();
}

View File

@ -136,7 +136,7 @@ StateModes strToStateMode(class JsonParserToken token, StateModes def); // decla
void IrSendInit(void)
{
irsend = new IRsend(Pin(GPIO_IRSEND)); // an IR led is at GPIO_IRSEND
irsend = new IRsend(Pin(GPIO_IRSEND), IR_SEND_INVERTED, IR_SEND_USE_MODULATION); // an IR led is at GPIO_IRSEND
irsend->begin();
}
@ -470,7 +470,7 @@ uint32_t IrRemoteCmndIrHvacJson(void)
if (!IR_RCV_WHILE_SENDING && (irrecv != nullptr)) { irrecv->disableIRIn(); }
if (stateMode == StateModes::SEND_ONLY || stateMode == StateModes::SEND_STORE) {
IRac ac(Pin(GPIO_IRSEND));
IRac ac(Pin(GPIO_IRSEND), IR_SEND_INVERTED, IR_SEND_USE_MODULATION);
bool success = ac.sendAc(state, irhvac_stateful && irac_prev_state.protocol == state.protocol ? &irac_prev_state : nullptr);
if (!success) { return IE_SYNTAX_IRHVAC; }
}