Fix inverted IR logic on the Non-plus Stick C

This commit is contained in:
Noah Axon 2023-10-08 10:01:45 -05:00
parent 379e10603f
commit 14b55df968
1 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,5 @@
// Nemo Firmware for the M5 Stack Stick C Plus // Nemo Firmware for the M5 Stack Stick C Plus
// github.com/n0xa | IG: @4x0nn // github.com/n0xa | IG: @4x0nn
#define PLUS
#if defined(PLUS) #if defined(PLUS)
#include <M5StickCPlus.h> #include <M5StickCPlus.h>
#define BIG_TEXT 4 #define BIG_TEXT 4
@ -469,8 +468,13 @@ void sendAllCodes()
for (uint8_t k = 0; k < numpairs; k++) { for (uint8_t k = 0; k < numpairs; k++) {
uint16_t ti; uint16_t ti;
ti = (read_bits(bitcompression)) * 2; ti = (read_bits(bitcompression)) * 2;
offtime = powerCode->times[ti]; // read word 1 - ontime #if defined(PLUS)
ontime = powerCode->times[ti + 1]; // read word 2 - offtime offtime = powerCode->times[ti]; // read word 1 - ontime
ontime = powerCode->times[ti + 1]; // read word 2 - offtime
#else
ontime = powerCode->times[ti]; // read word 1 - ontime
offtime = powerCode->times[ti + 1]; // read word 2 - offtime
#endif
M5.Lcd.setTextSize(TINY_TEXT); M5.Lcd.setTextSize(TINY_TEXT);
M5.Lcd.printf("rti = %d Pair = %d, %d\n", ti >> 1, ontime, offtime); M5.Lcd.printf("rti = %d Pair = %d, %d\n", ti >> 1, ontime, offtime);
rawData[k * 2] = offtime * 10; rawData[k * 2] = offtime * 10;
@ -478,8 +482,10 @@ void sendAllCodes()
yield(); yield();
} }
irsend.sendRaw(rawData, (numpairs * 2) , freq); irsend.sendRaw(rawData, (numpairs * 2) , freq);
// Hack: Set IRLED high to turn it off after each burst. Otherwise it stays on (active low) #if defined(PLUS)
digitalWrite(IRLED, HIGH); // Hack: Set IRLED high to turn it off after each burst. Otherwise it stays on (active low)
digitalWrite(IRLED, HIGH);
#endif
yield(); yield();
bitsleft_r = 0; bitsleft_r = 0;
delay_ten_us(20500); delay_ten_us(20500);