mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-09-13 21:54:07 +00:00
replace define with constexpr
This commit is contained in:
@@ -421,9 +421,9 @@ bool WebStatusService::refresh_versions_cache() {
|
|||||||
#ifdef EMSESP_STANDALONE
|
#ifdef EMSESP_STANDALONE
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
// detect scheme from EMSESP_VERSIONS_URL (case-insensitive). One code path for HTTP and HTTPS,
|
// detect scheme from VERSIONS_URL (case-insensitive). One code path for HTTP and HTTPS,
|
||||||
// using ESP_SSLClient as a plain TCP passthrough when SSL is disabled.
|
// using ESP_SSLClient as a plain TCP passthrough when SSL is disabled.
|
||||||
String url = EMSESP_VERSIONS_URL;
|
String url = VERSIONS_URL;
|
||||||
String lower = url;
|
String lower = url;
|
||||||
lower.toLowerCase();
|
lower.toLowerCase();
|
||||||
const bool is_https = lower.startsWith("https://");
|
const bool is_https = lower.startsWith("https://");
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
#define EMSESP_SYSTEM_STATUS_SERVICE_PATH "/rest/systemStatus"
|
#define EMSESP_SYSTEM_STATUS_SERVICE_PATH "/rest/systemStatus"
|
||||||
#define EMSESP_ACTION_SERVICE_PATH "/rest/action"
|
#define EMSESP_ACTION_SERVICE_PATH "/rest/action"
|
||||||
|
|
||||||
#define EMSESP_VERSIONS_URL "http://emsesp.org/versions.json"
|
|
||||||
|
|
||||||
#include "../core/firmwareVersion.h"
|
#include "../core/firmwareVersion.h"
|
||||||
#include "../emsesp_version.h"
|
#include "../emsesp_version.h"
|
||||||
|
|
||||||
@@ -72,6 +70,8 @@ class WebStatusService {
|
|||||||
|
|
||||||
bool refresh_versions_cache(); // does the actual HTTPS fetch + parse, returns true on success
|
bool refresh_versions_cache(); // does the actual HTTPS fetch + parse, returns true on success
|
||||||
|
|
||||||
|
static constexpr const char * VERSIONS_URL = "http://emsesp.org/versions.json";
|
||||||
|
|
||||||
static constexpr uint32_t VERSIONS_REFRESH_INTERVAL_MS = 60UL * 60UL * 1000UL; // 1 hour on success
|
static constexpr uint32_t VERSIONS_REFRESH_INTERVAL_MS = 60UL * 60UL * 1000UL; // 1 hour on success
|
||||||
static constexpr uint32_t VERSIONS_RETRY_INTERVAL_MS = 5UL * 60UL * 1000UL; // 5 min after failure
|
static constexpr uint32_t VERSIONS_RETRY_INTERVAL_MS = 5UL * 60UL * 1000UL; // 5 min after failure
|
||||||
static constexpr uint32_t VERSIONS_INITIAL_FETCH_DELAY_MS = 5UL * 1000UL; // 5 s after a link comes up
|
static constexpr uint32_t VERSIONS_INITIAL_FETCH_DELAY_MS = 5UL * 1000UL; // 5 s after a link comes up
|
||||||
|
|||||||
Reference in New Issue
Block a user