<commit_before>package de.loosensimnetz.iot.raspi.motor;

import com.pi4j.io.gpio.GpioController;
import com.pi4j.io.gpio.GpioFactory;
import com.pi4j.io.gpio.GpioPinDigitalInput;
import com.pi4j.io.gpio.GpioPinDigitalOutput;
import com.pi4j.io.gpio.PinPullResistance;
import com.pi4j.io.gpio.PinState;
import com.pi4j.io.gpio.RaspiPin;

import static de.loosensimnetz.iot.raspi.led.LedStateConverter.ledStateToPinState;
import static de.loosensimnetz.iot.raspi.led.LedStateConverter.pinStateToLedState;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class RaspiMotor implements Motor {
	
	private final GpioController gpio;
	private final GpioPinDigitalOutput ledPin1;
	private final GpioPinDigitalOutput ledPin2;
	private final GpioPinDigitalInput sensorPin1;
	private final GpioPinDigitalInput sensorPin2;
	
	private ExpectedTime expectedTimeUp, expectedTimeDown, expectedTimeStoppedDown;
	
	private final Logger logger = LoggerFactory.getLogger(getClass());

	public RaspiMotor() {
		this(new ExpectedTime(7000L, 1000L), new ExpectedTime(7000L, 1000L));
	}
	
	@Override
	public ExpectedTime getExpectedTimeStoppedDown() {
		return expectedTimeStoppedDown;
	}

	@Override
	public void setExpectedTimeStoppedDown(ExpectedTime expectedTimeStoppedDown) {
		this.expectedTimeStoppedDown = expectedTimeStoppedDown;
	}

	public RaspiMotor(ExpectedTime maxTimeUp, ExpectedTime maxTimeDown) {
    	gpio = GpioFactory.getInstance();
    	
    	logger.info("Connection led 1 to GPIO pin 02 (WiringPI)");
    	ledPin1 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, PinState.HIGH);
    	logger.info("Connection led 2 to GPIO pin 00 (WiringPI)");
    	ledPin2 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_02, PinState.LOW);

    	logger.info("Connection sensor 1 to GPIO pin 08 (WiringPI)");
        sensorPin1 = gpio.provisionDigitalInputPin(RaspiPin.GPIO_04);
        logger.info("Connection sensor 2 to GPIO pin 09 (WiringPI)");
        sensorPin2 = gpio.provisionDigitalInputPin(RaspiPin.GPIO_05);
        <commit_msg>Configure logger<commit_after>package de.loosensimnetz.iot.raspi.motor;

import com.pi4j.io.gpio.GpioController;
import com.pi4j.io.gpio.GpioFactory;
import com.pi4j.io.gpio.GpioPinDigitalInput;
import com.pi4j.io.gpio.GpioPinDigitalOutput;
import com.pi4j.io.gpio.PinPullResistance;
import com.pi4j.io.gpio.PinState;
import com.pi4j.io.gpio.RaspiPin;

import static de.loosensimnetz.iot.raspi.led.LedStateConverter.ledStateToPinState;
import static de.loosensimnetz.iot.raspi.led.LedStateConverter.pinStateToLedState;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class RaspiMotor implements Motor {
	
	private final GpioController gpio;
	private final GpioPinDigitalOutput ledPin1;
	private final GpioPinDigitalOutput ledPin2;
	private final GpioPinDigitalInput sensorPin1;
	private final GpioPinDigitalInput sensorPin2;
	
	private ExpectedTime expectedTimeUp, expectedTimeDown, expectedTimeStoppedDown;
	
	private static final Logger logger = LoggerFactory.getLogger(RaspiMotor.class);

	public RaspiMotor() {
		this(new ExpectedTime(7000L, 1000L), new ExpectedTime(7000L, 1000L));
	}
	
	@Override
	public ExpectedTime getExpectedTimeStoppedDown() {
		return expectedTimeStoppedDown;
	}

	@Override
	public void setExpectedTimeStoppedDown(ExpectedTime expectedTimeStoppedDown) {
		this.expectedTimeStoppedDown = expectedTimeStoppedDown;
	}

	public RaspiMotor(ExpectedTime maxTimeUp, ExpectedTime maxTimeDown) {
    	gpio = GpioFactory.getInstance();
    	
    	logger.info("Connection led 1 to GPIO pin 02 (WiringPI)");
    	ledPin1 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, PinState.HIGH);
    	logger.info("Connection led 2 to GPIO pin 00 (WiringPI)");
    	ledPin2 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_02, PinState.LOW);

    	logger.info("Connection sensor 1 to GPIO pin 08 (WiringPI)");
        sensorPin1 = gpio.provisionDigitalInputPin(RaspiPin.GPIO_04);
        logger.info("Connection sensor 2 to GPIO pin 09 (WiringPI)");
        sensorPin2 = gpio.provisionDigitalInputPin(RaspiPin.GPIO_05);
        
{'fraction_non_alphanumeric': 0.08581907090464548, 'fraction_numerical': 0.02591687041564792, 'mean_word_length': 5.412225705329154, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5012891', 'n_tokens_mistral': 1475, 'n_tokens_neox': 1382, 'n_words': 264}