<commit_before>#include <Arduino.h>
#include "Relay.h"

// Relay is active low, so you need a 0 to turn it on. 
#define RELAY_ON 0
#define RELAY_OFF 1
#define MAX_TIME_ON 4000

Relay::Relay( int whatPin )
{
  // initialize variables
  pin = whatPin;
  run = 0;
  last_changed = millis();
  duration_on = 0;


  // initialize physical objects
  pinMode( pin, OUTPUT );

  // don't forget that we don't know the state of the pin
  // so give it one
  digitalWrite( pin, RELAY_OFF );
}

void Relay::on()
{
  if( ! run )
  {
    run = 1;
    last_changed = millis();
  }
  digitalWrite( pin, RELAY_ON );

}

void Relay::off()
{
  if ( run ) {
    run = 0;
    last_changed = millis();
  }
  duration_on = 0;
  digitalWrite( pin, RELAY_OFF );
}

unsigned long Relay::time_running() {
  if ( run ) {
    return millis() - last_changed;
  }
  return 0;
}
<commit_msg>minor<commit_after>#include <Arduino.h>
#include "Relay.h"

// Relay is active low, so you need a 0 to turn it on. 
#define RELAY_ON 0
#define RELAY_OFF 1
#define MAX_TIME_ON 4000

Relay::Relay( int whatPin )
{
  // initialize variables
  pin = whatPin;
  run = 0;
  last_changed = millis();
  duration_on = 0;


  // initialize physical objects
  pinMode( pin, OUTPUT );

  // don't forget that we don't know the state of the pin
  // so give it one
  digitalWrite( pin, RELAY_OFF );
  
  off();
}

void Relay::on()
{
  if( ! run )
  {
    run = 1;
    last_changed = millis();
  }
  digitalWrite( pin, RELAY_ON );

}

void Relay::off()
{
  if ( run ) {
    run = 0;
    last_changed = millis();
  }
  duration_on = 0;
  digitalWrite( pin, RELAY_OFF );
}

unsigned long Relay::time_running() {
  if ( run ) {
    return millis() - last_changed;
  }
  return 0;
}

{'fraction_non_alphanumeric': 0.12935034802784223, 'fraction_numerical': 0.015081206496519721, 'mean_word_length': 2.80794701986755, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '586668', 'n_tokens_mistral': 702, 'n_tokens_neox': 652, 'n_words': 195}