Update IRRemoteESP8266 version to 2.5.5

factorize IR send signal function between the 2 types of receiving
Add new IRRemoteESP8266 protocols
replace pins on mega according schema
remove unecessaries spaces
This commit is contained in:
Florian committed 2019-02-08 16:50:37 +01:00
1 parent 0180a0dbd5
commit f0305236db
149 files changed
+20957 -7850

No files matched your search

+15 -16
View File
@@ -14,12 +14,12 @@
// (http://www.hishamkhalifa.com)
// Constants
#define GLOBALCACHE_MAX_REPEAT 50U
#define GLOBALCACHE_MIN_USEC 80U
#define GLOBALCACHE_FREQ_INDEX 0U
#define GLOBALCACHE_RPT_INDEX GLOBALCACHE_FREQ_INDEX + 1U
#define GLOBALCACHE_RPT_START_INDEX GLOBALCACHE_RPT_INDEX + 1U
#define GLOBALCACHE_START_INDEX GLOBALCACHE_RPT_START_INDEX + 1U
const uint16_t kGlobalCacheMaxRepeat = 50;
const uint32_t kGlobalCacheMinUsec = 80;
const uint8_t kGlobalCacheFreqIndex = 0;
const uint8_t kGlobalCacheRptIndex = kGlobalCacheFreqIndex + 1;
const uint8_t kGlobalCacheRptStartIndex = kGlobalCacheRptIndex + 1;
const uint8_t kGlobalCacheStartIndex = kGlobalCacheRptStartIndex + 1;
#if SEND_GLOBALCACHE
// Send a shortened GlobalCache (GC) IRdb/control tower formatted message.
@@ -40,24 +40,23 @@
// Ref:
// https://irdb.globalcache.com/Home/Database
void IRsend::sendGC(uint16_t buf[], uint16_t len) {
uint16_t hz = buf[GLOBALCACHE_FREQ_INDEX]; // GC frequency is in Hz.
uint16_t hz = buf[kGlobalCacheFreqIndex]; // GC frequency is in Hz.
enableIROut(hz);
uint32_t periodic_time = calcUSecPeriod(hz, false);
uint8_t emits = std::min(buf[GLOBALCACHE_RPT_INDEX],
(uint16_t) GLOBALCACHE_MAX_REPEAT);
uint8_t emits =
std::min(buf[kGlobalCacheRptIndex], (uint16_t)kGlobalCacheMaxRepeat);
// Repeat
for (uint8_t repeat = 0; repeat < emits; repeat++) {
// First time through, start at the beginning (GLOBALCACHE_START_INDEX),
// First time through, start at the beginning (kGlobalCacheStartIndex),
// otherwise for repeats, we start a specified offset from that.
uint16_t offset = GLOBALCACHE_START_INDEX;
if (repeat)
offset += buf[GLOBALCACHE_RPT_START_INDEX] - 1;
uint16_t offset = kGlobalCacheStartIndex;
if (repeat) offset += buf[kGlobalCacheRptStartIndex] - 1;
// Data
for (; offset < len; offset++) {
// Convert periodic units to microseconds.
// Minimum is GLOBALCACHE_MIN_USEC for actual GC units.
uint32_t microseconds = std::max(buf[offset] * periodic_time,
GLOBALCACHE_MIN_USEC);
// Minimum is kGlobalCacheMinUsec for actual GC units.
uint32_t microseconds =
std::max(buf[offset] * periodic_time, kGlobalCacheMinUsec);
// These codes start at an odd index (not even as with sendRaw).
if (offset & 1) // Odd bit.
mark(microseconds);