CanGrow/Arduino/CanGrow/CanGrow_Init.h

156 lines
3.6 KiB
C

/*
*
* Constants
*
*/
const char* CanGrowVer = "0.1";
const char* APssid = "CanGrow-unconfigured";
/*
* TODO - does not work atm. idk why.
* const char* APpass = "CanGrow";
const int APchannel = 6;
const bool APhidden = false;
*
*/
/*
*
* Variables
*
*/
// valSoilmoisture - contains the value of getSoilmoisture()
byte valSoilmoisture;
// valTemperature - contains the value of getTemperature()
float valTemperature;
// valTemperature - contains the value of getHumidity()
float valHumidity;
// valWaterlevel - contains the value of getWaterlevel()
byte valWaterlevel;
// do we need a restart? (e.g. after wifi settings change)
bool NeedRestart;
bool FirstRun;
// which screen should be actually displayed
byte ScreenToDisplay = 0;
byte DisplayScreenDuration = 3;
// how many seconds actual screen got displayed
byte ScreenIterationPassed = 0;
bool MaintenanceMode = false;
unsigned long MaintenanceStarted = 0;
/*
* millis timer
*
*/
unsigned long outputPrevTime = 0;
/*
*
* EEPROM saved variables
*
*/
//
// WiFi
//
// if empty, CanGrow start in AccessPoint mode
char WIFIssid[32];
char WIFIpassword[64];
// WIFIuseDHCP - if true, get IP by DHCP
bool WIFIuseDHCP;
IPAddress WIFIip(192,168,4,20);
IPAddress WIFInetmask(255,255,255,0);
IPAddress WIFIgateway(192,168,4,254);
IPAddress WIFIdns(0,0,0,0);
//char WebUiUsername[16] = "cangrow";
//char WebUiPassword[32] = "cangrow";
//
// System
//
// configured - if false, let the user configure system settings first
bool configured = false;
// NTP Offset
short NtpOffset;
// MoistureSensor_Type - contains which moisture sensor to use
// 1: analog capacitive sensor
// 2: I2C chirp sensor from catnip electronics
byte MoistureSensor_Type;
// SoilmoistureLow - contains the value , when soil moisture is assumed to be low,
byte SoilmoistureLow = 20;
// UsePump - is the pump used? bool
bool UsePump;
// UseFan - is the fan used? bool
byte PumpOnTime = 3;
bool UseFan;
// In case the user uses no 12V LED on the LED output and an relais instead
// we have to disable PWM. So we ask here for what kind of light user is going
bool UseLEDrelais;
bool UseFANrelais;
// Which temperature sensor to use?
byte TemperatureSensor_Type;
unsigned short MaintenanceDuration = 300;
char Esp32CamIP[16];
//
// Grow Stuff
//
// GrowName - contains the name of the grow/plant. Up to 32 byte
// if empty, let the user setup grow settings first
char GrowName[32];
// GrowStart - contains unix timestamp from date where grow starts (00:00)
// unsigned long is 8 byte
unsigned long GrowStart;
// DayOfGrow contains on which day the grow is
byte DayOfGrow;
// DaysVeg - contains how many days to be in vegetation phase
byte DaysVeg = 35;
// DaysBloom - contains how many days to be in bloom phase
byte DaysBloom = 49;
// LighthoursVeg - contains how many hours the Growlight is on in Veg
byte LighthoursVeg = 16;
// LighthoursBloom - contains how many hours the Growlight is on in Bloom
byte LighthoursBloom = 12;
// SunriseHour - contains to which hour of day the growlight turns on
byte SunriseHour = 7;
// SunriseHour - contains to which minute of SunriseHour the growlight turns on
byte SunriseMinute = 0;
// PinLEDPWM - contains the PWM value for dimming the grow light
// default is 255 to ensure it is just on for the case UseLEDrelais is true
byte PinLEDPWM = 255;
byte PinFANPWM = 255;
// fade in and out sunrise and sunset?
bool SunFade;
byte SunFadeDuration = 30;
/*
*
* NTP
*
*/
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP);
/*
*
* Webserver
*
*/
ESP8266WebServer webserver(80);
/* I2C Stuff
*
*/
#define WIRE Wire
/*
* Display Stuff
*/
Adafruit_SSD1306 display = Adafruit_SSD1306(128, 64, &WIRE);