#pragma once

#define SCREEN_WIDTH    128
#define SCREEN_HEIGHT    64
#define OLED_RESET       -1

#define SDA_PIN          5
#define SCL_PIN          6
#define BUTTON_PIN       2

#define OLED_ADDR      0x3D
#define SHT_BED_ADDR   0x44
#define SHT_TOP_ADDR   0x45

// Debug
const bool DEBUG_SERIAL = false;

// WiFi
const char* wifiSsid     = "Your Wifi network";
const char* wifiPassword = "Your Wifi password";

// MQTT
const char* mqttHost     = "Your IP";
const int   mqttPort     = 1883;
const char* mqttUser     = "Your MQTT user";
const char* mqttPassword = "Your MQTT password";

const char* mqttClientId = "P1P_enclosure";

const char* topicState           = "P1P_enclosure/state";
const char* topicAvail           = "P1P_enclosure/availability";
const char* topicCmdFil          = "P1P_enclosure/cmd/filament";
const char* topicProfileState    = "P1P_enclosure/profile/state";
const char* topicCmdProfileBase  = "P1P_enclosure/cmd/profile";

const char* discoveryPrefix = "homeassistant";

const char* discoveryTopTemp        = "homeassistant/sensor/P1P_enclosure/top_temperature/config";
const char* discoveryTopHum         = "homeassistant/sensor/P1P_enclosure/top_humidity/config";
const char* discoveryBedTemp        = "homeassistant/sensor/P1P_enclosure/bed_temperature/config";
const char* discoveryBedHum         = "homeassistant/sensor/P1P_enclosure/bed_humidity/config";
const char* discoveryStatus         = "homeassistant/sensor/P1P_enclosure/status/config";
const char* discoveryFilament       = "homeassistant/select/P1P_enclosure/filament/config";
const char* discoveryActiveFilament = "homeassistant/sensor/P1P_enclosure/active_filament/config";



// timing
const unsigned long sensorIntervalMs  = 1000;
const unsigned long displayIntervalMs = 250;
const unsigned long serialIntervalMs  = 1000;
const unsigned long mqttPublishIntervalMs = 5000;

const unsigned long wifiRetryMs = 30000;
const unsigned long mqttRetryMs = 10000;

// dT
const float deltaEqualThreshold = 0.2f;

// sensor kalibratie
const float tempOffsetBed = 0.0f;
const float tempOffsetTop = 0.0f;

const float humOffsetBed  = 0.0f;
const float humOffsetTop  = 0.0f;

enum FilamentType {
  FIL_PLA = 0,
  FIL_PETG,
  FIL_PC,
  FIL_TPU,
  FIL_COUNT
};

struct FilamentProfile {
  const char* name;
  float topMin;
  float topMax;
};

FilamentProfile filamentProfiles[FIL_COUNT] = {
  { "PLA",  25.0f, 35.0f },
  { "PETG", 30.0f, 40.0f },
  { "PC",   40.0f, 50.0f },
  { "TPU",  25.0f, 35.0f }
};