#ifndef _CONFIG_H_
#define _CONFIG_H_
//----------------------------------------------------------------------------
///
/// \brief  config
///
///         Steifomat; Indoor plant watering system
///         This file hold some configuration values
///
/// \date   20190511
/// \author Maximilian Seesslen <mes@seesslen.net>
///
//----------------------------------------------------------------------------


//---Defines------------------------------------------------------------------


// #define  STEIFOMAT_TARGET_WATER_LEVEL     0x956
// Seems good, to much? 0xD00; Dry pots may flood until soaked
// 0xC00: Dry pots stay dry
// #define  STEIFOMAT_TARGET_WATER_LEVEL         3500    // like new baught rosmarin

//#define  STEIFOMAT_TARGET_WATER_LEVEL        2600     // quite ok
//#define  STEIFOMAT_TARGET_WATER_LEVEL_SOAK   2600     // quite ok

//#define  STEIFOMAT_TARGET_WATER_LEVEL        1600     // quite ok
//#define  STEIFOMAT_TARGET_WATER_LEVEL_SOAK   1600     // quite ok

//#define  STEIFOMAT_TARGET_WATER_LEVEL        1500     // Coaster wet, way to much

//#define  STEIFOMAT_TARGET_WATER_LEVEL        1600
// #define  STEIFOMAT_TARGET_WATER_LEVEL_SOAK   1600

// MIN is the most stable value when power supply is undefined towards earth ground
// (Switching supply, laptop)
#define STEIFOMAT_EVALUATE_MIN
//#define STEIFOMAT_EVALUATE_MID
#define STEIFOMAT_FAST_CHECK

#if defined(STEIFOMAT_EVALUATE_MIN)
   // #define  STEIFOMAT_DEFAULT_TARGET_LEVEL   9800
   #define  STEIFOMAT_DEFAULT_TARGET_LEVEL   2000
#elif defined(STEIFOMAT_EVALUATE_MID)
   // 6500 -> 4700; oregano weak
   // 3000; ???
   // 2800; coaster wet
   #define  STEIFOMAT_DEFAULT_TARGET_LEVEL   3000
#else
   #define  STEIFOMAT_DEFAULT_TARGET_LEVEL   19450
#endif

// Jecks for plausibility
#define  STEIFOMAT_MIN_WATER_LEVEL           30000
#define  STEIFOMAT_MAX_WATER_LEVEL           300

#define  STEIFOMAT_MIN_ID                    1
#define  STEIFOMAT_MAX_ID                    2048

#if STEIFOMAT_MIN_WATER_LEVEL < STEIFOMAT_MAX_WATER_LEVEL
      #define STEIFOMAT_MIN_VALUE            STEIFOMAT_MIN_WATER_LEVEL
      #define STEIFOMAT_MAX_VALUE            STEIFOMAT_MAX_WATER_LEVEL
asdasdasd
#else
      #define STEIFOMAT_MIN_VALUE            STEIFOMAT_MAX_WATER_LEVEL
      #define STEIFOMAT_MAX_VALUE            STEIFOMAT_MIN_WATER_LEVEL
#endif

#define  STEIFOMAT_MAX_PARALLEL_PUMPS        0x1
#define STEIFOMAT_SLOPES_PER_WAVE            1


#define  STEIFOMAT_MAX_CONSECUTIVE           64    // After 16h not full?

// Everything in seconds
#define  STEIFOMAT_WATERING_TIME             ( 10 ) // 20 sec, 5V, Kamoer ca 1 Eg Pot
// Interval to check each single pot. 5 minutes worked but led to filled
// coaster

#if defined(STEIFOMAT_FAST_CHECK)
   #define  STEIFOMAT_CHECK_INTERVAL         ( 15 * SEC_PER_MIN )
   //#define  STEIFOMAT_CHECK_INTERVAL         ( 1 * SEC_PER_MIN )
   #define  STEIFOMAT_STORE_RETAIN_INTERVAL  ( 10 * SEC_PER_MIN )
   #define  STEIFOMAT_CHECK_DELAY            1
#else
   #define  STEIFOMAT_CHECK_INTERVAL         ( 60 * SEC_PER_MIN )
   #define  STEIFOMAT_STORE_RETAIN_INTERVAL  ( 10 * SEC_PER_MIN )
   #define  STEIFOMAT_CHECK_DELAY            2
#endif

#define  STEIFOMAT_SKIP_VALUE_PER_HOUR       100
#define  STEIFOMAT_SKIP_VALUE_PER_CHECK      ( (int)( ( STEIFOMAT_SKIP_VALUE_PER_HOUR * STEIFOMAT_CHECK_INTERVAL ) / ( 60 * SEC_PER_MIN ) ) )

// Permanently check level instead of interval
#define STEIFOMAT_CONTINUOUS_CHECK           0

#define STEIFOMAT_MAX_POTS                   2


//---fin----------------------------------------------------------------------
#endif // ? ! _CONFIG_H_
