Skip to content

Commit 839ad50

Browse files
authored
[bugfix] GlobalCache incorrectly using hardware offset for period calc. (#267)
GlobalCache was using the calc period time function incorrectly causing all mark & spaces it issued to be approx 10% too short. Fixes #266
1 parent 5f2c202 commit 839ad50

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/ir_GlobalCache.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
void IRsend::sendGC(uint16_t buf[], uint16_t len) {
4444
uint16_t hz = buf[GLOBALCACHE_FREQ_INDEX]; // GC frequency is in Hz.
4545
enableIROut(hz);
46-
uint32_t periodic_time = calcUSecPeriod(hz);
46+
uint32_t periodic_time = calcUSecPeriod(hz, false);
4747
uint8_t emits = std::min(buf[GLOBALCACHE_RPT_INDEX],
4848
(uint16_t) GLOBALCACHE_MAX_REPEAT);
4949
// Repeat

test/ir_GlobalCache_test.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ TEST(TestSendGlobalCache, NonRepeatingCode) {
2222
21, 22, 21, 65, 21, 1519};
2323
irsend.sendGC(gc_test, 71);
2424
irsend.makeDecodeResult();
25-
EXPECT_EQ("m7866s3956m483s506m483s483m483s1495m483s483m483s506m483s506"
26-
"m483s483m483s506m483s1495m483s1495m483s506m483s1495m483s1495"
27-
"m483s1495m483s1495m483s1495m483s1495m483s506m483s506m483s483"
28-
"m483s506m483s506m483s1495m483s506m483s483m483s1495m483s1495"
29-
"m483s1495m483s1472m506s1495m483s506m483s1495m483s34937",
25+
EXPECT_EQ("m8892s4472m546s572m546s546m546s1690m546s546m546s572m546s572"
26+
"m546s546m546s572m546s1690m546s1690m546s572m546s1690m546s1690"
27+
"m546s1690m546s1690m546s1690m546s1690m546s572m546s572m546s546"
28+
"m546s572m546s572m546s1690m546s572m546s546m546s1690m546s1690"
29+
"m546s1690m546s1664m572s1690m546s572m546s1690m546s39494",
3030
irsend.outputStr());
3131
EXPECT_TRUE(irrecv.decodeNEC(&irsend.capture));
3232
EXPECT_EQ(NEC, irsend.capture.decode_type);
@@ -52,13 +52,13 @@ TEST(TestSendGlobalCache, RepeatCode) {
5252
64, 21, 64, 21, 64, 21, 1600, 341, 85, 21, 3647};
5353
irsend.sendGC(gc_test, 75);
5454
irsend.makeDecodeResult();
55-
EXPECT_EQ("m7843s3933m483s1472m483s1472m483s483m483s483m483s483m483s483"
56-
"m483s483m483s1472m483s1472m483s483m483s1472m483s483m483s483"
57-
"m483s483m483s1472m483s483m483s1472m483s483m483s483m483s483"
58-
"m483s1472m483s483m483s483m483s483m483s483m483s1472m483s1472"
59-
"m483s1472m483s483m483s1472m483s1472m483s1472m483s36800"
60-
"m7843s1955m483s83881"
61-
"m7843s1955m483s83881", irsend.outputStr());
55+
EXPECT_EQ("m8866s4446m546s1664m546s1664m546s546m546s546m546s546m546s546"
56+
"m546s546m546s1664m546s1664m546s546m546s1664m546s546m546s546"
57+
"m546s546m546s1664m546s546m546s1664m546s546m546s546m546s546"
58+
"m546s1664m546s546m546s546m546s546m546s546m546s1664m546s1664"
59+
"m546s1664m546s546m546s1664m546s1664m546s1664m546s41600"
60+
"m8866s2210m546s94822"
61+
"m8866s2210m546s94822", irsend.outputStr());
6262
EXPECT_TRUE(irrecv.decodeNEC(&irsend.capture));
6363
EXPECT_EQ(NEC, irsend.capture.decode_type);
6464
EXPECT_EQ(NEC_BITS, irsend.capture.bits);

0 commit comments

Comments
 (0)