<commit_before>/*
 * IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
 * An IR detector/demodulator must be connected to the input RECV_PIN.
 * Version 0.1 July, 2009
 * Copyright 2009 <NAME>
 * http://arcfn.com
 */

#include <IRremote.h>
#include <LazerTagIr.h>

#define LAZERTAG_RELAY_VERSION "1.0.0"
#define LAZERTAG_RELAY_VERSION_FULL "LazerTagRelay Version " LAZERTAG_RELAY_VERSION " (" __DATE__ " " __TIME__ ")"

int RECEIVE_PIN = 11;

LazerTagIrReceive lazerTagReceive(RECEIVE_PIN);
LazerTagIrSend lazerTagSend;
decode_results results;

void setup();
void loop();
void dump(decode_results *results);

void setup()
{
  Serial.begin(115200);
  Serial.println(LAZERTAG_RELAY_VERSION_FULL);
  Serial.println(LAZERTAG_IR_VERSION_FULL);
  Serial.println("Start");
  lazerTagReceive.enableIRIn();
}

void loop() {
  if (lazerTagReceive.decode(&results))
  {
    dump(&results);
    lazerTagReceive.enableIRIn();
    lazerTagReceive.resume();
  }
  else if (Serial.available() >= 2)
  {
    byte high = Serial.read();
    byte low = Serial.read();
    
    short value = (short)low | (((short)high & 0x1) << 8);
    byte count = (high >> 1) & 0xf;
    bool beacon = (high >> 5) & 0x1;

    lazerTagSend.sendLazerTag(value, count, beacon);
    
    lazerTagReceive.enableIRIn();
    lazerTagReceive.resume();
  }
}

void dump(decode_results *results)
{
  switch (results->decode_type)
  {
    case TYPE_LAZERTAG_TAG:
      Serial.print("LTX: ");
      break;
    case TYPE_LAZERTAG_BEACON:
      Serial.print("LTTO: ");
      break;
    default:
      Serial.println("Could not decode message");
      return;
  }
  Serial.print(results->value, HEX);
  Serial.print(", ");
  Serial.print(results->bits, DEC);
  Serial.println();
}
<commit_msg>Dump raw signal timing to serial if decoding fails.<commit_after>/*
 * IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
 * An IR detector/demodulator must be connected to the input RECV_PIN.
 * Version 0.1 July, 2009
 * Copyright 2009 <NAME>
 * http://arcfn.com
 */

#include <IRremote.h>
#include <LazerTagIr.h>

#define LAZERTAG_RELAY_VERSION "1.0.0"
#define LAZERTAG_RELAY_VERSION_FULL "LazerTagRelay Version " LAZERTAG_RELAY_VERSION " (" __DATE__ " " __TIME__ ")"

int RECEIVE_PIN = 11;

LazerTagIrReceive lazerTagReceive(RECEIVE_PIN);
LazerTagIrSend lazerTagSend;
decode_results results;

void setup();
void loop();
void dump(decode_results *results);

void setup()
{
  Serial.begin(115200);
  Serial.println(LAZERTAG_RELAY_VERSION_FULL);
  Serial.println(LAZERTAG_IR_VERSION_FULL);
  Serial.println("Start");
  lazerTagReceive.enableIRIn();
}

void loop()
{
  if (lazerTagReceive.decode(&results))
  {
    dump(&results);
    lazerTagReceive.enableIRIn();
    lazerTagReceive.resume();
  }
  else if (Serial.available() >= 2)
  {
    byte high = Serial.read();
    byte low = Serial.read();
    
    short value = (short)low | (((short)high & 0x1) << 8);
    byte count = (high >> 1) & 0xf;
    bool beacon = (high >> 5) & 0x1;

    lazerTagSend.sendLazerTag(value, count, beacon);
    
    lazerTagReceive.enableIRIn();
    lazerTagReceive.resume();
  }
}

void dump(decode_results *results)
{
  switch (results->decode_type)
  {
    case TYPE_LAZERTAG_TAG:
      Serial.print("LTX: ");
      break;
    case TYPE_LAZERTAG_BEACON:
      Serial.print("LTTO: ");
      break;
    default:
      Serial.print("RAW: ");
      for (int i = 0; i < results->rawlen; i++)
      {
        Serial.print(results->rawbuf[i] * USECPERTICK, DEC);
        if (i < (results->rawlen - 1))
        {
          Serial.print(", ");
        }
      }
      Serial.println();
      return;
  }
  Serial.print(results->value, HEX);
  Serial.print(", ");
  Serial.print(results->bits, DEC);
  Serial.println();
}

{'fraction_non_alphanumeric': 0.13808640339252584, 'fraction_numerical': 0.016432547044791943, 'mean_word_length': 3.5745454545454547, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6952967', 'n_tokens_mistral': 1410, 'n_tokens_neox': 1330, 'n_words': 275}