0

Is there a way to convert a IR pattern from a Android ~4.4.2 to 4.4.3 compatible pattern. Android ~4.4.2 is using a number of cycles and 4.4.3 is using the on and offtime in µs.

Here is a example how they look like

private static final int SAMPLE_FREQ = 38400;
private static final int[] IR_SIGNAL_PULSE_COUNT = {171,171,22,64,22,64,22,64,22,21,22,21,22,21,22,21,22,21,22,64,22,64,22,64,22,21,22,21,22,21,22,21,22,21,22,21,22,21,22,64,22,21,22,21,22,21,22,21,22,21,22,64,22,64,22,21,22,64,22,64,22,64,22,64,22,64,22,876};

private static final int[] IR_SIGNAL_TIME_LENGTH = {4499,4499,578,1683,578,1683,578,1683,578,552,578,552,578,552,578,552,578,552,578,1683,578,1683,578,1683,578,552,578,552,578,552,578,552,578,552,578,552,578,552,578,1683,578,552,578,552,578,552,578,552,578,552,578,1683,578,1683,578,552,578,1683,578,1683,578,1683,578,1683,578,1683,578,23047};

Theoretically this should work but it don't

private int[] toCompIR(IrDataCompat data){
    int inUs = 1000000/data.getFrequency();
    int[] frame = data.getFrame();
    int[] arrayOfInt = new int[-1 + frame.length];
    for (int j = 1; j < frame.length; j++)
        arrayOfInt[(j - 1)] = frame[(j - 1)] * inUs;

    return arrayOfInt;
}
Bastian Rihm
  • 13
  • 1
  • 1
  • 3

1 Answers1

0

You might run into a rounding error.

Please try

float inUs = 1000000.0f/data.getFrequency()

Marc Van Daele
  • 2,856
  • 1
  • 26
  • 52