From 8f8e3edac008a70ce1ccbfddd73c65baa7ff73d5 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Thu, 17 Sep 2015 10:07:40 +0100 Subject: [PATCH] Pre release clean up - clang-format - keywords.txt fixes - set version in library.properties --- INextionNumericalValued.h | 7 +++---- INextionStringValued.h | 8 ++++---- INextionWidget.cpp | 11 ++++++----- INextionWidget.h | 10 +++++----- NextionDualStateButton.h | 5 +++-- keywords.txt | 11 ++++++++--- library.properties | 2 +- 7 files changed, 30 insertions(+), 24 deletions(-) diff --git a/INextionNumericalValued.h b/INextionNumericalValued.h index 2006cc9..2c8a388 100644 --- a/INextionNumericalValued.h +++ b/INextionNumericalValued.h @@ -9,10 +9,9 @@ class INextionNumericalValued : public virtual INextionWidget { public: - INextionNumericalValued(Nextion *nex, uint8_t page, - uint8_t component, + INextionNumericalValued(Nextion *nex, uint8_t page, uint8_t component, const char *name) - : INextionWidget(nex, page, component, name) + : INextionWidget(nex, page, component, name) { } @@ -20,7 +19,7 @@ class INextionNumericalValued : public virtual INextionWidget { return getNumberProperty("val"); } - + bool setValue(uint32_t value) { return setNumberProperty("val", value); diff --git a/INextionStringValued.h b/INextionStringValued.h index c61bd5f..414f007 100644 --- a/INextionStringValued.h +++ b/INextionStringValued.h @@ -9,9 +9,9 @@ class INextionStringValued : public virtual INextionWidget { public: - INextionStringValued(Nextion *nex, uint8_t page, - uint8_t component, const char *name) - : INextionWidget(nex, page, component, name) + INextionStringValued(Nextion *nex, uint8_t page, uint8_t component, + const char *name) + : INextionWidget(nex, page, component, name) { } @@ -19,7 +19,7 @@ class INextionStringValued : public virtual INextionWidget { return getStringProperty("txt", buffer, len); } - + bool setText(char *buffer) { return setStringProperty("txt", buffer); diff --git a/INextionWidget.cpp b/INextionWidget.cpp index ddf749f..c3e7c71 100644 --- a/INextionWidget.cpp +++ b/INextionWidget.cpp @@ -9,7 +9,7 @@ INextionWidget::INextionWidget(Nextion *nex, uint8_t page, uint8_t component, { } -bool INextionWidget::setNumberProperty(char * propertyName, uint32_t value) +bool INextionWidget::setNumberProperty(char *propertyName, uint32_t value) { size_t commandLen = 8 + strlen(m_name) + strlen(propertyName); char comandBuffer[commandLen]; @@ -18,7 +18,7 @@ bool INextionWidget::setNumberProperty(char * propertyName, uint32_t value) return m_nextion->checkCommandComplete(); } -uint32_t INextionWidget::getNumberProperty(char * propertyName) +uint32_t INextionWidget::getNumberProperty(char *propertyName) { size_t commandLen = 6 + strlen(m_name) + strlen(propertyName); char comandBuffer[commandLen]; @@ -31,7 +31,7 @@ uint32_t INextionWidget::getNumberProperty(char * propertyName) return 0; } -bool INextionWidget::setStringProperty(char * propertyName, char * value) +bool INextionWidget::setStringProperty(char *propertyName, char *value) { size_t commandLen = 7 + strlen(m_name) + strlen(propertyName) + strlen(value); char command[commandLen]; @@ -40,11 +40,12 @@ bool INextionWidget::setStringProperty(char * propertyName, char * value) return m_nextion->checkCommandComplete(); } -size_t INextionWidget::getStringProperty(char * propertyName, char * value, size_t len) +size_t INextionWidget::getStringProperty(char *propertyName, char *value, + size_t len) { size_t commandLen = 6 + strlen(m_name) + strlen(propertyName); char command[commandLen]; snprintf(command, commandLen, "get %s.%s", m_name, propertyName); m_nextion->sendCommand(command); return m_nextion->receiveString(value, len); -} \ No newline at end of file +} diff --git a/INextionWidget.h b/INextionWidget.h index 5fcb382..741ce25 100644 --- a/INextionWidget.h +++ b/INextionWidget.h @@ -9,11 +9,11 @@ class INextionWidget public: INextionWidget(Nextion *nex, uint8_t page, uint8_t component, const char *name); - - bool setNumberProperty(char * propertyName, uint32_t value); - uint32_t getNumberProperty(char * propertyName); - bool setStringProperty(char * propertyName, char * value); - size_t getStringProperty(char * propertyName, char * buffer, size_t len); + + bool setNumberProperty(char *propertyName, uint32_t value); + uint32_t getNumberProperty(char *propertyName); + bool setStringProperty(char *propertyName, char *value); + size_t getStringProperty(char *propertyName, char *buffer, size_t len); protected: Nextion *m_nextion; diff --git a/NextionDualStateButton.h b/NextionDualStateButton.h index 41de94f..7fe5a96 100644 --- a/NextionDualStateButton.h +++ b/NextionDualStateButton.h @@ -12,14 +12,15 @@ class NextionDualStateButton : public INextionTouchable, private INextionNumericalValued { public: - NextionDualStateButton(Nextion *nex, uint8_t page, uint8_t component, const char *name) + NextionDualStateButton(Nextion *nex, uint8_t page, uint8_t component, + const char *name) : INextionWidget(nex, page, component, name) , INextionTouchable(nex, page, component, name) , INextionColourable(nex, page, component, name) , INextionNumericalValued(nex, page, component, name) { } - + bool isActive() { return getValue(); diff --git a/keywords.txt b/keywords.txt index 41fc3c8..a6ff4da 100644 --- a/keywords.txt +++ b/keywords.txt @@ -1,6 +1,6 @@ ####################################### # Syntax Coloring Map For NeoNextion -####################################### +####################################### # Class ####################################### @@ -24,10 +24,11 @@ NextionTimer KEYWORD1 NextionVariableNumeric KEYWORD1 NextionVariableString KEYWORD1 NextionWaveform KEYWORD1 +NextionDualStateButton KEYWORD1 ####################################### -# Methods and Functions -####################################### +# Methods and Functions +####################################### # Nextion init KEYWORD2 @@ -84,6 +85,10 @@ setPictureID KEYWORD2 # NextionPage show KEYWORD2 +# NextionDualStateButton +isActive KEYWORD2 +setActive KEYWORD2 + ####################################### # Constants ####################################### diff --git a/library.properties b/library.properties index 985d8ad..5ac1f9c 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=NeoNextion -version=1.0.1 +version=1.1.0 author=Dan Nixon maintainer=Dan Nixon sentence=Arduino library for controlling Nextion displays