NTP Server can be set via configuration item
This commit is contained in:
parent
b85b2e6952
commit
e0de8dabe8
@ -45,6 +45,7 @@ HomieSetting<long> waterLevelMax("watermaxlevel", "distance (mm) at maximum wate
|
||||
HomieSetting<long> waterLevelMin("waterminlevel", "distance (mm) at minimum water level (pumps still covered)");
|
||||
HomieSetting<long> waterLevelWarn("waterlevelwarn", "warn (mm) if below this water level %");
|
||||
HomieSetting<long> waterLevelVol("waterVolume", "(ml) between minimum and maximum");
|
||||
HomieSetting<const char *>ntpServer("ntpServer", "NTP server (pool.ntp.org as default)");
|
||||
|
||||
/** Plant specific ones */
|
||||
|
||||
|
@ -49,8 +49,6 @@ RTC_DATA_ATTR long rtcMoistureTrigger6 = 0; /**<Level for the moisture sensor
|
||||
RTC_DATA_ATTR int lastPumpRunning = 0;
|
||||
RTC_DATA_ATTR long lastWaterValue = 0;
|
||||
|
||||
const char* ntpServer = "pool.ntp.org";
|
||||
|
||||
bool warmBoot = true;
|
||||
bool volatile mode3Active = false; /**< Controller must not sleep */
|
||||
bool volatile mDeepsleep = false;
|
||||
@ -180,8 +178,6 @@ void espDeepSleepFor(long seconds, bool activatePump = false){
|
||||
void mode2MQTT(){
|
||||
readSystemSensors();
|
||||
|
||||
configTime(0, 0, ntpServer);
|
||||
|
||||
digitalWrite(OUTPUT_PUMP, LOW);
|
||||
for (int i=0; i < MAX_PLANTS; i++) {
|
||||
mPlants[i].deactivatePump();
|
||||
@ -488,7 +484,7 @@ bool aliveHandler(const HomieRange& range, const String& value) {
|
||||
}
|
||||
|
||||
void homieLoop(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
void systemInit(){
|
||||
@ -502,6 +498,7 @@ void systemInit(){
|
||||
deepSleepTime.setDefaultValue(60);
|
||||
deepSleepNightTime.setDefaultValue(600);
|
||||
wateringDeepSleep.setDefaultValue(5);
|
||||
ntpServer.setDefaultValue("pool.ntp.org");
|
||||
|
||||
/* waterLevelMax 1000 */ /* 100cm in mm */
|
||||
waterLevelMin.setDefaultValue(50); /* 5cm in mm */
|
||||
@ -513,6 +510,8 @@ void systemInit(){
|
||||
//Homie.disableLogging();
|
||||
Homie.setup();
|
||||
|
||||
configTime(0, 0, ntpServer.get());
|
||||
|
||||
mConfigured = Homie.isConfigured();
|
||||
if (mConfigured) {
|
||||
for(int i=0; i < MAX_PLANTS; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user