<commit_before>    
typedef volatile struct  {
  volatile int rate[10];                    // array to hold last ten IBI values
  volatile unsigned long sampleCounter = 0;          // used to determine pulse timing
  volatile unsigned long lastBeatTime = 0;           // used to find IBI
  volatile int P =512;                      // used to find peak in pulse wave, seeded
  volatile int T = 512;                     // used to find trough in pulse wave, seeded
  volatile int thresh = 512;                // used to find instant moment of heart beat, seeded
  volatile int amp = 100;                   // used to hold amplitude of pulse waveform, seeded
  volatile boolean firstBeat = true;        // used to seed rate array so we startup with reasonable BPM
  volatile boolean secondBeat = false;      // used to seed rate array so we startup with reasonable BPM
} PulseState;

PulseState sensorsState[NUMBER_OF_SENSORS];


void interruptSetup(){     
  // Initializes Timer2 to throw an interrupt every 2mS.
  TCCR2A = 0x02;     // DISABLE PWM ON DIGITAL PINS 3 AND 11, AND GO INTO CTC MODE
  TCCR2B = 0x06;     // DON'T FORCE COMPARE, 256 PRESCALER 
  OCR2A = 0X7C;      // SET THE TOP OF THE COUNT TO 124 FOR 500Hz SAMPLE RATE
  TIMSK2 = 0x02;     // ENABLE INTERRUPT ON MATCH BETWEEN TIMER2 AND OCR2A
  sei();             // MAKE SURE GLOBAL INTERRUPTS ARE ENABLED      
  
  for (int i = 0; i < NUMBER_OF_SENSORS; i++) {
      sensorsState[i].thresh = 512;                          // set thresh default
      sensorsState[i].P = 512;                               // set P default
      sensorsState[i].T = 512;                               // set T default
      sensorsState[i].lastBeatTime = 0;<commit_msg>And arduino bug fixes<commit_after>    
typedef volatile struct  {
  volatile int rate[10];                    // array to hold last ten IBI values
  volatile unsigned long sampleCounter;          // used to determine pulse timing
  volatile unsigned long lastBeatTime;           // used to find IBI
  volatile int P;                      // used to find peak in pulse wave, seeded
  volatile int T;                     // used to find trough in pulse wave, seeded
  volatile int thresh;                // used to find instant moment of heart beat, seeded
  volatile int amp;                   // used to hold amplitude of pulse waveform, seeded
  volatile boolean firstBeat;        // used to seed rate array so we startup with reasonable BPM
  volatile boolean secondBeat;      // used to seed rate array so we startup with reasonable BPM
} PulseState;

PulseState sensorsState[NUMBER_OF_SENSORS];


void interruptSetup(){     
  // Initializes Timer2 to throw an interrupt every 2mS.
  TCCR2A = 0x02;     // DISABLE PWM ON DIGITAL PINS 3 AND 11, AND GO INTO CTC MODE
  TCCR2B = 0x06;     // DON'T FORCE COMPARE, 256 PRESCALER 
  OCR2A = 0X7C;      // SET THE TOP OF THE COUNT TO 124 FOR 500Hz SAMPLE RATE
  TIMSK2 = 0x02;     // ENABLE INTERRUPT ON MATCH BETWEEN TIMER2 AND OCR2A
  sei();             // MAKE SURE GLOBAL INTERRUPTS ARE ENABLED      
  
  for (int i = 0; i < NUMBER_OF_SENSORS; i++) {
      sensorsState[i].thresh = 512;                          // set thresh default
      sensorsState[i].P = 512;                               // set P default
      sensorsState[i].T = 512;                               // set T default
      sensorsState[i].lastBeatTime = 0;
{'fraction_non_alphanumeric': 0.06525573192239859, 'fraction_numerical': 0.029982363315696647, 'mean_word_length': 1.8765849535080303, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '365587', 'n_tokens_mistral': 1078, 'n_tokens_neox': 923, 'n_words': 398}