From 129d7a40f3b405ddd6362d58a3a93146dcfed9d0 Mon Sep 17 00:00:00 2001 From: camilo Date: Wed, 5 Jun 2024 10:20:37 -0500 Subject: [PATCH] fix cast on logger. Other minor fixes. bump to 1.5.9 --- doc/Doxygen | 2 +- library.json | 2 +- library.properties | 2 +- src/CMakeLists.txt | 2 +- src/QuarkTS.h | 10 +++++----- src/include/input.hpp | 11 ++++++----- src/include/logger.hpp | 1 + src/input.cpp | 2 +- src/logger.cpp | 21 ++++++++++++++++----- 9 files changed, 33 insertions(+), 20 deletions(-) diff --git a/doc/Doxygen b/doc/Doxygen index 737ac13f..6a0e4c45 100644 --- a/doc/Doxygen +++ b/doc/Doxygen @@ -38,7 +38,7 @@ PROJECT_NAME = "OS" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = v1.5.8 +PROJECT_NUMBER = v1.5.9 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/library.json b/library.json index 8fdfb3c1..2ab33a7e 100644 --- a/library.json +++ b/library.json @@ -16,7 +16,7 @@ "maintainer": true } ], - "version": "1.5.8", + "version": "1.5.9", "license": "MIT", "frameworks": "arduino", "platforms": "*" diff --git a/library.properties b/library.properties index 51d28ca7..08afce34 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=QuarkTS -version=1.5.8 +version=1.5.9 license=MIT author=J. Camilo Gomez C. maintainer=J. Camilo Gomez C. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bf4faf30..4e981609 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required( VERSION 3.2 ) project( quarkts-cpp - VERSION 1.5.8 + VERSION 1.5.9 DESCRIPTION "An open-source OS for small embedded applications" LANGUAGES CXX ) diff --git a/src/QuarkTS.h b/src/QuarkTS.h index 665b79fc..94ff8c7b 100644 --- a/src/QuarkTS.h +++ b/src/QuarkTS.h @@ -1,7 +1,7 @@ /*! * @file QuarkTS.h * @author J. Camilo Gomez C. - * @version 1.5.8 + * @version 1.5.9 * @note This file is part of the QuarkTS++ distribution. * @brief Global inclusion header **/ @@ -41,8 +41,8 @@ This file is part of the QuarkTS++ OS distribution. #ifndef QOS_CPP_H #define QOS_CPP_H -#define QUARKTS_CPP_VERSION "1.5.8" -#define QUARKTS_CPP_VERNUM ( 158u ) +#define QUARKTS_CPP_VERSION "1.5.9" +#define QUARKTS_CPP_VERNUM ( 159u ) #define QUARKTS_CPP_CAPTION "QuarkTS++ OS " QUARKTS_CPP_VERSION #include "config/config.h" @@ -70,7 +70,7 @@ namespace qOS { constexpr const uint8_t number = QUARKTS_CPP_VERNUM; constexpr const uint8_t mayor = 1U; constexpr const uint8_t minor = 5U; - constexpr const uint8_t rev = 8U; + constexpr const uint8_t rev = 9U; } namespace product { constexpr const char* author = "J. Camilo Gomez C."; @@ -84,7 +84,7 @@ namespace qOS { } namespace build { - constexpr const uint32_t number = 4122; + constexpr const uint32_t number = 4123; constexpr const char* date = __DATE__; constexpr const char* time = __TIME__; constexpr const char* std = "c++11"; diff --git a/src/include/input.hpp b/src/include/input.hpp index 3c31e376..16c18152 100644 --- a/src/include/input.hpp +++ b/src/include/input.hpp @@ -70,7 +70,7 @@ namespace qOS { /*! @endcond */ /** - * @brief An digital input-channel object. + * @brief An input-channel object, could be either analog or digital. */ class channel : protected node { private: @@ -207,17 +207,18 @@ namespace qOS { return ( &value != ptrValue ); } /** - * @brief Set/Change the interval duration between multiple press - * for a digital input + * @brief Set/Change the interval duration between multiple + * pulsations for a digital input * @param[in] interval The specified interval * @return @c true on success. Otherwise @c false. */ - inline bool setMultiPressInterval( qOS::duration_t interval ) + inline bool setPulsationInterval( qOS::duration_t interval ) { bool retValue = false; if ( ( input::type::DIGITAL == channelType ) && ( interval > 50 ) ) { pulsationInterval = interval; + retValue = true; } return retValue; @@ -228,7 +229,7 @@ namespace qOS { * the input event-callback. * @return The pulsation count. */ - inline uint8_t getMultiPressCount( void ) const { + inline uint8_t getPulsationCount( void ) const { return pulsationCount; } friend class watcher; diff --git a/src/include/logger.hpp b/src/include/logger.hpp index 49204d90..eb466a88 100644 --- a/src/include/logger.hpp +++ b/src/include/logger.hpp @@ -360,6 +360,7 @@ namespace qOS { _logger& operator<<( const qOS::timer& t ); _logger& operator<<( const qOS::stateMachine& sm ); _logger& operator<<( const qOS::sm::state& s ); + _logger& operator<<( const qOS::trigger& t ); _logger& operator<<( const qOS::input::channel& in ); _logger& operator<<( const qOS::input::event& e ); diff --git a/src/input.cpp b/src/input.cpp index 24e3d38b..462093b6 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -326,7 +326,7 @@ bool input::watcher::add( channel& c ) noexcept bool input::watcher::remove( channel& c ) noexcept { list *channelContainer = c.getContainer(); - bool retValue = channelContainer->remove( &c ); + const bool retValue = channelContainer->remove( &c ); c.ptrValue = &c.value; if ( ( input::type::ANALOG == c.channelType ) && !c.isShared() ) { diff --git a/src/logger.cpp b/src/logger.cpp index 281e7926..72a220a9 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -118,7 +118,7 @@ namespace qOS { _logger& _logger::operator<<( const void * const p ) { /*cstat -CERT-INT36-C*/ - (void)util::unsignedToString( reinterpret_cast( p ), buffer, 16U ); // skipcq: CXX-C1000 + (void)util::unsignedToString( reinterpret_cast( p ), buffer, 16U ); // skipcq: CXX-C1000 /*cstat +CERT-INT36-C*/ (void)util::outputString( writeChar, "p@0x" ); (void)util::outputString( writeChar, buffer ); // skipcq: CXX-C1000 @@ -200,10 +200,10 @@ namespace qOS { _logger& _logger::operator<<( const qOS::stateMachine& sm ) { (void)util::outputString( writeChar , "SM{ T: 0x" ); - (void)util::unsignedToString( reinterpret_cast( &sm.getTop() ), buffer, 16 ); // skipcq: CXX-C1000 + (void)util::unsignedToString( reinterpret_cast( &sm.getTop() ), buffer, 16 ); // skipcq: CXX-C1000 (void)util::outputString( writeChar , buffer ); // skipcq: CXX-C1000 (void)util::outputString( writeChar , ", C: 0x" ); - (void)util::unsignedToString( reinterpret_cast( sm.getCurrent() ), buffer, 16 ); // skipcq: CXX-C1000 + (void)util::unsignedToString( reinterpret_cast( sm.getCurrent() ), buffer, 16 ); // skipcq: CXX-C1000 (void)util::outputString( writeChar , buffer ); // skipcq: CXX-C1000 (void)util::outputString( writeChar , " } " ); return *this; @@ -212,16 +212,27 @@ namespace qOS { _logger& _logger::operator<<( const qOS::sm::state& s ) { (void)util::outputString( writeChar , "s{ 0x" ); - (void)util::unsignedToString( reinterpret_cast( &s ), buffer, 16 ); // skipcq: CXX-C1000 + (void)util::unsignedToString( reinterpret_cast( &s ), buffer, 16 ); // skipcq: CXX-C1000 (void)util::outputString( writeChar , buffer ); // skipcq: CXX-C1000 (void)util::outputString( writeChar , " } " ); return *this; } + _logger& _logger::operator<<( const qOS::trigger& t ) + { + static const char *str[ static_cast( qOS::input::event::MAX_EVENTS ) + 1 ] = { // skipcq: CXX-W2066 + "None ", "byTimeElapsed ", "byNotificationQueued ", "byNotificationSimple ", + "byQueueReceiver ", "byQueueFull ", "byQueueCount ", "byQueueEmpty ", + "byEventFlags ", "bySchedulingRelease ", "byNoReadyTasks " + }; + (void)util::outputString( writeChar , str[ static_cast( t ) ] ); // skipcq: CXX-C1000 + return *this; + } + _logger& _logger::operator<<( const qOS::input::channel& in ) { (void)util::outputString( writeChar , "in{ 0x" ); - (void)util::unsignedToString( reinterpret_cast( &in ), buffer, 16 ); // skipcq: CXX-C1000 + (void)util::unsignedToString( reinterpret_cast( &in ), buffer, 16 ); // skipcq: CXX-C1000 (void)util::outputString( writeChar , buffer ); // skipcq: CXX-C1000 (void)util::outputString( writeChar , ( qOS::input::type::ANALOG == in.getChannelType() ) ? ", ANALOG, C: " : ", DIGITAL, C: " ); (void)util::unsignedToString( static_cast( in.getChannel() ), buffer, 10 ); // skipcq: CXX-C1000