mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-01-30 02:29:12 +03:00
add psram
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <esp32-psram.h>
|
||||
#include <uuid/common.h>
|
||||
#include <uuid/log.h>
|
||||
|
||||
@@ -1645,22 +1646,22 @@ class Shell : public std::enable_shared_from_this<Shell>, public uuid::log::Hand
|
||||
uint8_t cursor_ = 0; /*!< cursor position from end of line */
|
||||
uint8_t esc_ = 0; /*!< esc sequence running */
|
||||
|
||||
Stream & stream_; /*!< Stream used for the input/output of this shell. @since 3.0.0 */
|
||||
std::shared_ptr<Commands> commands_; /*!< Commands available for execution in this shell. @since 0.1.0 */
|
||||
std::deque<unsigned int> context_; /*!< Context stack for this shell. Affects which commands are available. Should never be empty. @since 0.1.0 */
|
||||
unsigned int flags_ = 0; /*!< Current flags for this shell. Affects which commands are available. @since 0.1.0 */
|
||||
Stream & stream_; /*!< Stream used for the input/output of this shell. @since 3.0.0 */
|
||||
std::shared_ptr<Commands> commands_; /*!< Commands available for execution in this shell. @since 0.1.0 */
|
||||
std::deque<unsigned int, AllocatorPSRAM<unsigned int>> context_; /*!< Context stack for this shell. Affects which commands are available. Should never be empty. @since 0.1.0 */
|
||||
unsigned int flags_ = 0; /*!< Current flags for this shell. Affects which commands are available. @since 0.1.0 */
|
||||
#if UUID_CONSOLE_THREAD_SAFE
|
||||
mutable std::mutex mutex_; /*!< Mutex for queued log messages. @since 1.0.0 */
|
||||
#endif
|
||||
unsigned long log_message_id_ = 0; /*!< The next identifier to use for queued log messages. @since 0.1.0 */
|
||||
std::list<QueuedLogMessage> log_messages_; /*!< Queued log messages, in the order they were received. @since 0.1.0 */
|
||||
size_t maximum_log_messages_ = MAX_LOG_MESSAGES; /*!< Maximum command line length in bytes. @since 0.6.0 */
|
||||
std::string line_buffer_; /*!< Command line buffer. Limited to maximum_command_line_length() bytes. @since 0.1.0 */
|
||||
size_t maximum_command_line_length_ = MAX_COMMAND_LINE_LENGTH; /*!< Maximum command line length in bytes. @since 0.6.0 */
|
||||
unsigned char previous_ = 0; /*!< Previous character that was entered on the command line. Used to detect CRLF line endings. @since 0.1.0 */
|
||||
Mode mode_ = Mode::NORMAL; /*!< Current execution mode. @since 0.1.0 */
|
||||
std::unique_ptr<ModeData> mode_data_ = nullptr; /*!< Data associated with the current execution mode. @since 0.1.0 */
|
||||
bool stopped_ = false; /*!< Indicates that the shell has been stopped. @since 0.1.0 */
|
||||
unsigned long log_message_id_ = 0; /*!< The next identifier to use for queued log messages. @since 0.1.0 */
|
||||
std::list<QueuedLogMessage, AllocatorPSRAM<QueuedLogMessage>> log_messages_; /*!< Queued log messages, in the order they were received. @since 0.1.0 */
|
||||
size_t maximum_log_messages_ = MAX_LOG_MESSAGES; /*!< Maximum command line length in bytes. @since 0.6.0 */
|
||||
std::string line_buffer_; /*!< Command line buffer. Limited to maximum_command_line_length() bytes. @since 0.1.0 */
|
||||
size_t maximum_command_line_length_ = MAX_COMMAND_LINE_LENGTH; /*!< Maximum command line length in bytes. @since 0.6.0 */
|
||||
unsigned char previous_ = 0; /*!< Previous character that was entered on the command line. Used to detect CRLF line endings. @since 0.1.0 */
|
||||
Mode mode_ = Mode::NORMAL; /*!< Current execution mode. @since 0.1.0 */
|
||||
std::unique_ptr<ModeData> mode_data_ = nullptr; /*!< Data associated with the current execution mode. @since 0.1.0 */
|
||||
bool stopped_ = false; /*!< Indicates that the shell has been stopped. @since 0.1.0 */
|
||||
bool prompt_displayed_ = false; /*!< Indicates that a command prompt has been displayed, so that the output of invoke_command() is correct. @since 0.1.0 */
|
||||
uint64_t idle_time_ = 0; /*!< Time the shell became idle. @since 0.7.0 */
|
||||
uint64_t idle_timeout_ = 0; /*!< Idle timeout (in milliseconds). @since 0.7.0 */
|
||||
@@ -1786,7 +1787,7 @@ class CommandLine {
|
||||
* @return A reference to the parameters.
|
||||
* @since 0.6.0
|
||||
*/
|
||||
inline std::vector<std::string> & operator*() {
|
||||
inline std::vector<std::string, AllocatorPSRAM<std::string>> & operator*() {
|
||||
return parameters_;
|
||||
}
|
||||
/**
|
||||
@@ -1795,7 +1796,7 @@ class CommandLine {
|
||||
* @return A reference to the parameters.
|
||||
* @since 0.6.0
|
||||
*/
|
||||
inline const std::vector<std::string> & operator*() const {
|
||||
inline const std::vector<std::string, AllocatorPSRAM<std::string>> & operator*() const {
|
||||
return parameters_;
|
||||
}
|
||||
/**
|
||||
@@ -1804,7 +1805,7 @@ class CommandLine {
|
||||
* @return A pointer to the parameters.
|
||||
* @since 0.4.0
|
||||
*/
|
||||
inline std::vector<std::string> * operator->() {
|
||||
inline std::vector<std::string, AllocatorPSRAM<std::string>> * operator->() {
|
||||
return ¶meters_;
|
||||
}
|
||||
/**
|
||||
@@ -1813,7 +1814,7 @@ class CommandLine {
|
||||
* @return A pointer to the parameters.
|
||||
* @since 0.4.0
|
||||
*/
|
||||
inline const std::vector<std::string> * operator->() const {
|
||||
inline const std::vector<std::string, AllocatorPSRAM<std::string>> * operator->() const {
|
||||
return ¶meters_;
|
||||
}
|
||||
|
||||
@@ -1843,8 +1844,8 @@ class CommandLine {
|
||||
bool trailing_space = false; /*!< Command line has a trailing space. @since 0.4.0 */
|
||||
|
||||
private:
|
||||
std::vector<std::string> parameters_; /*!< Separate command line parameters. @since 0.4.0 */
|
||||
size_t escape_parameters_ = std::numeric_limits<size_t>::max(); /*!< Number of initial arguments to escape in output. @since 0.5.0 */
|
||||
std::vector<std::string, AllocatorPSRAM<std::string>> parameters_; /*!< Separate command line parameters. @since 0.4.0 */
|
||||
size_t escape_parameters_ = std::numeric_limits<size_t>::max(); /*!< Number of initial arguments to escape in output. @since 0.5.0 */
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -232,7 +232,7 @@ void Logger::vlog(Level level, const char * format, va_list ap) const {
|
||||
}
|
||||
|
||||
void Logger::vlog(Level level, Facility facility, const char * format, va_list ap) const {
|
||||
std::vector<char> text(MAX_LOG_LENGTH + 1);
|
||||
std::vector<char, AllocatorPSRAM<char>> text(MAX_LOG_LENGTH + 1);
|
||||
|
||||
if (vsnprintf(text.data(), text.size(), format, ap) <= 0) {
|
||||
return;
|
||||
@@ -241,7 +241,7 @@ void Logger::vlog(Level level, Facility facility, const char * format, va_list a
|
||||
dispatch(level, facility, text);
|
||||
}
|
||||
|
||||
void Logger::dispatch(Level level, Facility facility, std::vector<char> & text) const {
|
||||
void Logger::dispatch(Level level, Facility facility, std::vector<char, AllocatorPSRAM<char>> & text) const {
|
||||
std::shared_ptr<Message> message = std::make_shared<Message>(get_uptime_ms(), level, facility, name_, text.data());
|
||||
text.resize(0);
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <esp32-psram.h>
|
||||
#include <uuid/common.h>
|
||||
|
||||
#ifndef UUID_COMMON_THREAD_SAFE
|
||||
@@ -645,7 +646,7 @@ class Logger {
|
||||
* @param[in] text Log message text.
|
||||
* @since 1.0.0
|
||||
*/
|
||||
void dispatch(Level level, Facility facility, std::vector<char> & text) const;
|
||||
void dispatch(Level level, Facility facility, std::vector<char, AllocatorPSRAM<char>> & text) const;
|
||||
|
||||
static std::atomic<Level> global_level_; /*!< Minimum global log level across all handlers. @since 3.0.0 */
|
||||
#if UUID_LOG_THREAD_SAFE
|
||||
@@ -723,7 +724,7 @@ class PrintHandler : public uuid::log::Handler {
|
||||
mutable std::mutex mutex_; /*!< Mutex for configuration, state and queued log messages. @since 2.3.0 */
|
||||
#endif
|
||||
size_t maximum_log_messages_ = MAX_LOG_MESSAGES; /*!< Maximum number of log messages to buffer before they are output. @since 2.2.0 */
|
||||
std::list<std::shared_ptr<Message>> log_messages_; /*!< Queued log messages, in the order they were received. @since 2.2.0 */
|
||||
std::list<std::shared_ptr<Message>, AllocatorPSRAM<std::shared_ptr<Message>>> log_messages_; /*!< Queued log messages, in the order they were received. @since 2.2.0 */
|
||||
};
|
||||
|
||||
} // namespace log
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <esp32-psram.h>
|
||||
#include <uuid/log.h>
|
||||
|
||||
#ifndef UUID_LOG_THREAD_SAFE
|
||||
@@ -321,7 +322,7 @@ class SyslogService : public uuid::log::Handler {
|
||||
#endif
|
||||
size_t maximum_log_messages_ = MAX_LOG_MESSAGES; /*!< Maximum number of log messages to buffer before they are output. @since 1.0.0 */
|
||||
unsigned long log_message_id_ = 0; /*!< The next identifier to use for queued log messages. @since 1.0.0 */
|
||||
std::list<QueuedLogMessage> log_messages_; /*!< Queued log messages, in the order they were received. @since 1.0.0 */
|
||||
std::list<QueuedLogMessage, AllocatorPSRAM<QueuedLogMessage>> log_messages_; /*!< Queued log messages, in the order they were received. @since 1.0.0 */
|
||||
uint64_t mark_interval_ = 0; /*!< Mark interval in milliseconds. @since 2.0.0 */
|
||||
uint64_t last_message_ = 0; /*!< Last message/mark time. @since 2.0.0 */
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@ size_t TelnetStream::write(uint8_t data) {
|
||||
}
|
||||
|
||||
size_t TelnetStream::write(const uint8_t * buffer, size_t size) {
|
||||
std::vector<unsigned char> data;
|
||||
std::vector<unsigned char, AllocatorPSRAM<unsigned char>> data;
|
||||
data.reserve(size);
|
||||
|
||||
while (size-- > 0) {
|
||||
@@ -310,7 +310,7 @@ size_t TelnetStream::raw_write(unsigned char data) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t TelnetStream::raw_write(const std::vector<unsigned char> & data) {
|
||||
size_t TelnetStream::raw_write(const std::vector<unsigned char, AllocatorPSRAM<unsigned char>> & data) {
|
||||
return raw_write(reinterpret_cast<const unsigned char *>(data.data()), data.size());
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <esp32-psram.h>
|
||||
#include <uuid/console.h>
|
||||
|
||||
namespace uuid {
|
||||
@@ -203,7 +204,7 @@ class TelnetStream : public ::Stream {
|
||||
* @return The number of bytes that were output.
|
||||
* @since 0.1.0
|
||||
*/
|
||||
size_t raw_write(const std::vector<unsigned char> & data);
|
||||
size_t raw_write(const std::vector<unsigned char, AllocatorPSRAM<unsigned char>> & data);
|
||||
/**
|
||||
* Write an array of bytes directly to the output stream.
|
||||
*
|
||||
@@ -222,7 +223,7 @@ class TelnetStream : public ::Stream {
|
||||
unsigned char previous_in_ = 0; /*!< Previous character that was received. Used to detect CR NUL. @since 0.1.0 */
|
||||
unsigned char previous_out_ = 0; /*!< Previous character that was sent. Used to insert NUL after CR without LF. @since 0.1.0 */
|
||||
int peek_ = -1; /*!< Previously read data cached by peek(). @since 0.1.0 */
|
||||
std::vector<char> output_buffer_; /*!< Buffer data to be output until a read function is called. @since 0.1.0 */
|
||||
std::vector<char, AllocatorPSRAM<char>> output_buffer_; /*!< Buffer data to be output until a read function is called. @since 0.1.0 */
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -425,7 +426,7 @@ class TelnetService {
|
||||
|
||||
WiFiServer server_; /*!< TCP server. @since 0.1.0 */
|
||||
size_t maximum_connections_ = MAX_CONNECTIONS; /*!< Maximum number of concurrent open connections. @since 0.1.0 */
|
||||
std::list<Connection> connections_; /*!< Open connections. @since 0.1.0 */
|
||||
std::list<Connection, AllocatorPSRAM<Connection>> connections_; /*!< Open connections. @since 0.1.0 */
|
||||
shell_factory_function shell_factory_; /*!< Function to create a shell. @since 0.1.0 */
|
||||
unsigned long initial_idle_timeout_ = DEFAULT_IDLE_TIMEOUT; /*!< Initial idle timeout (in seconds). @since 0.1.0 */
|
||||
unsigned long write_timeout_ = DEFAULT_WRITE_TIMEOUT; /*!< Write timeout (in milliseconds). @since 0.1.0 */
|
||||
|
||||
Reference in New Issue
Block a user