mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-06-09 18:19:36 +00:00
formatting
This commit is contained in:
@@ -174,10 +174,10 @@ class AnalogSensor {
|
||||
return sensors_.size();
|
||||
}
|
||||
|
||||
bool update(uint8_t gpio, const char * name, double offset, double factor, uint8_t uom, int8_t type, bool deleted, bool is_system);
|
||||
bool get_value_info(JsonObject output, const char * cmd, const int8_t id = -1);
|
||||
void store_counters();
|
||||
std::string get_metrics_prometheus();
|
||||
bool update(uint8_t gpio, const char * name, double offset, double factor, uint8_t uom, int8_t type, bool deleted, bool is_system);
|
||||
bool get_value_info(JsonObject output, const char * cmd, const int8_t id = -1);
|
||||
void store_counters();
|
||||
std::string get_metrics_prometheus();
|
||||
static const std::vector<uint8_t> & exclude_types() {
|
||||
return exclude_types_;
|
||||
}
|
||||
|
||||
@@ -49,34 +49,34 @@ class DeviceValue {
|
||||
// also used with HA as uom
|
||||
// shows also the HA device class being used
|
||||
enum DeviceValueUOM : uint8_t {
|
||||
NONE = 0, // 0
|
||||
DEGREES, // 1 - °C - temperature
|
||||
DEGREES_R, // 2 - °C (relative temperature) - temperature
|
||||
PERCENT, // 3 - % - power factor
|
||||
LMIN, // 4 - l/min - volume flow rate
|
||||
KWH, // 5 - kWh - energy
|
||||
WH, // 6 - Wh - energy
|
||||
HOURS, // 7 - h - duration
|
||||
MINUTES, // 8 - m - duration
|
||||
UA, // 9 - µA - current
|
||||
BAR, // 10 - bar - pressure
|
||||
KW, // 11 - kW - power
|
||||
W, // 12 - W - power
|
||||
KB, // 13 - kB - data size
|
||||
SECONDS, // 14 - s - duration
|
||||
DBM, // 15 - dBm - signal strength
|
||||
FAHRENHEIT, // 16 - °F - temperature
|
||||
MV, // 17 - mV - voltage
|
||||
SQM, // 18 - m² - area
|
||||
M3, // 19 - m³ - volume
|
||||
L, // 20 - L - volume
|
||||
KMIN, // 21 - K*min
|
||||
K, // 22 - K - temperature
|
||||
VOLTS, // 23 - V - voltage
|
||||
MBAR, // 24 - mbar - atmospheric pressure
|
||||
LH, // 25 - l/h - volume flow rate
|
||||
CTKWH, // 26 - ct/kWh - monetary
|
||||
HERTZ, // 27 - Hz - frequency
|
||||
NONE = 0, // 0
|
||||
DEGREES, // 1 - °C - temperature
|
||||
DEGREES_R, // 2 - °C (relative temperature) - temperature
|
||||
PERCENT, // 3 - % - power factor
|
||||
LMIN, // 4 - l/min - volume flow rate
|
||||
KWH, // 5 - kWh - energy
|
||||
WH, // 6 - Wh - energy
|
||||
HOURS, // 7 - h - duration
|
||||
MINUTES, // 8 - m - duration
|
||||
UA, // 9 - µA - current
|
||||
BAR, // 10 - bar - pressure
|
||||
KW, // 11 - kW - power
|
||||
W, // 12 - W - power
|
||||
KB, // 13 - kB - data size
|
||||
SECONDS, // 14 - s - duration
|
||||
DBM, // 15 - dBm - signal strength
|
||||
FAHRENHEIT, // 16 - °F - temperature
|
||||
MV, // 17 - mV - voltage
|
||||
SQM, // 18 - m² - area
|
||||
M3, // 19 - m³ - volume
|
||||
L, // 20 - L - volume
|
||||
KMIN, // 21 - K*min
|
||||
K, // 22 - K - temperature
|
||||
VOLTS, // 23 - V - voltage
|
||||
MBAR, // 24 - mbar - atmospheric pressure
|
||||
LH, // 25 - l/h - volume flow rate
|
||||
CTKWH, // 26 - ct/kWh - monetary
|
||||
HERTZ, // 27 - Hz - frequency
|
||||
CONNECTIVITY, // 28 - used in HA - connectivity
|
||||
TIMESTAMP, // 29 - used in HA - timestamp
|
||||
};
|
||||
|
||||
@@ -82,7 +82,7 @@ void Network::begin() {
|
||||
WiFi.persistent(false);
|
||||
WiFi.setAutoReconnect(false);
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.disconnect(true, true); // wipe old settings in NVS
|
||||
WiFi.disconnect(true, true); // wipe old settings in NVS
|
||||
WiFi.setScanMethod(WIFI_ALL_CHANNEL_SCAN);
|
||||
WiFi.setHostname(hostname_.c_str()); // updates shared default_hostname buffer
|
||||
WiFi.enableSTA(true); // creates the STA netif
|
||||
|
||||
@@ -1532,8 +1532,8 @@ bool System::check_upgrade() {
|
||||
return StateUpdateResult::UNCHANGED;
|
||||
});
|
||||
// Scheduler name is now mandatory, update FS
|
||||
uint8_t i = 0;
|
||||
bool schedule_changed = false;
|
||||
uint8_t i = 0;
|
||||
bool schedule_changed = false;
|
||||
EMSESP::webSchedulerService.update([&](WebScheduler & scheduler) {
|
||||
for (ScheduleItem & scheduleItem : scheduler.scheduleItems) {
|
||||
if (scheduleItem.name[0] == '\0') {
|
||||
@@ -2970,7 +2970,7 @@ bool System::uploadFirmwareURL(const char * url) {
|
||||
|
||||
String scheme = saved_url.substring(0, 8);
|
||||
scheme.toLowerCase();
|
||||
const bool is_https = scheme.startsWith("https://");
|
||||
const bool is_https = scheme.startsWith("https://");
|
||||
const int scheme_len = is_https ? 8 : 7; // "https://" vs "http://"
|
||||
|
||||
WiFiClient basic_client;
|
||||
@@ -2992,11 +2992,11 @@ bool System::uploadFirmwareURL(const char * url) {
|
||||
ssl_client.setBufferSizes(16384, 1024);
|
||||
ssl_client.setSessionTimeout(120);
|
||||
}
|
||||
basic_client.setTimeout(15000); // socket-level read timeout
|
||||
ssl_client.setTimeout(15000); // Stream::readBytes timeout used by Update
|
||||
basic_client.setTimeout(15000); // socket-level read timeout
|
||||
ssl_client.setTimeout(15000); // Stream::readBytes timeout used by Update
|
||||
ssl_client.setClient(&basic_client, is_https); // enableSSL = false for plain HTTP
|
||||
|
||||
const uint16_t port = is_https ? 443 : 80;
|
||||
const uint16_t port = is_https ? 443 : 80;
|
||||
String url_remain = saved_url.substring(scheme_len);
|
||||
int redirect_count = 0;
|
||||
|
||||
|
||||
@@ -304,7 +304,7 @@ class Thermostat : public EMSdevice {
|
||||
uint8_t instantstart;
|
||||
uint8_t coolstart;
|
||||
uint8_t coolondelay;
|
||||
uint8_t cooloffdelay;
|
||||
uint8_t cooloffdelay;
|
||||
|
||||
// HybridHP
|
||||
uint8_t hybridStrategy_; // co2 = 1, cost = 2, temperature = 3, mix = 4
|
||||
|
||||
@@ -417,8 +417,8 @@ bool WebStatusService::refresh_versions_cache() {
|
||||
#else
|
||||
// detect scheme from EMSESP_VERSIONS_URL (case-insensitive). One code path for HTTP and HTTPS,
|
||||
// using ESP_SSLClient as a plain TCP passthrough when SSL is disabled.
|
||||
String url = EMSESP_VERSIONS_URL;
|
||||
String lower = url;
|
||||
String url = EMSESP_VERSIONS_URL;
|
||||
String lower = url;
|
||||
lower.toLowerCase();
|
||||
const bool is_https = lower.startsWith("https://");
|
||||
if (!is_https && !lower.startsWith("http://")) {
|
||||
|
||||
Reference in New Issue
Block a user