mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-12 18:59:51 +03:00
stub to remove #ifndef EMSESP_STANDALONE
This commit is contained in:
@@ -19,6 +19,8 @@
|
|||||||
#include "esp32-psram/RingBufferStream.h" // Stream-based ring buffer
|
#include "esp32-psram/RingBufferStream.h" // Stream-based ring buffer
|
||||||
#include "esp32-psram/TypedRingBuffer.h" // Typed ring buffer for structured data
|
#include "esp32-psram/TypedRingBuffer.h" // Typed ring buffer for structured data
|
||||||
|
|
||||||
|
#define stringPSRAM std::basic_string<char, std::char_traits<char>, AllocatorPSRAM<char>>
|
||||||
|
|
||||||
#ifndef ESP32_PSRAM_NO_NAMESPACE
|
#ifndef ESP32_PSRAM_NO_NAMESPACE
|
||||||
using namespace esp32_psram;
|
using namespace esp32_psram;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
4
lib_standalone/esp32-psram.h
Normal file
4
lib_standalone/esp32-psram.h
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define stringPSRAM std::string
|
||||||
|
#define AllocatorPSRAM std::allocator
|
||||||
@@ -130,7 +130,7 @@ void AnalogSensor::reload(bool get_nvs) {
|
|||||||
for (const auto & sensor : settings.analogCustomizations) { // search customlist
|
for (const auto & sensor : settings.analogCustomizations) { // search customlist
|
||||||
if (sensor_.gpio() == sensor.gpio) {
|
if (sensor_.gpio() == sensor.gpio) {
|
||||||
// for output sensors set value to new start-value
|
// for output sensors set value to new start-value
|
||||||
if (sensor.type >= AnalogType::DIGITAL_OUT && sensor.type <= AnalogType::PWM_2
|
if (((sensor.type >= AnalogType::DIGITAL_OUT && sensor.type <= AnalogType::PWM_2) || sensor.type >= AnalogType::RGB)
|
||||||
&& (sensor_.type() != sensor.type || sensor_.offset() != sensor.offset || sensor_.factor() != sensor.factor)) {
|
&& (sensor_.type() != sensor.type || sensor_.offset() != sensor.offset || sensor_.factor() != sensor.factor)) {
|
||||||
sensor_.set_value(sensor.offset);
|
sensor_.set_value(sensor.offset);
|
||||||
}
|
}
|
||||||
@@ -164,12 +164,11 @@ void AnalogSensor::reload(bool get_nvs) {
|
|||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
// it's new, we assume it's valid
|
// it's new, we assume it's valid
|
||||||
AnalogType type = static_cast<AnalogType>(sensor.type);
|
sensors_.emplace_back(sensor.gpio, sensor.name, sensor.offset, sensor.factor, sensor.uom, sensor.type, sensor.is_system);
|
||||||
sensors_.emplace_back(sensor.gpio, sensor.name, sensor.offset, sensor.factor, sensor.uom, type, sensor.is_system);
|
|
||||||
|
|
||||||
sensors_.back().ha_registered = false; // this will trigger recreate of the HA config
|
sensors_.back().ha_registered = false; // this will trigger recreate of the HA config
|
||||||
if (sensor.type == AnalogType::COUNTER || sensor.type >= AnalogType::DIGITAL_OUT
|
if (sensor.type == AnalogType::COUNTER || (sensor.type >= AnalogType::DIGITAL_OUT && sensor.type <= AnalogType::PWM_2)
|
||||||
|| (sensor.type >= AnalogType::CNT_0 && sensor.type <= AnalogType::CNT_2)) {
|
|| sensor.type == AnalogType::RGB || (sensor.type >= AnalogType::CNT_0 && sensor.type <= AnalogType::CNT_2)) {
|
||||||
sensors_.back().set_value(sensor.offset);
|
sensors_.back().set_value(sensor.offset);
|
||||||
} else {
|
} else {
|
||||||
sensors_.back().set_value(0); // reset value only for new sensors
|
sensors_.back().set_value(0); // reset value only for new sensors
|
||||||
@@ -374,10 +373,10 @@ void AnalogSensor::measure() {
|
|||||||
uint16_t a = analogReadMilliVolts(sensor.gpio()); // e.g. ADC1_CHANNEL_0_GPIO_NUM
|
uint16_t a = analogReadMilliVolts(sensor.gpio()); // e.g. ADC1_CHANNEL_0_GPIO_NUM
|
||||||
if (!sensor.analog_) { // init first time
|
if (!sensor.analog_) { // init first time
|
||||||
sensor.analog_ = a;
|
sensor.analog_ = a;
|
||||||
sensor.sum_ = a * 512;
|
sensor.sum_ = a * 128;
|
||||||
} else { // simple moving average filter
|
} else { // simple moving average filter
|
||||||
sensor.sum_ = (sensor.sum_ * 511) / 512 + a;
|
sensor.sum_ = (sensor.sum_ * 127) / 128 + a;
|
||||||
sensor.analog_ = sensor.sum_ / 512;
|
sensor.analog_ = sensor.sum_ / 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
// detect change with little hysteresis on raw mV value
|
// detect change with little hysteresis on raw mV value
|
||||||
@@ -427,7 +426,7 @@ void AnalogSensor::measure() {
|
|||||||
auto index = sensor.type() - AnalogType::CNT_0;
|
auto index = sensor.type() - AnalogType::CNT_0;
|
||||||
auto oldval = sensor.value();
|
auto oldval = sensor.value();
|
||||||
portENTER_CRITICAL_ISR(&mux);
|
portENTER_CRITICAL_ISR(&mux);
|
||||||
auto c = edgecnt[index];
|
auto c = edgecnt[index];
|
||||||
edgecnt[index] = 0;
|
edgecnt[index] = 0;
|
||||||
portEXIT_CRITICAL_ISR(&mux);
|
portEXIT_CRITICAL_ISR(&mux);
|
||||||
sensor.set_value(oldval + sensor.factor() * c);
|
sensor.set_value(oldval + sensor.factor() * c);
|
||||||
@@ -709,7 +708,7 @@ void AnalogSensor::publish_values(const bool force) {
|
|||||||
LOG_DEBUG("Recreating HA config for analog sensor GPIO %02d", sensor.gpio());
|
LOG_DEBUG("Recreating HA config for analog sensor GPIO %02d", sensor.gpio());
|
||||||
|
|
||||||
JsonDocument config;
|
JsonDocument config;
|
||||||
config["~"] = Mqtt::base();
|
config["~"] = Mqtt::base();
|
||||||
|
|
||||||
char stat_t[50];
|
char stat_t[50];
|
||||||
snprintf(stat_t, sizeof(stat_t), "~/%s_data", F_(analogsensor)); // use base path
|
snprintf(stat_t, sizeof(stat_t), "~/%s_data", F_(analogsensor)); // use base path
|
||||||
@@ -742,7 +741,7 @@ void AnalogSensor::publish_values(const bool force) {
|
|||||||
snprintf(uniq_s, sizeof(uniq_s), "%s_%02d", F_(analogsensor), sensor.gpio());
|
snprintf(uniq_s, sizeof(uniq_s), "%s_%02d", F_(analogsensor), sensor.gpio());
|
||||||
}
|
}
|
||||||
|
|
||||||
config["~"] = Mqtt::base();
|
config["~"] = Mqtt::base();
|
||||||
config["uniq_id"] = uniq_s;
|
config["uniq_id"] = uniq_s;
|
||||||
|
|
||||||
char name[50];
|
char name[50];
|
||||||
@@ -877,10 +876,11 @@ void AnalogSensor::get_value_json(JsonObject output, const Sensor & sensor) {
|
|||||||
output["value"] = sensor.value();
|
output["value"] = sensor.value();
|
||||||
output["readable"] = true;
|
output["readable"] = true;
|
||||||
output["writeable"] = sensor.type() == AnalogType::COUNTER || sensor.type() == AnalogType::RGB || sensor.type() == AnalogType::PULSE
|
output["writeable"] = sensor.type() == AnalogType::COUNTER || sensor.type() == AnalogType::RGB || sensor.type() == AnalogType::PULSE
|
||||||
|| (sensor.type() >= AnalogType::DIGITAL_OUT && sensor.type() <= AnalogType::PWM_2)|| (sensor.type() >= AnalogType::CNT_0 && sensor.type() <= AnalogType::CNT_2);
|
|| (sensor.type() >= AnalogType::DIGITAL_OUT && sensor.type() <= AnalogType::PWM_2)
|
||||||
|
|| (sensor.type() >= AnalogType::CNT_0 && sensor.type() <= AnalogType::CNT_2);
|
||||||
output["visible"] = true;
|
output["visible"] = true;
|
||||||
output["is_system"] = sensor.is_system();
|
output["is_system"] = sensor.is_system();
|
||||||
if (sensor.type() == AnalogType::COUNTER|| (sensor.type() >= AnalogType::CNT_0 && sensor.type() <= AnalogType::CNT_2)) {
|
if (sensor.type() == AnalogType::COUNTER || (sensor.type() >= AnalogType::CNT_0 && sensor.type() <= AnalogType::CNT_2)) {
|
||||||
output["min"] = 0;
|
output["min"] = 0;
|
||||||
output["max"] = 4000000;
|
output["max"] = 4000000;
|
||||||
output["start_value"] = sensor.offset();
|
output["start_value"] = sensor.offset();
|
||||||
|
|||||||
@@ -25,9 +25,7 @@
|
|||||||
|
|
||||||
#include <uuid/log.h>
|
#include <uuid/log.h>
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
#include <esp32-psram.h>
|
#include <esp32-psram.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
|
|
||||||
@@ -150,11 +148,7 @@ class AnalogSensor {
|
|||||||
bool updated_values();
|
bool updated_values();
|
||||||
|
|
||||||
// return back reference to the sensor list, used by other classes
|
// return back reference to the sensor list, used by other classes
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
std::vector<Sensor, AllocatorPSRAM<Sensor>> sensors() const {
|
std::vector<Sensor, AllocatorPSRAM<Sensor>> sensors() const {
|
||||||
#else
|
|
||||||
std::vector<Sensor> sensors() const {
|
|
||||||
#endif
|
|
||||||
return sensors_;
|
return sensors_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,12 +199,8 @@ class AnalogSensor {
|
|||||||
void addSensorJson(JsonObject output, const Sensor & sensor);
|
void addSensorJson(JsonObject output, const Sensor & sensor);
|
||||||
void get_value_json(JsonObject output, const Sensor & sensor);
|
void get_value_json(JsonObject output, const Sensor & sensor);
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
std::vector<Sensor, AllocatorPSRAM<Sensor>> sensors_; // our list of sensors
|
std::vector<Sensor, AllocatorPSRAM<Sensor>> sensors_; // our list of sensors
|
||||||
#else
|
static std::vector<uint8_t> exclude_types_;
|
||||||
std::vector<Sensor> sensors_; // our list of sensors
|
|
||||||
#endif
|
|
||||||
static std::vector<uint8_t> exclude_types_;
|
|
||||||
|
|
||||||
bool analog_enabled_;
|
bool analog_enabled_;
|
||||||
bool changed_ = true; // this will force a publish of all sensors when initialising
|
bool changed_ = true; // this will force a publish of all sensors when initialising
|
||||||
|
|||||||
@@ -25,9 +25,7 @@
|
|||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#include "emsdevicevalue.h"
|
#include "emsdevicevalue.h"
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
#include <esp32-psram.h>
|
#include <esp32-psram.h>
|
||||||
#endif
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
@@ -552,21 +550,12 @@ class EMSdevice {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
std::vector<uint16_t, AllocatorPSRAM<uint16_t>> handlers_ignored_, handlers_broadcasted_, handlers_config_;
|
std::vector<uint16_t, AllocatorPSRAM<uint16_t>> handlers_ignored_, handlers_broadcasted_, handlers_config_;
|
||||||
#else
|
|
||||||
std::vector<uint16_t> handlers_ignored_, handlers_broadcasted_, handlers_config_;
|
|
||||||
#endif
|
|
||||||
#if defined(EMSESP_STANDALONE) || defined(EMSESP_TEST)
|
#if defined(EMSESP_STANDALONE) || defined(EMSESP_TEST)
|
||||||
public: // so we can call it from WebCustomizationService::load_test_data() and EMSESP::dump_all_entities()
|
public: // so we can call it from WebCustomizationService::load_test_data() and EMSESP::dump_all_entities()
|
||||||
#endif
|
#endif
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
std::vector<TelegramFunction, AllocatorPSRAM<TelegramFunction>> telegram_functions_; // each EMS device has its own set of registered telegram types
|
std::vector<TelegramFunction, AllocatorPSRAM<TelegramFunction>> telegram_functions_; // each EMS device has its own set of registered telegram types
|
||||||
std::vector<DeviceValue, AllocatorPSRAM<DeviceValue>> devicevalues_; // all the device values
|
std::vector<DeviceValue, AllocatorPSRAM<DeviceValue>> devicevalues_; // all the device values
|
||||||
#else
|
|
||||||
std::vector<TelegramFunction> telegram_functions_; // each EMS device has its own set of registered telegram types
|
|
||||||
std::vector<DeviceValue> devicevalues_; // all the device values
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
@@ -72,9 +72,7 @@
|
|||||||
#include "command.h"
|
#include "command.h"
|
||||||
|
|
||||||
#include "../emsesp_version.h"
|
#include "../emsesp_version.h"
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
#include <esp32-psram.h>
|
#include <esp32-psram.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
// Load external modules
|
// Load external modules
|
||||||
class Module {}; // forward declaration
|
class Module {}; // forward declaration
|
||||||
@@ -223,11 +221,7 @@ class EMSESP {
|
|||||||
static void scan_devices();
|
static void scan_devices();
|
||||||
static void clear_all_devices();
|
static void clear_all_devices();
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
static std::vector<std::unique_ptr<EMSdevice>, AllocatorPSRAM<std::unique_ptr<EMSdevice>>> emsdevices;
|
static std::vector<std::unique_ptr<EMSdevice>, AllocatorPSRAM<std::unique_ptr<EMSdevice>>> emsdevices;
|
||||||
#else
|
|
||||||
static std::vector<std::unique_ptr<EMSdevice>> emsdevices;
|
|
||||||
#endif
|
|
||||||
// services
|
// services
|
||||||
static Mqtt mqtt_;
|
static Mqtt mqtt_;
|
||||||
static Modbus * modbus_;
|
static Modbus * modbus_;
|
||||||
@@ -272,11 +266,8 @@ class EMSESP {
|
|||||||
const char * default_name;
|
const char * default_name;
|
||||||
uint8_t flags;
|
uint8_t flags;
|
||||||
};
|
};
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
static std::vector<Device_record, AllocatorPSRAM<Device_record>> device_library_;
|
static std::vector<Device_record, AllocatorPSRAM<Device_record>> device_library_;
|
||||||
#else
|
|
||||||
static std::vector<Device_record> device_library_;
|
|
||||||
#endif
|
|
||||||
static uint16_t watch_id_;
|
static uint16_t watch_id_;
|
||||||
static uint8_t watch_;
|
static uint8_t watch_;
|
||||||
static uint16_t read_id_;
|
static uint16_t read_id_;
|
||||||
|
|||||||
@@ -31,9 +31,9 @@
|
|||||||
#include <esp_wifi.h>
|
#include <esp_wifi.h>
|
||||||
#include <ETH.h>
|
#include <ETH.h>
|
||||||
#include <uuid/syslog.h>
|
#include <uuid/syslog.h>
|
||||||
#include <esp32-psram.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <esp32-psram.h>
|
||||||
#include <uuid/log.h>
|
#include <uuid/log.h>
|
||||||
#include <PButton.h>
|
#include <PButton.h>
|
||||||
|
|
||||||
@@ -395,17 +395,11 @@ class System {
|
|||||||
void led_monitor();
|
void led_monitor();
|
||||||
void system_check();
|
void system_check();
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
static std::vector<uint8_t, AllocatorPSRAM<uint8_t>> string_range_to_vector(const std::string & range);
|
static std::vector<uint8_t, AllocatorPSRAM<uint8_t>> string_range_to_vector(const std::string & range);
|
||||||
|
|
||||||
static std::vector<uint8_t, AllocatorPSRAM<uint8_t>> valid_system_gpios_; // list of valid GPIOs for the ESP32 board that can be used
|
static std::vector<uint8_t, AllocatorPSRAM<uint8_t>> valid_system_gpios_; // list of valid GPIOs for the ESP32 board that can be used
|
||||||
static std::vector<uint8_t, AllocatorPSRAM<uint8_t>> used_gpios_; // list of GPIOs used by the application
|
static std::vector<uint8_t, AllocatorPSRAM<uint8_t>> used_gpios_; // list of GPIOs used by the application
|
||||||
#else
|
|
||||||
static std::vector<uint8_t> string_range_to_vector(const std::string & range);
|
|
||||||
|
|
||||||
static std::vector<uint8_t> valid_system_gpios_; // list of valid GPIOs for the ESP32 board that can be used
|
|
||||||
static std::vector<uint8_t> used_gpios_; // list of GPIOs used by the application
|
|
||||||
#endif
|
|
||||||
int8_t wifi_quality(int8_t dBm);
|
int8_t wifi_quality(int8_t dBm);
|
||||||
|
|
||||||
uint8_t healthcheck_ = HEALTHCHECK_NO_NETWORK | HEALTHCHECK_NO_BUS; // start with all flags set, no wifi and no ems bus connection
|
uint8_t healthcheck_ = HEALTHCHECK_NO_NETWORK | HEALTHCHECK_NO_BUS; // start with all flags set, no wifi and no ems bus connection
|
||||||
|
|||||||
@@ -31,9 +31,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
#include <esp32-psram.h>
|
#include <esp32-psram.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MAX_RX_TELEGRAMS 100 // size of Rx queue
|
#define MAX_RX_TELEGRAMS 100 // size of Rx queue
|
||||||
#define MAX_TX_TELEGRAMS 160 // size of Tx queue
|
#define MAX_TX_TELEGRAMS 160 // size of Tx queue
|
||||||
@@ -290,11 +288,7 @@ class RxService : public EMSbus {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
std::deque<QueuedRxTelegram, AllocatorPSRAM<QueuedRxTelegram>> queue() const {
|
std::deque<QueuedRxTelegram, AllocatorPSRAM<QueuedRxTelegram>> queue() const {
|
||||||
#else
|
|
||||||
std::deque<QueuedRxTelegram> queue() const {
|
|
||||||
#endif
|
|
||||||
return rx_telegrams_;
|
return rx_telegrams_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -305,11 +299,8 @@ class RxService : public EMSbus {
|
|||||||
uint32_t telegram_count_ = 0; // # Rx received
|
uint32_t telegram_count_ = 0; // # Rx received
|
||||||
uint32_t telegram_error_count_ = 0; // # Rx CRC errors
|
uint32_t telegram_error_count_ = 0; // # Rx CRC errors
|
||||||
std::shared_ptr<const Telegram> rx_telegram; // the incoming Rx telegram
|
std::shared_ptr<const Telegram> rx_telegram; // the incoming Rx telegram
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
std::deque<QueuedRxTelegram, AllocatorPSRAM<QueuedRxTelegram>> rx_telegrams_; // the Rx Queue
|
std::deque<QueuedRxTelegram, AllocatorPSRAM<QueuedRxTelegram>> rx_telegrams_; // the Rx Queue
|
||||||
#else
|
|
||||||
std::deque<QueuedRxTelegram> rx_telegrams_; // the Rx Queue
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TxService : public EMSbus {
|
class TxService : public EMSbus {
|
||||||
@@ -430,11 +421,7 @@ class TxService : public EMSbus {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
std::deque<QueuedTxTelegram, AllocatorPSRAM<QueuedTxTelegram>> queue() const {
|
std::deque<QueuedTxTelegram, AllocatorPSRAM<QueuedTxTelegram>> queue() const {
|
||||||
#else
|
|
||||||
std::deque<QueuedTxTelegram> queue() const {
|
|
||||||
#endif
|
|
||||||
return tx_telegrams_;
|
return tx_telegrams_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -446,11 +433,7 @@ class TxService : public EMSbus {
|
|||||||
static constexpr uint32_t POST_SEND_DELAY = 2000;
|
static constexpr uint32_t POST_SEND_DELAY = 2000;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
std::deque<QueuedTxTelegram, AllocatorPSRAM<QueuedTxTelegram>> tx_telegrams_; // the Tx queue
|
std::deque<QueuedTxTelegram, AllocatorPSRAM<QueuedTxTelegram>> tx_telegrams_; // the Tx queue
|
||||||
#else
|
|
||||||
std::deque<QueuedTxTelegram> tx_telegrams_; // the Tx queue
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint32_t telegram_read_count_ = 0; // # Tx successful reads
|
uint32_t telegram_read_count_ = 0; // # Tx successful reads
|
||||||
uint32_t telegram_write_count_ = 0; // # Tx successful writes
|
uint32_t telegram_write_count_ = 0; // # Tx successful writes
|
||||||
|
|||||||
@@ -27,9 +27,10 @@
|
|||||||
|
|
||||||
#include <uuid/log.h>
|
#include <uuid/log.h>
|
||||||
|
|
||||||
|
#include <esp32-psram.h>
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
#include <OneWire.h>
|
#include <OneWire.h>
|
||||||
#include <esp32-psram.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
@@ -172,12 +173,12 @@ class TemperatureSensor {
|
|||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
std::vector<Sensor, AllocatorPSRAM<Sensor>> sensors_; // our list of active sensors
|
std::vector<Sensor, AllocatorPSRAM<Sensor>> sensors_; // our list of active sensors
|
||||||
OneWire bus_;
|
OneWire bus_;
|
||||||
uint32_t last_activity_ = uuid::get_uptime();
|
uint32_t last_activity_ = uuid::get_uptime();
|
||||||
State state_ = State::IDLE;
|
State state_ = State::IDLE;
|
||||||
int8_t scancnt_ = SCAN_START;
|
int8_t scancnt_ = SCAN_START;
|
||||||
uint8_t firstscan_ = 0;
|
uint8_t firstscan_ = 0;
|
||||||
int8_t scanretry_ = 0;
|
int8_t scanretry_ = 0;
|
||||||
#else
|
#else
|
||||||
std::vector<Sensor> sensors_; // our list of active sensors
|
std::vector<Sensor> sensors_; // our list of active sensors
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -16,9 +16,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "../core/telegram.h"
|
#include "../core/telegram.h"
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
#include <esp32-psram.h>
|
#include <esp32-psram.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WebCustomEntityService_h
|
#ifndef WebCustomEntityService_h
|
||||||
#define WebCustomEntityService_h
|
#define WebCustomEntityService_h
|
||||||
@@ -48,11 +46,7 @@ class CustomEntityItem {
|
|||||||
|
|
||||||
class WebCustomEntity {
|
class WebCustomEntity {
|
||||||
public:
|
public:
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
std::list<CustomEntityItem, AllocatorPSRAM<CustomEntityItem>> customEntityItems;
|
std::list<CustomEntityItem, AllocatorPSRAM<CustomEntityItem>> customEntityItems;
|
||||||
#else
|
|
||||||
std::list<CustomEntityItem> customEntityItems;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void read(WebCustomEntity & webEntity, JsonObject root);
|
static void read(WebCustomEntity & webEntity, JsonObject root);
|
||||||
static StateUpdateResult update(JsonObject root, WebCustomEntity & webEntity);
|
static StateUpdateResult update(JsonObject root, WebCustomEntity & webEntity);
|
||||||
@@ -89,11 +83,8 @@ class WebCustomEntityService : public StatefulService<WebCustomEntity> {
|
|||||||
|
|
||||||
void getEntities(AsyncWebServerRequest * request);
|
void getEntities(AsyncWebServerRequest * request);
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
std::list<CustomEntityItem, AllocatorPSRAM<CustomEntityItem>> * customEntityItems_; // pointer to the list of entity items
|
std::list<CustomEntityItem, AllocatorPSRAM<CustomEntityItem>> * customEntityItems_; // pointer to the list of entity items
|
||||||
#else
|
|
||||||
std::list<CustomEntityItem> * customEntityItems_; // pointer to the list of entity items
|
|
||||||
#endif
|
|
||||||
bool ha_registered_ = false;
|
bool ha_registered_ = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,7 @@
|
|||||||
|
|
||||||
#ifndef WebCustomizationService_h
|
#ifndef WebCustomizationService_h
|
||||||
#define WebCustomizationService_h
|
#define WebCustomizationService_h
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
#include <esp32-psram.h>
|
#include <esp32-psram.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#define EMSESP_CUSTOMIZATION_FILE "/config/emsespCustomization.json"
|
#define EMSESP_CUSTOMIZATION_FILE "/config/emsespCustomization.json"
|
||||||
|
|
||||||
@@ -73,15 +71,10 @@ class EntityCustomization {
|
|||||||
|
|
||||||
class WebCustomization {
|
class WebCustomization {
|
||||||
public:
|
public:
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
std::list<SensorCustomization, AllocatorPSRAM<SensorCustomization>> sensorCustomizations; // for sensor names and offsets
|
std::list<SensorCustomization, AllocatorPSRAM<SensorCustomization>> sensorCustomizations; // for sensor names and offsets
|
||||||
std::list<AnalogCustomization, AllocatorPSRAM<AnalogCustomization>> analogCustomizations; // for analog sensors
|
std::list<AnalogCustomization, AllocatorPSRAM<AnalogCustomization>> analogCustomizations; // for analog sensors
|
||||||
std::list<EntityCustomization, AllocatorPSRAM<EntityCustomization>> entityCustomizations; // for a list of entities that have a special mask set
|
std::list<EntityCustomization, AllocatorPSRAM<EntityCustomization>> entityCustomizations; // for a list of entities that have a special mask set
|
||||||
#else
|
|
||||||
std::list<SensorCustomization> sensorCustomizations; // for sensor names and offsets
|
|
||||||
std::list<AnalogCustomization> analogCustomizations; // for analog sensors
|
|
||||||
std::list<EntityCustomization> entityCustomizations; // for a list of entities that have a special mask set
|
|
||||||
#endif
|
|
||||||
static void read(WebCustomization & customizations, JsonObject root);
|
static void read(WebCustomization & customizations, JsonObject root);
|
||||||
static StateUpdateResult update(JsonObject root, WebCustomization & customizations);
|
static StateUpdateResult update(JsonObject root, WebCustomization & customizations);
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,7 @@
|
|||||||
|
|
||||||
#define EMSESP_EVENT_SOURCE_LOG_PATH "/es/log"
|
#define EMSESP_EVENT_SOURCE_LOG_PATH "/es/log"
|
||||||
#define EMSESP_LOG_SETTINGS_PATH "/rest/logSettings"
|
#define EMSESP_LOG_SETTINGS_PATH "/rest/logSettings"
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
#include <esp32-psram.h>
|
#include <esp32-psram.h>
|
||||||
using stringPSRAM = std::basic_string<char, std::char_traits<char>, AllocatorPSRAM<char>>;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using ::uuid::console::Shell;
|
using ::uuid::console::Shell;
|
||||||
|
|
||||||
@@ -59,11 +56,7 @@ class WebLogService : public uuid::log::Handler {
|
|||||||
uint64_t uptime_;
|
uint64_t uptime_;
|
||||||
uuid::log::Level level_;
|
uuid::log::Level level_;
|
||||||
const char * name_;
|
const char * name_;
|
||||||
#ifndef EMSESP_STANDALONE
|
stringPSRAM text_;
|
||||||
stringPSRAM text_;
|
|
||||||
#else
|
|
||||||
std::string text_;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void transmit(const QueuedLogMessage & message);
|
void transmit(const QueuedLogMessage & message);
|
||||||
@@ -71,15 +64,11 @@ class WebLogService : public uuid::log::Handler {
|
|||||||
|
|
||||||
char * messagetime(char * out, const uint64_t t, const size_t bufsize);
|
char * messagetime(char * out, const uint64_t t, const size_t bufsize);
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
std::deque<QueuedLogMessage, AllocatorPSRAM<QueuedLogMessage>> log_messages_; // Queued log messages, in the order they were received
|
std::deque<QueuedLogMessage, AllocatorPSRAM<QueuedLogMessage>> log_messages_; // Queued log messages, in the order they were received
|
||||||
#else
|
size_t maximum_log_messages_ = MAX_LOG_MESSAGES; // Maximum number of log messages to buffer before they are output
|
||||||
std::deque<QueuedLogMessage> log_messages_; // Queued log messages, in the order they were received
|
size_t limit_log_messages_ = 1; // dynamic limit
|
||||||
#endif
|
unsigned long log_message_id_ = 0; // The next identifier to use for queued log messages
|
||||||
size_t maximum_log_messages_ = MAX_LOG_MESSAGES; // Maximum number of log messages to buffer before they are output
|
unsigned long log_message_id_tail_ = 0; // last event shown on the screen after fetch
|
||||||
size_t limit_log_messages_ = 1; // dynamic limit
|
|
||||||
unsigned long log_message_id_ = 0; // The next identifier to use for queued log messages
|
|
||||||
unsigned long log_message_id_tail_ = 0; // last event shown on the screen after fetch
|
|
||||||
bool compact_ = true;
|
bool compact_ = true;
|
||||||
uuid::log::Level level_ = uuid::log::Level::INFO;
|
uuid::log::Level level_ = uuid::log::Level::INFO;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,9 +16,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
#include <esp32-psram.h>
|
#include <esp32-psram.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WebSchedulerService_h
|
#ifndef WebSchedulerService_h
|
||||||
#define WebSchedulerService_h
|
#define WebSchedulerService_h
|
||||||
@@ -113,13 +111,8 @@ class WebSchedulerService : public StatefulService<WebScheduler> {
|
|||||||
FSPersistence<WebScheduler> _fsPersistence;
|
FSPersistence<WebScheduler> _fsPersistence;
|
||||||
bool ha_registered_ = false;
|
bool ha_registered_ = false;
|
||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
|
||||||
std::list<ScheduleItem, AllocatorPSRAM<ScheduleItem>> * scheduleItems_; // pointer to the list of schedule events
|
std::list<ScheduleItem, AllocatorPSRAM<ScheduleItem>> * scheduleItems_; // pointer to the list of schedule events
|
||||||
std::list<ScheduleItem *, AllocatorPSRAM<ScheduleItem *>> cmd_changed_; // pointer to commands in list that are triggert by change
|
std::list<ScheduleItem *, AllocatorPSRAM<ScheduleItem *>> cmd_changed_; // pointer to commands in list that are triggert by change
|
||||||
#else
|
|
||||||
std::list<ScheduleItem> * scheduleItems_; // pointer to the list of schedule events
|
|
||||||
std::list<ScheduleItem *> cmd_changed_; // pointer to commands in list that are triggert by change
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
Reference in New Issue
Block a user