IRMP-org / IRMP

Infrared Multi Protocol Decoder
GNU General Public License v3.0
267 stars 43 forks source link

Transmit creates junk (Flipper sees it as RAW) for NEC protocol #88

Closed supaplextor closed 4 months ago

supaplextor commented 5 months ago

Bug Report

Board

IDE

IR-Protocol

Example to reproduce the issue

Version

Pin(s) used for IR-receive, if not default

#define IRMP_INPUT_PIN   33

define IRSND_OUTPUT_PIN 9

M5StickC has an I/R pair attached but I'm using the onboard IR for transmit.

Current behavior

https://gist.github.com/supaplextor/84deec2fc697b87f4ae17be48bb56dca

When I use button A or B to transmit, FlipperZero sees the IR as raw not NEC like the OEM remote uses.

checklist:

We will start to close or delete issues that do not follow these guidelines as it doesn't help the contributors who spend time trying to solve issues if the community ignores guidelines!

plueschpruem commented 4 months ago

I seem to have the same problem. With the SAMSG32 protocol on an M5 Cardputer. Input (on G1) works fine – I then take that and send it out on button press. I can see the IR LED (on G44) blink with my phone camera, but the TV I use for testing won't notice it. Using TONE doesn't seem to work, I commented out TONE_LEDC_CHANNEL and TONE_PIN.

I suspect the ESP32-S3 needing some special love, I already had to change my Serial.print() statements to USBSerial.print(). Maybe some timer settings have changed.

plueschpruem commented 4 months ago

Correction, it works for me with this sketch…

// MINIMAL IRMP/IRSND SKETCH
// FOR M5 CARDPUTER
// WILL SEND THE NUMBER 1 TO A SAMSUNG LT27C350
// WHEN YOU PRESS THE G0 BUTTON

#include <Arduino.h>
#define IRSND_OUTPUT_PIN G44
#define M5BUTTON G0
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)

#define IRSND_IR_FREQUENCY 38000
#define IRSND_PROTOCOL_NAMES 1
#define IRSND_SUPPORT_SAMSUNG_PROTOCOL 1

#include <irsnd.hpp>

IRMP_DATA irsnd_data;

union WordUnion {
    struct {
        uint8_t LowByte;
        uint8_t HighByte;
    } UByte;
    struct {
        int8_t LowByte;
        int8_t HighByte;
    } Byte;
    uint8_t UBytes[2];
    int8_t Bytes[2];
    uint16_t UWord;
    int16_t Word;
    uint8_t *BytePointer;
};

void setup() {
    USBSerial.begin(115200);  // USE "USBSerial" INSTEAD OF "Serial" FOR THE ESP32-S3
    pinMode(M5BUTTON, INPUT_PULLUP);
    USBSerial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRMP));
    irsnd_init();
    USBSerial.println(F("Send IR signals at pin " STR(IRSND_OUTPUT_PIN)));
}

void loop() {
    if (digitalRead(M5BUTTON) == 0) {
        irsnd_data.protocol = IRMP_SAMSUNG32_PROTOCOL;
        irsnd_data.address = 0x707;   // SAMSUNG LT27C350
        irsnd_data.command = 0xFB04;  // SEND NUMBER 1
        irsnd_data.flags = 0;
        irsnd_send_data(&irsnd_data, true);
        irsnd_data_print(&USBSerial, &irsnd_data);
    }
}