<commit_before>#include <unistd.h>
#include <stdlib.h>

#include "WProgram.h"
#include <MD.h>

#include "hexdump.hh"
#include "../pattern-tests/PrintMDPattern.h"

class MDHandler : public MDCallback {
public:
	void onMDPattern() {
		PrintMDPattern pattern;
		if (pattern.fromSysex(MidiSysex.data + 5, MidiSysex.recordLen - 5)) {
			printf("parsed pattern sysex\n");
			pattern.print();
			pattern.setTrig(2, 0);
			uint8_t buf[8192];
			uint16_t retlen = pattern.toSysex(buf, sizeof(buf));
			printf("retlen: %d\n", retlen);
			//			hexDump(buf, retlen);
			MidiUart.sendRaw(buf, retlen);
		} else {
			printf("error parsing sysex message\n");
		}
	}
};

int main(void) {
	MDSysexListener.setup();
	
	MDHandler mdHandler;
	MDSysexListener.addOnPatternMessageCallback(&mdHandler, (md_callback_ptr_t)&MDHandler::onMDPattern);
	
  MidiUart.init(3, 3);

	MD.requestPattern(0);

  for (;;) {
    MidiUart.runLoop();
    while (MidiUart.avail()) {
      uint8_t c = MidiUart.getc();
			Midi.handleByte(c);
    }
		usleep(1000);
  }
	

}
<commit_msg>resolve conflict<commit_after>#include <unistd.h>
#include <stdlib.h>

#include "WProgram.h"
#include <MD.h>

<<<<<<< HEAD
#include "hexdump.hh"
#include "../pattern-tests/PrintMDPattern.h"

class MDHandler : public MDCallback {
public:
	void onMDPattern() {
		PrintMDPattern pattern;
		if (pattern.fromSysex(MidiSysex.data + 5, MidiSysex.recordLen - 5)) {
			printf("parsed pattern sysex\n");
			pattern.print();
			pattern.setTrig(2, 0);
			uint8_t buf[8192];
			uint16_t retlen = pattern.toSysex(buf, sizeof(buf));
			printf("retlen: %d\n", retlen);
			//			hexDump(buf, retlen);
			MidiUart.sendRaw(buf, retlen);
		} else {
			printf("error parsing sysex message\n");
		}
	}
};

int main(void) {
	MDSysexListener.setup();
	
	MDHandler mdHandler;
	MDSysexListener.addOnPatternMessageCallback(&mdHandler, (md_callback_ptr_t)&MDHandler::onMDPattern);
	
  MidiUart.init(3, 3);

	MD.requestPattern(0);

  for (;;) {
    MidiUart.runLoop();
    while (MidiUart.avail()) {
      uint8_t c = MidiUart.getc();
			Midi.handleByte(c);
    }
		usleep(1000);
  }
	

}

{'fraction_non_alphanumeric': 0.16127497621313036, 'fraction_numerical': 0.01807802093244529, 'mean_word_length': 4.0311004784688995, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 9, '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': '1861777', 'n_tokens_mistral': 914, 'n_tokens_neox': 825, 'n_words': 140}