IRSEND with SONY type and 3 times repeat
Posted: 15 May 2018, 15:59
Hi,
I would like to understand how to send IR remote in http with 3 times repeat for sony device ?
On Arduino UNO :
Work perfectly
If I use :
It is working with my samsumg device:
On _P035_IRTX.ino
On IRremoteESP8266.h
Why on the cpp file there is the repeat option but not on header nor ino ?
My ESPEasy version v2.0-20180322
I would like to understand how to send IR remote in http with 3 times repeat for sony device ?
On Arduino UNO :
Code: Select all
#include <IRremote.h>
IRsend irsend;
void setup()
{
}
void loop() {
for (int i = 0; i < 3; i++) {
irsend.sendSony(0xa81, 12);
delay(40);
}
delay(5000); //5 second delay between each signal burst
}
If I use :
Or:192.168.0.131/control?cmd=IRSEND,SONY,a81,12
Not working ....192.168.0.131/control?cmd=IRSEND,SONY,a81,12,2
It is working with my samsumg device:
I check on IRremoteESP8266.cpp
Code: Select all
void ICACHE_FLASH_ATTR IRsend::sendSony(unsigned long data, int nbits,
unsigned int repeat) {
// Send an IR command to a compatible Sony device.
//
// Args:
// data: IR command to be sent.
// nbits: Nr. of bits of the IR command to be sent.
// repeat: Nr. of additional times the IR command is to be sent.
//
// sendSony() should typically be called with repeat=2 as Sony devices
// expect the code to be sent at least 3 times.
//
// Timings and details are taken from:
// http://www.sbprojects.com/knowledge/ir/sirc.php
enableIROut(40); // Sony devices use a 40kHz IR carrier frequency.
IRtimer usecs = IRtimer();
for (uint16_t i = 0; i <= repeat; i++) { // Typically loop 3 or more times.
usecs.reset();
// Header
mark(SONY_HDR_MARK);
space(SONY_HDR_SPACE);
// Data
sendData(SONY_ONE_MARK, SONY_HDR_SPACE, SONY_ZERO_MARK, SONY_HDR_SPACE,
data, nbits, true);
// Footer
// The Sony protocol requires us to wait 45ms from start of a code to the
// start of the next one. A 10ms minimum gap is also required.
space(max(10000u, 45000 - usecs.elapsed()));
}
// A space() is always performed last, so no need to turn off the LED.
}
Code: Select all
if (IrType.equalsIgnoreCase(F("SONY"))) Plugin_035_irSender->sendSony(IrCode, IrBits);
Code: Select all
#define SEND_PROTOCOL_SONY case SONY: sendSony(data, nbits); break;
My ESPEasy version v2.0-20180322