#ifndef COOLING_SYSTEM_H_
#define COOLING_SYSTEM_H_

#include <DallasTemperature.h>

class C_CoolingSystem {
   public:
    C_CoolingSystem() : oneWire(TEMPERATURE_DATA_PIN), sensors(&oneWire) { ; }

    void Init();

    bool IsSensorOk() { return temperatureC != DEVICE_DISCONNECTED_C; }
    float GetTemperature() { return temperatureC; }
    int GetFanRPM() { return RPM; }
    int GetFanPWM() { return fanPwm; }

    void Tasks();

   private:
    static const int TEMP_MIN = 25;
    static const int TEMP_MAX = 60;
    static const int FAN_PWM_MIN = 255 / 3;
    static const int FAN_PWM_MAX = 255;

    static const int FAN_PWM_PIN = 5;
    static const int FAN_TACHO_PIN = 8;
    static const int TEMPERATURE_DATA_PIN = 6;

    OneWire oneWire;
    DallasTemperature sensors;

    float temperatureC;
    int fanPwm, RPM;
};

#endif
