<commit_before>import controlP5.*;
import processing.serial.*;

// Gui
ControlP5 cp5;
int myColor = color(0,0,0);
ArrayList<Points> temperatureGraph = new ArrayList();
ArrayList<Points> temperatureGraphTarget = new ArrayList();
int targetTemp = 30;
int actualTemp = 50;
int sliderTicks1 = 100;
int sliderTicks2 = 30;

int actualTime = 0;
int targetTime = 60;
boolean overTime = false;

ControlTimer controlTimer;
Textlabel textLabel;
Knob knob;

Slider abc;


// Temperature
float temperature = 0;
int MAX_RANGE = 100;

// Arduino
Serial arduino;  
byte[] prefix = new byte[] {0x41, 0x64, 'N', 'M', 'C', 'T'};


// LED
color[] colarray = new color[60];
int LED_AMOUNT = 60;

color timeColor = color(255, 255, 255);
color target = color(0,0,255);
color white_space = color(0,0,0);
color indicator = color(255,0,0);


void setup() {
  smooth();
  size(700,400);
  noStroke();
  setupCP5();
  setupArduino();
}

void setupCP5() {
  cp5 = new ControlP5(this);
  
  // add a horizontal sliders, the value of this slider will be linked
  // to variable 'sliderValue' 
  cp5.addSlider("targetTemp")
     .setPosition(width/2-60,20)
     .setSize(60, height-20)
     .setRange(0,MAX_RANGE)
     ;

  cp5.addSlider("actualTemp")
     .setPosition(0,20)
     .setSize(60, height-20)
     .setRange(0,MAX_RANGE)
     ;
    
  cp5.addButton("Stop and set")
     .setValue(0)
     .setPosition(width/2+2,2)
     .setSize(width/4-2,16)
     ;
     
  cp5.addButton("Play")
     .setValue(0)
     .setPosition(width/2+2+width/4,2)
     .setSize(width/4-2,16)
     ;

  cp5.addTextlabel("labelActual")
                    .setText("Actual temperature")
                    .setPosition(0,5)
                    ;

  cp5.addTextlabel("labelTarget")
                    .setText("Target temperature")
                    .setPosition(width/2-90,5)
                    .setLock(true)
                    ;
  
  // reposition the Label for controller 'slider'
  cp5.getController("targetTemp").getValueLabel().align(ControlP5.BOTTOM, ControlP5.RIGHT).setPaddingX(0);
  cp5.getController("actualTemp").getValueLabel().align(ControlP5.BOTTOM, ControlP5.RIGHT).setPaddingX(0);
  cp5.getController("Stop and set").getValueLabel().align(ControlP5.CENTER, ControlP5.CENTER).setPaddingX(0);
  cp5.getController("Play").getValueLabel().align(ControlP5.CENTER, ControlP5.CENTER).setPaddingX(0);
  cp5.getController("targetTemp").getCaptionLabel().hide();

  knob = cp5.addKnob("knob1")
                 .setRange(0,targetTime)
                 .setValue(0)
                 .setPosition(width/2+width/5 - 75,height/2 - 75)
                 .setRadius(100)
                 .setNumberOfTickMarks(10)
                 .setTickMarkLength(4)
                 .snapToTickMarks(false)
                 .setColorForeground(color(255))
                 .setDragDirection(Knob.HORIZONTAL);

  controlTimer = new ControlTimer();
  textLabel = new Textlabel(cp5,"--", width/2 + width/5, height/2);
  controlTimer.setSpeedOfTime(+1);
}

void setupArduino() {
  println(Serial.list());
  arduino = new Serial(this, Serial.list()[0], 115200);
}


void draw() {
  background(0);


  getTemperature();

  fill(targetTemp,0,0);
  rect(0,20,width/2,height/2-10);
  fill(actualTemp,0,0);
  rect(0,height/2+10,width/2,height/2-10);
  
  textLabel.setValue(controlTimer.toString());
  textLabel.draw(this);

  actualTime = controlTimer.second() + controlTimer.minute() * 60;
  if (actualTime > targetTime) overTime = true;
  knob.setValue(actualTime);
  knob.setValueLabel(controlTimer.toString());

  fillArray();
  displayLeds();
  
  drawTemperatureGraph(temperatureGraphTarget,2,200);
  drawTemperatureGraph(temperatureGraph, 1,255);
  
  setTemperatureGraph(temperatureGraph, actualTemp);
  setTemperatureGraph(temperatureGraphTarget, targetTemp);  
}

void drawTemperatureGraph(ArrayList<Points> points, int strokeWeight, int strokeColor){
  noFill();
  stroke(strokeColor);
  strokeWeight(strokeWeight);
  beginShape();
  for (int i=0;i<points.size();i++) {
    Points P = (Points)points.get(i);
    vertex(P.x, P.y);
    if (P.x<60)points.remove(i);
    if(frameCount % 30 == 0){
      P.x--;
    }
  }
  endShape();
  noFill();
  stroke(0);
}
<commit_msg>Change timer<commit_after>import controlP5.*;
import processing.serial.*;

// Gui
ControlP5 cp5;
int myColor = color(0,0,0);
ArrayList<Points> temperatureGraph = new ArrayList();
ArrayList<Points> temperatureGraphTarget = new ArrayList();
int targetTemp = 30;
int actualTemp = 50;
int sliderTicks1 = 100;
int sliderTicks2 = 30;

int actualTime = 0;
int targetTime = 60;
boolean overTime = false;

ControlTimer controlTimer;
Textlabel textLabel;
Knob knob;

Slider abc;


// Temperature
float temperature = 0;
int MAX_RANGE = 100;

int speedOfTime = 0;

// Arduino
Serial arduino;  
byte[] prefix = new byte[] {0x41, 0x64, 'N', 'M', 'C', 'T'};


// LED
color[] colarray = new color[60];
int LED_AMOUNT = 60;

color timeColor = color(255, 255, 255);
color target = color(0,0,255);
color white_space = color(0,0,0);
color indicator = color(255,0,0);


void setup() {
  smooth();
  size(700,400);
  noStroke();
  setupCP5();
  setupArduino();
}

void setupCP5() {
  cp5 = new ControlP5(this);
  
  // add a horizontal sliders, the value of this slider will be linked
  // to variable 'sliderValue' 
  cp5.addSlider("targetTemp")
     .setPosition(width/2-60,20)
     .setSize(60, height-20)
     .setRange(0,MAX_RANGE)
     ;

  cp5.addSlider("actualTemp")
     .setPosition(0,20)
     .setSize(60, height-20)
     .setRange(0,MAX_RANGE)
     ;
    
  cp5.addButton("Stop and set")
     .setValue(0)
     .setPosition(width/2+2,2)
     .setSize(width/4-2,16)
     ;
     
  cp5.addButton("Play")
     .setValue(0)
     .setPosition(width/2+2+width/4,2)
     .setSize(width/4-2,16)
     ;

  cp5.addTextlabel("labelActual")
                    .setText("Actual temperature")
                    .setPosition(0,5)
                    ;

  cp5.addTextlabel("labelTarget")
                    .setText("Target temperature")
                    .setPosition(width/2-90,5)
                    .setLock(true)
                    ;
  
  // reposition the Label for controller 'slider'
  cp5.getController("targetTemp").getValueLabel().align(ControlP5.BOTTOM, ControlP5.RIGHT).setPaddingX(0);
  cp5.getController("actualTemp").getValueLabel().align(ControlP5.BOTTOM, ControlP5.RIGHT).setPaddingX(0);
  cp5.getController("Stop and set").getValueLabel().align(ControlP5.CENTER, ControlP5.CENTER).setPaddingX(0);
  cp5.getController("Play").getValueLabel().align(ControlP5.CENTER, ControlP5.CENTER).setPaddingX(0);
  cp5.getController("targetTemp").getCaptionLabel().hide();

  knob = cp5.addKnob("knob1")
                 .setRange(0,targetTime)
                 .setValue(0)
                 .setPosition(width/2+width/5 - 75,height/2 - 75)
                 .setRadius(100)
                 .setNumberOfTickMarks(10)
                 .setTickMarkLength(4)
                 .snapToTickMarks(false)
                 .setColorForeground(color(255))
                 .setDragDirection(Knob.HORIZONTAL);

  controlTimer = new ControlTimer();
  textLabel = new Textlabel(cp5,"--", width/2 + width/5, height/2);
  controlTimer.setSpeedOfTime(0);
}

void setupArduino() {
  println(Serial.list());
  arduino = new Serial(this, Serial.list()[0], 115200);
}

public void Play(int theValue) {
  if(speedOfTime == 0){
    speedOfTime = 1;
    controlTimer.setSpeedOfTime(1);
  } else {
    speedOfTime = 0;
    controlTimer.setSpeedOfTime(0);
  }
}

void draw() {
  background(0);


  getTemperature();

  fill(targetTemp,0,0);
  rect(0,20,width/2,height/2-10);
  fill(actualTemp,0,0);
  rect(0,height/2+10,width/2,height/2-10);
  
  textLabel.setValue(controlTimer.toString());
  textLabel.draw(this);

  actualTime = controlTimer.second() + controlTimer.minute() * 60;
  if (actualTime > targetTime) overTime = true;
  knob.setValue(actualTime);
  knob.setValueLabel(controlTimer.toString());

  fillArray();
  displayLeds();
  
  drawTemperatureGraph(temperatureGraphTarget,2,200);
  drawTemperatureGraph(temperatureGraph, 1,255);
  
  setTemperatureGraph(temperatureGraph, actualTemp);
  setTemperatureGraph(temperatureGraphTarget, targetTemp);  
}

void drawTemperatureGraph(ArrayList<Points> points, int strokeWeight, int strokeColor){
  noFill();
  stroke(strokeColor);
  strokeWeight(strokeWeight);
  beginShape();
  for (int i=0;i<points.size();i++) {
    Points P = (Points)points.get(i);
    vertex(P.x, P.y);
    if (P.x<60)points.remove(i);
    if(frameCount % 10 == 0){
      P.x--;
    }
  }
  endShape();
  noFill();
  stroke(0);
}

{'fraction_non_alphanumeric': 0.14647985178323297, 'fraction_numerical': 0.04678091709124595, 'mean_word_length': 3.200875486381323, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '1747189', 'n_tokens_mistral': 3158, 'n_tokens_neox': 2951, 'n_words': 519}