mirror of
https://github.com/thelsing/knx.git
synced 2026-02-23 13:50:35 +01:00
fix examples. Only reserve memory on tableobject if size > 0
This commit is contained in:
@@ -102,7 +102,10 @@ uint8_t* TableObject::restore(uint8_t* buffer)
|
||||
if (_data)
|
||||
_platform.freeMemory(_data);
|
||||
|
||||
_data = _platform.allocMemory(_size);
|
||||
if (_size > 0)
|
||||
_data = _platform.allocMemory(_size);
|
||||
else
|
||||
_data = 0;
|
||||
|
||||
buffer = popByteArray(_data, _size, buffer);
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ Bau57B0 bau(platform);
|
||||
#endif
|
||||
KnxFacade knx(bau);
|
||||
|
||||
void buttonUp()
|
||||
{
|
||||
void buttonUp()
|
||||
{
|
||||
if (knx.progMode())
|
||||
{
|
||||
digitalWrite(knx.ledPin(), LOW);
|
||||
@@ -23,7 +23,7 @@ void buttonUp()
|
||||
}
|
||||
}
|
||||
|
||||
KnxFacade::KnxFacade(BauSystemB& bau) : _bau(bau)
|
||||
KnxFacade::KnxFacade(BauSystemB& bau) : _bau(bau)
|
||||
{
|
||||
manufacturerId(0xfa);
|
||||
_bau.addSaveRestore(this);
|
||||
@@ -116,12 +116,12 @@ void KnxFacade::version(uint16_t value)
|
||||
|
||||
void KnxFacade::start()
|
||||
{
|
||||
pinMode(_ledPin, OUTPUT);
|
||||
|
||||
pinMode(_buttonPin, INPUT_PULLUP);
|
||||
|
||||
attachInterrupt(_buttonPin, buttonUp, RISING);
|
||||
enabled(true);
|
||||
pinMode(_ledPin, OUTPUT);
|
||||
|
||||
pinMode(_buttonPin, INPUT_PULLUP);
|
||||
|
||||
attachInterrupt(_buttonPin, buttonUp, RISING);
|
||||
enabled(true);
|
||||
}
|
||||
|
||||
uint8_t* KnxFacade::paramData(uint32_t addr)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
class LinuxPlatform: public Platform
|
||||
{
|
||||
using Platform::_memoryReference;
|
||||
using Platform::memoryReference;
|
||||
public:
|
||||
LinuxPlatform();
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ float maxValue = 0;
|
||||
float minValue = RAND_MAX;
|
||||
long lastsend = 0;
|
||||
|
||||
#define CURR bau.groupObjectTable().get(0)
|
||||
#define MAX bau.groupObjectTable().get(1)
|
||||
#define MIN bau.groupObjectTable().get(2)
|
||||
#define RESET bau.groupObjectTable().get(3)
|
||||
#define CURR bau.groupObjectTable().get(1)
|
||||
#define MAX bau.groupObjectTable().get(2)
|
||||
#define MIN bau.groupObjectTable().get(3)
|
||||
#define RESET bau.groupObjectTable().get(4)
|
||||
|
||||
void measureTemp()
|
||||
{
|
||||
@@ -31,6 +31,7 @@ void measureTemp()
|
||||
currentValue = (r * 1.0) / (RAND_MAX * 1.0);
|
||||
currentValue *= 100 * 100;
|
||||
|
||||
|
||||
CURR.objectWrite(currentValue);
|
||||
|
||||
if (currentValue > maxValue)
|
||||
|
||||
Reference in New Issue
Block a user