mirror of
https://github.com/thelsing/knx.git
synced 2026-02-23 13:50:35 +01:00
make GOT completely dynamic from ETS. GOs are now only available if device was programmed via ETS
This commit is contained in:
@@ -2,33 +2,18 @@
|
||||
#include <knx.h>
|
||||
#include <WiFiManager.h>
|
||||
|
||||
// declare array of all groupobjects with their sizes in byte
|
||||
GroupObject groupObjects[]
|
||||
{
|
||||
GroupObject(2),
|
||||
GroupObject(2),
|
||||
GroupObject(2),
|
||||
GroupObject(2),
|
||||
GroupObject(2),
|
||||
GroupObject(1),
|
||||
GroupObject(2),
|
||||
GroupObject(2),
|
||||
GroupObject(1),
|
||||
GroupObject(2)
|
||||
}
|
||||
;
|
||||
|
||||
// create named references for easy access to group objects
|
||||
GroupObject& goRawTemperature = groupObjects[0];
|
||||
GroupObject& goPressure = groupObjects[1];
|
||||
GroupObject& goRawHumidity = groupObjects[2];
|
||||
GroupObject& goGasResistance = groupObjects[3];
|
||||
GroupObject& goIaqEstimate = groupObjects[4];
|
||||
GroupObject& goIaqAccurace = groupObjects[5];
|
||||
GroupObject& goTemperature = groupObjects[6];
|
||||
GroupObject& goHumidity = groupObjects[7];
|
||||
GroupObject& goTriggerSample = groupObjects[8];
|
||||
GroupObject& goCo2Ppm = groupObjects[9];
|
||||
#define goRawTemperature knx.getGroupObject(0)
|
||||
#define goPressure knx.getGroupObject(1)
|
||||
#define goRawHumidity knx.getGroupObject(2)
|
||||
#define goGasResistance knx.getGroupObject(3)
|
||||
#define goIaqEstimate knx.getGroupObject(4)
|
||||
#define goIaqAccurace knx.getGroupObject(5)
|
||||
#define goTemperature knx.getGroupObject(6)
|
||||
#define goHumidity knx.getGroupObject(7)
|
||||
#define goTriggerSample knx.getGroupObject(8)
|
||||
#define goCo2Ppm knx.getGroupObject(9)
|
||||
|
||||
#define STATE_SAVE_PERIOD UINT32_C(360 * 60 * 1000) // 360 minutes - 4 times a day
|
||||
|
||||
@@ -62,14 +47,12 @@ void setup(void)
|
||||
WiFiManager wifiManager;
|
||||
wifiManager.autoConnect("knx-bme680");
|
||||
|
||||
// register group objects
|
||||
knx.registerGroupObjects(groupObjects, 10);
|
||||
|
||||
// read adress table, association table, groupobject table and parameters from eeprom
|
||||
knx.readMemory();
|
||||
|
||||
// register callback for reset GO
|
||||
goTriggerSample.callback(triggerCallback);
|
||||
if(knx.configured())
|
||||
goTriggerSample.callback(triggerCallback);
|
||||
|
||||
|
||||
iaqSensor.begin(BME680_I2C_ADDR_SECONDARY, Wire);
|
||||
|
||||
@@ -1,19 +1,11 @@
|
||||
#include <knx.h>
|
||||
|
||||
// declare array of all groupobjects with their sizes in byte
|
||||
GroupObject groupObjects[]
|
||||
{
|
||||
GroupObject(2),
|
||||
GroupObject(2),
|
||||
GroupObject(2),
|
||||
GroupObject(1)
|
||||
};
|
||||
|
||||
// create named references for easy access to group objects
|
||||
GroupObject& goCurrent = groupObjects[0];
|
||||
GroupObject& goMax = groupObjects[1];
|
||||
GroupObject& goMin = groupObjects[2];
|
||||
GroupObject& goReset = groupObjects[3];
|
||||
#define goCurrent knx.getGroupObject(0)
|
||||
#define goMax knx.getGroupObject(1)
|
||||
#define goMin knx.getGroupObject(2)
|
||||
#define goReset knx.getGroupObject(3)
|
||||
|
||||
float currentValue = 0;
|
||||
float maxValue = 0;
|
||||
@@ -64,17 +56,15 @@ void setup()
|
||||
|
||||
randomSeed(millis());
|
||||
|
||||
// register group objects
|
||||
knx.registerGroupObjects(groupObjects, 4);
|
||||
// read adress table, association table, groupobject table and parameters from eeprom
|
||||
knx.readMemory();
|
||||
|
||||
// register callback for reset GO
|
||||
goReset.callback(resetCallback);
|
||||
|
||||
// print values of parameters if device is already configured
|
||||
if (knx.configured())
|
||||
{
|
||||
// register callback for reset GO
|
||||
goReset.callback(resetCallback);
|
||||
|
||||
SerialDBG.print("Timeout: "); SerialDBG.println(knx.paramByte(0));
|
||||
SerialDBG.print("Zykl. senden: "); SerialDBG.println(knx.paramByte(1));
|
||||
SerialDBG.print("Min/Max senden: "); SerialDBG.println(knx.paramByte(2));
|
||||
|
||||
@@ -3,19 +3,10 @@
|
||||
|
||||
#define RELAYPIN 12
|
||||
|
||||
// declare array of all groupobjects with their sizes in byte
|
||||
GroupObject groupObjects[]
|
||||
{
|
||||
GroupObject(1),
|
||||
GroupObject(1),
|
||||
GroupObject(1)
|
||||
};
|
||||
|
||||
// create named references for easy access to group objects
|
||||
GroupObject& goSwitch = groupObjects[0];
|
||||
GroupObject& goBlock = groupObjects[1];
|
||||
GroupObject& goStatus = groupObjects[2];
|
||||
|
||||
#define goSwitch knx.getGroupObject(0)
|
||||
#define goBlock knx.getGroupObject(1)
|
||||
#define goStatus knx.getGroupObject(2)
|
||||
|
||||
|
||||
// callback from switch-GO
|
||||
@@ -33,17 +24,18 @@ void setup()
|
||||
{
|
||||
SerialDBG.begin(115200);
|
||||
|
||||
WiFiManager wifiManager;
|
||||
WiFiManager wifiManager;
|
||||
wifiManager.autoConnect("knx-sonoffS20");
|
||||
|
||||
// register group objects
|
||||
knx.registerGroupObjects(groupObjects, 3);
|
||||
// read adress table, association table, groupobject table and parameters from eeprom
|
||||
knx.readMemory();
|
||||
|
||||
// register callback for reset GO
|
||||
goSwitch.callback(switchCallback);
|
||||
|
||||
if (knx.configured())
|
||||
{
|
||||
// register callback for reset GO
|
||||
goSwitch.callback(switchCallback);
|
||||
}
|
||||
|
||||
// start the framework. Will get wifi first.
|
||||
knx.start();
|
||||
}
|
||||
@@ -54,7 +46,7 @@ void loop()
|
||||
knx.loop();
|
||||
|
||||
// only run the application code if the device was configured with ETS
|
||||
if (!knx.configured())
|
||||
if(!knx.configured())
|
||||
return;
|
||||
|
||||
// nothing else to do.
|
||||
|
||||
Reference in New Issue
Block a user