diff --git a/hosted/timezone.php b/hosted/timezone.php index 33d184b..1e62312 100644 --- a/hosted/timezone.php +++ b/hosted/timezone.php @@ -1,3 +1,16 @@ \ No newline at end of file diff --git a/src/assets/version.h b/src/assets/version.h index 8e34c37..7591d38 100644 --- a/src/assets/version.h +++ b/src/assets/version.h @@ -4,10 +4,10 @@ const uint8_t VersionMajor = 2; const uint8_t VersionMinor = 0; const uint8_t VersionPatch = 0; -const uint8_t VersionMetadata = ; +const uint8_t VersionMetadata = 0; const char VersionBranch[] = "master"; const char VersionSemVer[] = "2.0.0"; -const char VersionFullSemVer[] = "2.0.0"; +const char VersionFullSemVer[] = "2.0.0+0"; const char VersionCommitDate[] = "2018-02-17"; #endif diff --git a/src/main.cpp b/src/main.cpp index 1278f67..104c1c0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -75,7 +75,7 @@ void setup() stairs = new Stairs(); stairs->init(pwmDriver); - + /* _dln("Setup :: starting initialization sequence"); stairs->set(0, 255); delay(300); @@ -89,6 +89,7 @@ void setup() } stairs->set(stepCount - 1, 0); + */ _dln("Setup :: initializing WiFi"); WiFi.persistent(false); @@ -118,13 +119,6 @@ void loop() ESP.restart(); } - if (motionTriggerSettingsChanged) - { - initMotionPins(); - motionTriggerSettingsChanged = false; - } - - currentTime = millis(); updateDebugStatus(); diff --git a/src/main.triggers.h b/src/main.triggers.h index a76b5c7..432846e 100644 --- a/src/main.triggers.h +++ b/src/main.triggers.h @@ -302,6 +302,13 @@ bool lastMotion = false; void updateMotionTrigger() { + if (motionTriggerSettingsChanged) + { + initMotionPins(); + activeMotionStart = 0; + } + + if (!motionTriggerSettings->enabled() || !motionTriggerSettings->triggerCount()) { activeMotionStart = 0; @@ -355,6 +362,12 @@ void checkTriggers() bool motionChanged = (activeMotionStart > 0) != lastMotion; lastMotion = (activeMotionStart > 0); + if (motionTriggerSettingsChanged) + { + motionChanged = true; + motionTriggerSettingsChanged = false; + } + if (!motionChanged && !timeTriggerChanged) return; diff --git a/web/app.js b/web/app.js index 66353c8..04cd2e9 100644 --- a/web/app.js +++ b/web/app.js @@ -1,5 +1,36 @@ function startApp() { + // Source: https://github.com/axios/axios/issues/164 + axios.interceptors.response.use(undefined, function axiosRetryInterceptor(err) { + var config = err.config; + // If config does not exist or the retry option is not set, reject + if(!config || !config.retry) return Promise.reject(err); + + // Set the variable for keeping track of the retry count + config.__retryCount = config.__retryCount || 0; + + // Check if we've maxed out the total number of retries + if(config.__retryCount >= config.retry) { + // Reject with the error + return Promise.reject(err); + } + + // Increase the retry count + config.__retryCount += 1; + + // Create new promise to handle exponential backoff + var backoff = new Promise(function(resolve) { + setTimeout(function() { + resolve(); + }, config.retryDelay || 1); + }); + + // Return the promise in which recalls axios to retry the request + return backoff.then(function() { + return axios(config); + }); + }); + Vue.component('check', { template: '