Skip to content
This repository has been archived by the owner on Dec 24, 2023. It is now read-only.

Commit

Permalink
Pre release clean up
Browse files Browse the repository at this point in the history
- clang-format
- keywords.txt fixes
- set version in library.properties
  • Loading branch information
DanNixon committed Sep 17, 2015
1 parent ddad36e commit 8f8e3ed
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 24 deletions.
7 changes: 3 additions & 4 deletions INextionNumericalValued.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@
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)
{
}

uint32_t getValue()
{
return getNumberProperty("val");
}

bool setValue(uint32_t value)
{
return setNumberProperty("val", value);
Expand Down
8 changes: 4 additions & 4 deletions INextionStringValued.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
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)
{
}

size_t getText(char *buffer, size_t len)
{
return getStringProperty("txt", buffer, len);
}

bool setText(char *buffer)
{
return setStringProperty("txt", buffer);
Expand Down
11 changes: 6 additions & 5 deletions INextionWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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];
Expand All @@ -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];
Expand All @@ -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);
}
}
10 changes: 5 additions & 5 deletions INextionWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions NextionDualStateButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
11 changes: 8 additions & 3 deletions keywords.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#######################################
# Syntax Coloring Map For NeoNextion
#######################################
#######################################
# Class
#######################################

Expand All @@ -24,10 +24,11 @@ NextionTimer KEYWORD1
NextionVariableNumeric KEYWORD1
NextionVariableString KEYWORD1
NextionWaveform KEYWORD1
NextionDualStateButton KEYWORD1

#######################################
# Methods and Functions
#######################################
# Methods and Functions
#######################################

# Nextion
init KEYWORD2
Expand Down Expand Up @@ -84,6 +85,10 @@ setPictureID KEYWORD2
# NextionPage
show KEYWORD2

# NextionDualStateButton
isActive KEYWORD2
setActive KEYWORD2

#######################################
# Constants
#######################################
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=NeoNextion
version=1.0.1
version=1.1.0
author=Dan Nixon
maintainer=Dan Nixon <[email protected]>
sentence=Arduino library for controlling Nextion displays
Expand Down

0 comments on commit 8f8e3ed

Please sign in to comment.