From f4d2bae04f286be9b5b68e044db403df406e566f Mon Sep 17 00:00:00 2001 From: proddy Date: Thu, 22 Jan 2026 16:38:52 +0100 Subject: [PATCH] add psram --- lib/uuid-console/src/uuid/console.h | 39 +++++++++++++++-------------- lib/uuid-log/src/log.cpp | 4 +-- lib/uuid-log/src/uuid/log.h | 5 ++-- lib/uuid-syslog/src/uuid/syslog.h | 3 ++- lib/uuid-telnet/src/stream.cpp | 4 +-- lib/uuid-telnet/src/uuid/telnet.h | 7 +++--- 6 files changed, 33 insertions(+), 29 deletions(-) diff --git a/lib/uuid-console/src/uuid/console.h b/lib/uuid-console/src/uuid/console.h index e8f54d79e..1730058e9 100644 --- a/lib/uuid-console/src/uuid/console.h +++ b/lib/uuid-console/src/uuid/console.h @@ -34,6 +34,7 @@ #include #include +#include #include #include @@ -1645,22 +1646,22 @@ class Shell : public std::enable_shared_from_this, 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 available for execution in this shell. @since 0.1.0 */ - std::deque 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 available for execution in this shell. @since 0.1.0 */ + std::deque> 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 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 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> 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 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 & operator*() { + inline std::vector> & operator*() { return parameters_; } /** @@ -1795,7 +1796,7 @@ class CommandLine { * @return A reference to the parameters. * @since 0.6.0 */ - inline const std::vector & operator*() const { + inline const std::vector> & operator*() const { return parameters_; } /** @@ -1804,7 +1805,7 @@ class CommandLine { * @return A pointer to the parameters. * @since 0.4.0 */ - inline std::vector * operator->() { + inline std::vector> * operator->() { return ¶meters_; } /** @@ -1813,7 +1814,7 @@ class CommandLine { * @return A pointer to the parameters. * @since 0.4.0 */ - inline const std::vector * operator->() const { + inline const std::vector> * 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 parameters_; /*!< Separate command line parameters. @since 0.4.0 */ - size_t escape_parameters_ = std::numeric_limits::max(); /*!< Number of initial arguments to escape in output. @since 0.5.0 */ + std::vector> parameters_; /*!< Separate command line parameters. @since 0.4.0 */ + size_t escape_parameters_ = std::numeric_limits::max(); /*!< Number of initial arguments to escape in output. @since 0.5.0 */ }; /** diff --git a/lib/uuid-log/src/log.cpp b/lib/uuid-log/src/log.cpp index b10a4ba6a..2515a8b10 100644 --- a/lib/uuid-log/src/log.cpp +++ b/lib/uuid-log/src/log.cpp @@ -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 text(MAX_LOG_LENGTH + 1); + std::vector> 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 & text) const { +void Logger::dispatch(Level level, Facility facility, std::vector> & text) const { std::shared_ptr message = std::make_shared(get_uptime_ms(), level, facility, name_, text.data()); text.resize(0); diff --git a/lib/uuid-log/src/uuid/log.h b/lib/uuid-log/src/uuid/log.h index 66e932a23..beac1b189 100644 --- a/lib/uuid-log/src/uuid/log.h +++ b/lib/uuid-log/src/uuid/log.h @@ -31,6 +31,7 @@ #include #include +#include #include #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 & text) const; + void dispatch(Level level, Facility facility, std::vector> & text) const; static std::atomic 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> log_messages_; /*!< Queued log messages, in the order they were received. @since 2.2.0 */ + std::list, AllocatorPSRAM>> log_messages_; /*!< Queued log messages, in the order they were received. @since 2.2.0 */ }; } // namespace log diff --git a/lib/uuid-syslog/src/uuid/syslog.h b/lib/uuid-syslog/src/uuid/syslog.h index a7f725238..58f91dae4 100644 --- a/lib/uuid-syslog/src/uuid/syslog.h +++ b/lib/uuid-syslog/src/uuid/syslog.h @@ -28,6 +28,7 @@ #include #include +#include #include #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 log_messages_; /*!< Queued log messages, in the order they were received. @since 1.0.0 */ + std::list> 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 */ diff --git a/lib/uuid-telnet/src/stream.cpp b/lib/uuid-telnet/src/stream.cpp index adf5f16ec..c59b02787 100644 --- a/lib/uuid-telnet/src/stream.cpp +++ b/lib/uuid-telnet/src/stream.cpp @@ -249,7 +249,7 @@ size_t TelnetStream::write(uint8_t data) { } size_t TelnetStream::write(const uint8_t * buffer, size_t size) { - std::vector data; + std::vector> 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 & data) { +size_t TelnetStream::raw_write(const std::vector> & data) { return raw_write(reinterpret_cast(data.data()), data.size()); } diff --git a/lib/uuid-telnet/src/uuid/telnet.h b/lib/uuid-telnet/src/uuid/telnet.h index fb1245de9..a679859b7 100644 --- a/lib/uuid-telnet/src/uuid/telnet.h +++ b/lib/uuid-telnet/src/uuid/telnet.h @@ -33,6 +33,7 @@ #include #include +#include #include 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 & data); + size_t raw_write(const std::vector> & 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 output_buffer_; /*!< Buffer data to be output until a read function is called. @since 0.1.0 */ + std::vector> 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 connections_; /*!< Open connections. @since 0.1.0 */ + std::list> 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 */