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

Commit

Permalink
Pre release stuff
Browse files Browse the repository at this point in the history
- Version number
- clang-format
- Update keyworks.xt
  • Loading branch information
DanNixon committed Sep 23, 2015
1 parent 81cff0c commit fdc19c3
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 30 deletions.
2 changes: 1 addition & 1 deletion INextionColourable.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class INextionColourable : public virtual INextionWidget

bool setEventBackgroundColour(uint32_t colour, bool refresh = true);
uint32_t getEventBackgroundColour();

bool setColour(char *type, uint32_t colour, bool refresh);
uint32_t getColour(char *type);

Expand Down
2 changes: 1 addition & 1 deletion NextionTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class NextionTimer : public INextionTouchable
{
public:
NextionTimer(Nextion &nex, uint8_t page, uint8_t component, const char *name);

uint32_t getCycle();
bool setCycle(uint32_t cycle);

Expand Down
16 changes: 9 additions & 7 deletions NextionWaveform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ bool NextionWaveform::addValue(uint8_t channel, uint8_t value)
snprintf(commandBuffer, commandLen, "add %d,%d,%d", m_componentID, channel,
value);
m_nextion.sendCommand(commandBuffer);

//return m_nextion.checkCommandComplete();

/* TODO: this check still fails but the command does actually work */
/* return m_nextion.checkCommandComplete(); */
return true;
}

bool NextionWaveform::setChannelColour(uint8_t channel, uint32_t colour, bool refresh)
bool NextionWaveform::setChannelColour(uint8_t channel, uint32_t colour,
bool refresh)
{
char buffer[5];
snprintf(buffer, 5, "pco%d", channel);
Expand All @@ -37,7 +39,7 @@ uint32_t NextionWaveform::getChannelColour(uint8_t channel)
snprintf(buffer, 5, "pco%d", channel);
return getColour(buffer);
}

bool NextionWaveform::setGridColour(uint32_t colour, bool refresh)
{
return setColour("gdc", colour, refresh);
Expand All @@ -47,7 +49,7 @@ uint32_t NextionWaveform::getGridColour()
{
return getColour("gdc");
}

bool NextionWaveform::setGridWidth(uint16_t width)
{
return setNumberProperty("gdw", width);
Expand All @@ -57,7 +59,7 @@ uint16_t NextionWaveform::getGridWidth()
{
return getNumberProperty("gdw");
}

bool NextionWaveform::setGridHeight(uint16_t height)
{
return setNumberProperty("gdh", height);
Expand All @@ -66,4 +68,4 @@ bool NextionWaveform::setGridHeight(uint16_t height)
uint16_t NextionWaveform::getGridHeight()
{
return getNumberProperty("gdh");
}
}
8 changes: 4 additions & 4 deletions NextionWaveform.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ class NextionWaveform : public INextionTouchable, public INextionColourable
const char *name);

bool addValue(uint8_t channel, uint8_t value);

bool setChannelColour(uint8_t channel, uint32_t colour, bool refresh = true);
uint32_t getChannelColour(uint8_t channel);

bool setGridColour(uint32_t colour, bool refresh = true);
uint32_t getGridColour();

bool setGridWidth(uint16_t width);
uint16_t getGridWidth();

bool setGridHeight(uint16_t height);
uint16_t getGridHeight();
};
Expand Down
32 changes: 16 additions & 16 deletions examples/Waveform/Waveform.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ void setup()
Serial.println(pgWaveform.show());

Serial.println(waveform.attachCallback(&callback));
Serial.println(waveform.setGridWidth(5));
Serial.println(waveform.getGridWidth());
Serial.println(waveform.setGridHeight(10));
Serial.println(waveform.getGridHeight());
Serial.println(waveform.setChannelColour(0, NEX_COL_WHITE));

for(uint16_t i = 0; i < 100; i++)
{
waveform.addValue(0, i);
waveform.addValue(1, i + 10);
waveform.addValue(2, i + 20);
waveform.addValue(3, i + 30);
}

Serial.println(waveform.setGridWidth(5));
Serial.println(waveform.getGridWidth());

Serial.println(waveform.setGridHeight(10));
Serial.println(waveform.getGridHeight());

Serial.println(waveform.setChannelColour(0, NEX_COL_WHITE));

for (uint16_t i = 0; i < 100; i++)
{
waveform.addValue(0, i);
waveform.addValue(1, i + 10);
waveform.addValue(2, i + 20);
waveform.addValue(3, i + 30);
}
}

void loop()
Expand Down
16 changes: 16 additions & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
#######################################

Nextion KEYWORD1
NextionValue KEYWORD1
NextionFontAlignment KEYWORD1
NextionBackground KEYWORD1
NextionColour KEYWORD1
NextionEventType KEYWORD1
INextionWidget KEYWORD1
INextionColourable KEYWORD1
INextionFontStyleable KEYWORD1
Expand Down Expand Up @@ -89,6 +94,17 @@ show KEYWORD2
isActive KEYWORD2
setActive KEYWORD2

# NextionWaveform
addValue KEYWORD2
setChannelColour KEYWORD2
getChannelColour KEYWORD2
setGridColour KEYWORD2
getGridColour KEYWORD2
setGridWidth KEYWORD2
getGridWidth KEYWORD2
setGridHeight KEYWORD2
getGridHeight 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.2.0
version=2.0.0
author=Dan Nixon
maintainer=Dan Nixon <[email protected]>
sentence=Arduino library for controlling Nextion displays
Expand Down

0 comments on commit fdc19c3

Please sign in to comment.