fix build

This commit is contained in:
Thomas Kunze 2024-08-30 21:29:16 +02:00
parent f9ba9acc3d
commit b687cd24d9
15 changed files with 38 additions and 625 deletions

3
build_pio.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
~/.platformio/penv/bin/platformio ci --lib="." --project-conf=examples/knx-usb/platformio-ci.ini examples/knx-usb/src/main.cpp && ~/.platformio/penv/bin/platformio ci --lib="." --project-conf=examples/knx-demo/platformio-ci.ini examples/knx-demo/knx-demo.ino && ~/.platformio/penv/bin/platformio ci --lib="." --project-conf=examples/knx-demo-coupler/platformio-ci.ini examples/knx-demo-coupler/knx-demo-coupler.ino

View File

@ -1,5 +0,0 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch

View File

@ -1,133 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<KNX xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" CreatedBy="KNX MT" ToolVersion="5.6.407.26745" xmlns="http://knx.org/xml/project/11">
<ManufacturerData>
<Manufacturer RefId="M-00FA">
<Catalog>
<CatalogSection Id="M-00FA_CS-1" Name="Geräte" Number="1" DefaultLanguage="en-US">
<CatalogItem Id="M-00FA_H-0124-0_HP-ABCE-79-0000_CI-IA4313-1" Name="Temperatursensor TP" Number="1" ProductRefId="M-00FA_H-0124-0_P-IA4313" Hardware2ProgramRefId="M-00FA_H-0124-0_HP-ABCE-79-0000" DefaultLanguage="en-US" />
</CatalogSection>
</Catalog>
<ApplicationPrograms>
<ApplicationProgram Id="M-00FA_A-ABCE-79-0000" ApplicationNumber="43982" ApplicationVersion="121" ProgramType="ApplicationProgram" MaskVersion="MV-07B0" Name="TK TEMP TP" LoadProcedureStyle="MergedProcedure" PeiType="0" DefaultLanguage="en-US" DynamicTableManagement="false" Linkable="false" MinEtsVersion="4.0">
<Static>
<Code>
<RelativeSegment Id="M-00FA_A-ABCE-79-0000_RS-04-00000" Name="Parameters" Offset="0" Size="8" LoadStateMachine="4" />
</Code>
<ParameterTypes>
<ParameterType Id="M-00FA_A-ABCE-79-0000_PT-startupTimeout" Name="startupTimeout">
<TypeRestriction Base="Value" SizeInBit="8">
<Enumeration Text="0 s" Value="0" Id="M-00FA_A-ABCE-79-0000_PT-startupTimeout_EN-0" />
<Enumeration Text="1 s" Value="1" Id="M-00FA_A-ABCE-79-0000_PT-startupTimeout_EN-1" />
<Enumeration Text="2 s" Value="2" Id="M-00FA_A-ABCE-79-0000_PT-startupTimeout_EN-2" />
<Enumeration Text="3 s" Value="3" Id="M-00FA_A-ABCE-79-0000_PT-startupTimeout_EN-3" />
<Enumeration Text="4 s" Value="4" Id="M-00FA_A-ABCE-79-0000_PT-startupTimeout_EN-4" />
<Enumeration Text="5 s" Value="5" Id="M-00FA_A-ABCE-79-0000_PT-startupTimeout_EN-5" />
<Enumeration Text="6 s" Value="6" Id="M-00FA_A-ABCE-79-0000_PT-startupTimeout_EN-6" />
</TypeRestriction>
</ParameterType>
<ParameterType Id="M-00FA_A-ABCE-79-0000_PT-TempChange" Name="TempChange">
<TypeRestriction Base="Value" SizeInBit="8">
<Enumeration Text="Disabled" Value="0" Id="M-00FA_A-ABCE-79-0000_PT-TempChange_EN-0" />
<Enumeration Text="0.1 K" Value="1" Id="M-00FA_A-ABCE-79-0000_PT-TempChange_EN-1" />
<Enumeration Text="0.2 K" Value="2" Id="M-00FA_A-ABCE-79-0000_PT-TempChange_EN-2" />
<Enumeration Text="0.3 K" Value="3" Id="M-00FA_A-ABCE-79-0000_PT-TempChange_EN-3" />
</TypeRestriction>
</ParameterType>
<ParameterType Id="M-00FA_A-ABCE-79-0000_PT-TempCycle" Name="TempCycle">
<TypeRestriction Base="Value" SizeInBit="8">
<Enumeration Text="Disabled" Value="0" Id="M-00FA_A-ABCE-79-0000_PT-TempCycle_EN-0" />
<Enumeration Text="1 min" Value="1" Id="M-00FA_A-ABCE-79-0000_PT-TempCycle_EN-1" />
<Enumeration Text="2 min" Value="2" Id="M-00FA_A-ABCE-79-0000_PT-TempCycle_EN-2" />
<Enumeration Text="3 min" Value="3" Id="M-00FA_A-ABCE-79-0000_PT-TempCycle_EN-3" />
</TypeRestriction>
</ParameterType>
<ParameterType Id="M-00FA_A-ABCE-79-0000_PT-TempAbgleich" Name="TempAbgleich">
<TypeNumber SizeInBit="32" Type="signedInt" minInclusive="-50" maxInclusive="50" />
</ParameterType>
<ParameterType Id="M-00FA_A-ABCE-79-0000_PT-TempSendMinMax" Name="TempSendMinMax">
<TypeRestriction Base="Value" SizeInBit="8">
<Enumeration Text="Disabled" Value="0" Id="M-00FA_A-ABCE-79-0000_PT-TempSendMinMax_EN-0" />
<Enumeration Text="Send Enable" Value="1" Id="M-00FA_A-ABCE-79-0000_PT-TempSendMinMax_EN-1" />
</TypeRestriction>
</ParameterType>
</ParameterTypes>
<Parameters>
<Parameter Id="M-00FA_A-ABCE-79-0000_P-1" Name="startupTimeout" ParameterType="M-00FA_A-ABCE-79-0000_PT-startupTimeout" Text="Startup delaytime" Value="0">
<Memory CodeSegment="M-00FA_A-ABCE-79-0000_RS-04-00000" Offset="0" BitOffset="0" />
</Parameter>
<Parameter Id="M-00FA_A-ABCE-79-0000_P-2" Name="Aender Senden" ParameterType="M-00FA_A-ABCE-79-0000_PT-TempChange" Text="Send actual value after change of" Value="0">
<Memory CodeSegment="M-00FA_A-ABCE-79-0000_RS-04-00000" Offset="1" BitOffset="0" />
</Parameter>
<Parameter Id="M-00FA_A-ABCE-79-0000_P-3" Name="ZyklSenden" ParameterType="M-00FA_A-ABCE-79-0000_PT-TempCycle" Text="Send actual temperature cyclically" Value="0">
<Memory CodeSegment="M-00FA_A-ABCE-79-0000_RS-04-00000" Offset="2" BitOffset="0" />
</Parameter>
<Parameter Id="M-00FA_A-ABCE-79-0000_P-4" Name="MinMaxSenden" ParameterType="M-00FA_A-ABCE-79-0000_PT-TempSendMinMax" Text="Send min/max value" Value="0">
<Memory CodeSegment="M-00FA_A-ABCE-79-0000_RS-04-00000" Offset="3" BitOffset="0" />
</Parameter>
<Parameter Id="M-00FA_A-ABCE-79-0000_P-5" Name="Abgleich" ParameterType="M-00FA_A-ABCE-79-0000_PT-TempAbgleich" Text="Internal sensor correction value (value * 0.1 K)" Value="0">
<Memory CodeSegment="M-00FA_A-ABCE-79-0000_RS-04-00000" Offset="4" BitOffset="0" />
</Parameter>
</Parameters>
<ParameterRefs>
<ParameterRef Id="M-00FA_A-ABCE-79-0000_P-1_R-1" RefId="M-00FA_A-ABCE-79-0000_P-1" />
<ParameterRef Id="M-00FA_A-ABCE-79-0000_P-2_R-2" RefId="M-00FA_A-ABCE-79-0000_P-2" />
<ParameterRef Id="M-00FA_A-ABCE-79-0000_P-3_R-3" RefId="M-00FA_A-ABCE-79-0000_P-3" />
<ParameterRef Id="M-00FA_A-ABCE-79-0000_P-4_R-4" RefId="M-00FA_A-ABCE-79-0000_P-4" />
<ParameterRef Id="M-00FA_A-ABCE-79-0000_P-5_R-5" RefId="M-00FA_A-ABCE-79-0000_P-5" />
</ParameterRefs>
<ComObjectTable>
<ComObject Id="M-00FA_A-ABCE-79-0000_O-1" Name="Current temperature value" Text="Current temperature value" Number="1" FunctionText="Transmit temperature value" ObjectSize="2 Bytes" ReadFlag="Enabled" WriteFlag="Disabled" CommunicationFlag="Enabled" TransmitFlag="Enabled" UpdateFlag="Disabled" ReadOnInitFlag="Disabled" DatapointType="" />
<ComObject Id="M-00FA_A-ABCE-79-0000_O-2" Name="Max memory value" Text="Max memory value" Number="2" FunctionText="Read memory" ObjectSize="2 Bytes" ReadFlag="Enabled" WriteFlag="Disabled" CommunicationFlag="Enabled" TransmitFlag="Enabled" UpdateFlag="Disabled" ReadOnInitFlag="Disabled" DatapointType="" />
<ComObject Id="M-00FA_A-ABCE-79-0000_O-3" Name="Min memory value" Text="Min memory value" Number="3" FunctionText="Read memory" ObjectSize="2 Bytes" ReadFlag="Enabled" WriteFlag="Disabled" CommunicationFlag="Enabled" TransmitFlag="Enabled" UpdateFlag="Disabled" ReadOnInitFlag="Disabled" DatapointType="" />
<ComObject Id="M-00FA_A-ABCE-79-0000_O-4" Name="Min/max memory reseet" Text="Min/max memory reseet" Number="4" FunctionText="Reset memory" ObjectSize="1 Bit" ReadFlag="Disabled" WriteFlag="Enabled" CommunicationFlag="Enabled" TransmitFlag="Disabled" UpdateFlag="Disabled" ReadOnInitFlag="Disabled" DatapointType="" />
</ComObjectTable>
<ComObjectRefs>
<ComObjectRef Id="M-00FA_A-ABCE-79-0000_O-1_R-1" RefId="M-00FA_A-ABCE-79-0000_O-1" />
<ComObjectRef Id="M-00FA_A-ABCE-79-0000_O-2_R-2" RefId="M-00FA_A-ABCE-79-0000_O-2" />
<ComObjectRef Id="M-00FA_A-ABCE-79-0000_O-3_R-3" RefId="M-00FA_A-ABCE-79-0000_O-3" />
<ComObjectRef Id="M-00FA_A-ABCE-79-0000_O-4_R-4" RefId="M-00FA_A-ABCE-79-0000_O-4" />
</ComObjectRefs>
<AddressTable MaxEntries="65000" />
<AssociationTable MaxEntries="65000" />
<LoadProcedures>
<LoadProcedure MergeId="2">
<LdCtrlRelSegment AppliesTo="full" LsmIdx="4" Size="8" Mode="0" Fill="0" />
</LoadProcedure>
<LoadProcedure MergeId="4">
<LdCtrlWriteRelMem ObjIdx="4" Offset="0" Size="8" Verify="true" />
</LoadProcedure>
</LoadProcedures>
<Options />
</Static>
<Dynamic>
<ChannelIndependentBlock>
<ParameterBlock Id="M-00FA_A-ABCE-79-0000_PB-1" Name="ParameterPage" Text="Allgemeine Parameter">
<ParameterRefRef RefId="M-00FA_A-ABCE-79-0000_P-1_R-1" />
<ParameterRefRef RefId="M-00FA_A-ABCE-79-0000_P-2_R-2" />
<ParameterRefRef RefId="M-00FA_A-ABCE-79-0000_P-3_R-3" />
<ParameterRefRef RefId="M-00FA_A-ABCE-79-0000_P-4_R-4" />
<ParameterRefRef RefId="M-00FA_A-ABCE-79-0000_P-5_R-5" />
<ComObjectRefRef RefId="M-00FA_A-ABCE-79-0000_O-1_R-1" />
<ComObjectRefRef RefId="M-00FA_A-ABCE-79-0000_O-2_R-2" />
<ComObjectRefRef RefId="M-00FA_A-ABCE-79-0000_O-3_R-3" />
<ComObjectRefRef RefId="M-00FA_A-ABCE-79-0000_O-4_R-4" />
</ParameterBlock>
</ChannelIndependentBlock>
</Dynamic>
</ApplicationProgram>
</ApplicationPrograms>
<Hardware>
<Hardware Id="M-00FA_H-0124-0" Name="SAMD Random" SerialNumber="0124" VersionNumber="0" BusCurrent="10" HasIndividualAddress="true" HasApplicationProgram="true">
<Products>
<Product Id="M-00FA_H-0124-0_P-IA4313" Text="Temperatursensor TP" OrderNumber="IA4313" IsRailMounted="false" DefaultLanguage="en-US" />
</Products>
<Hardware2Programs>
<Hardware2Program Id="M-00FA_H-0124-0_HP-ABCE-79-0000" MediumTypes="MT-0">
<ApplicationProgramRef RefId="M-00FA_A-ABCE-79-0000" />
</Hardware2Program>
</Hardware2Programs>
</Hardware>
</Hardware>
</Manufacturer>
</ManufacturerData>
</KNX>

View File

@ -1,138 +0,0 @@
#include <knx.h>
#include <knx/bau07B0.h>
#ifdef ARDUINO_ARCH_ESP8266
#include <WiFiManager.h>
#endif
// create named references for easy access to group objects
#define goCurrent knx.getGroupObject(1)
#define goMax knx.getGroupObject(2)
#define goMin knx.getGroupObject(3)
#define goReset knx.getGroupObject(4)
// If you don't want a global knx object, for example because you want
// to more finely control it's construction, this is an example
// of how to do so. Define KNX_NO_AUTOMATIC_GLOBAL_INSTANCE
// and then you can DIY a knx object as shown below. In this case we use
// the ESP32's secondary UART and late-bind the ISR function in setup().
Esp32Platform knxPlatform(&Serial2);
Bau07B0 knxBau(knxPlatform);
KnxFacade<Esp32Platform, Bau07B0> knx(knxBau);
ICACHE_RAM_ATTR void myButtonPressed()
{
// Debounce
static uint32_t lastpressed=0;
if (millis() - lastpressed > 200)
{
knx.toggleProgMode();
lastpressed = millis();
}
}
float currentValue = 0;
float maxValue = 0;
float minValue = RAND_MAX;
long lastsend = 0;
void measureTemp()
{
long now = millis();
if ((now - lastsend) < 2000)
return;
lastsend = now;
int r = rand();
currentValue = (r * 1.0) / (RAND_MAX * 1.0);
currentValue *= 100 * 100;
// write new value to groupobject
goCurrent.value(currentValue);
if (currentValue > maxValue)
{
maxValue = currentValue;
goMax.value(maxValue);
}
if (currentValue < minValue)
{
minValue = currentValue;
goMin.value(minValue);
}
}
// callback from reset-GO
void resetCallback(GroupObject& go)
{
if (go.value())
{
maxValue = 0;
minValue = 10000;
}
}
void setup()
{
knx.setButtonISRFunction(myButtonPressed);
Serial.begin(115200);
ArduinoPlatform::SerialDebug = &Serial;
Serial2.begin(19200); // KNX, pin 16,17 on EPS32
randomSeed(millis());
#ifdef ARDUINO_ARCH_ESP8266
WiFiManager wifiManager;
wifiManager.autoConnect("knx-demo");
#endif
// read adress table, association table, groupobject table and parameters from eeprom
knx.readMemory();
// print values of parameters if device is already configured
if (knx.configured())
{
// register callback for reset GO
goReset.callback(resetCallback);
goReset.dataPointType(DPT_Trigger);
goCurrent.dataPointType(DPT_Value_Temp);
goMin.dataPointType(DPT_Value_Temp);
goMax.dataPointType(DPT_Value_Temp);
Serial.print("Timeout: ");
Serial.println(knx.paramByte(0));
Serial.print("Zykl. senden: ");
Serial.println(knx.paramByte(1));
Serial.print("Min/Max senden: ");
Serial.println(knx.paramByte(2));
Serial.print("Aenderung senden: ");
Serial.println(knx.paramByte(3));
Serial.print("Abgleich: ");
Serial.println(knx.paramByte(4));
}
// pin or GPIO the programming led is connected to. Default is LED_BUILTIN
// knx.ledPin(LED_BUILTIN);
// is the led active on HIGH or low? Default is LOW
// knx.ledPinActiveOn(HIGH);
// pin or GPIO programming button is connected to. Default is 0
// knx.buttonPin(0);
// start the framework.
knx.start();
}
void loop()
{
// don't delay here to much. Otherwise you might lose packages or mess up the timing with ETS
knx.loop();
// only run the application code if the device was configured with ETS
if (!knx.configured())
return;
measureTemp();
}

View File

@ -1,24 +0,0 @@
;PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
;
;--- ESP32 -----------------------------------------------
[env:esp32dev_tp]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
knx
build_flags =
-DMASK_VERSION=0x07B0
-Wno-unknown-pragmas
-DKNX_NO_AUTOMATIC_GLOBAL_INSTANCE

View File

@ -1,33 +0,0 @@
;PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[platformio]
; We have to keep libdeps dir out the project directory otherwise,
; library scanner seems to have issues so compilation fails
libdeps_dir = /tmp/libdeps
src_dir = .
;--- ESP32 -----------------------------------------------
[env:esp32dev_tp]
platform = espressif32
board = esp32dev
framework = arduino
; We consider that the this projects is opened within its project directory
; while working with VS Code.
lib_extra_dirs = ../../../
lib_deps =
knx
build_flags =
-DMASK_VERSION=0x07B0
-Wno-unknown-pragmas
-DKNX_NO_AUTOMATIC_GLOBAL_INSTANCE

View File

@ -1,129 +0,0 @@
#include <knx.h>
#ifdef ARDUINO_ARCH_ESP8266
#include <WiFiManager.h>
#endif
/*****************************************
* changes necessary for SMALL_GROUPOBJECT
* are commented with //**
* This project can be used with any
* of the knxprod files of the original
* knx-demo project.
*****************************************/
// create named references for easy access to group objects
#define goCurrent knx.getGroupObject(1)
#define goMax knx.getGroupObject(2)
#define goMin knx.getGroupObject(3)
#define goReset knx.getGroupObject(4)
float currentValue = 0;
float maxValue = 0;
float minValue = RAND_MAX;
long lastsend = 0;
void measureTemp()
{
long now = millis();
if ((now - lastsend) < 2000)
return;
lastsend = now;
int r = rand();
currentValue = (r * 1.0) / (RAND_MAX * 1.0);
currentValue *= 100 * 100;
// write new value to groupobject
goCurrent.value(currentValue, DPT_Value_Temp); //** each value access needs to done with according DPT parameter
if (currentValue > maxValue)
{
maxValue = currentValue;
goMax.value(maxValue, DPT_Value_Temp); //** each value access needs to done with according DPT parameter
}
if (currentValue < minValue)
{
minValue = currentValue;
goMin.value(minValue, DPT_Value_Temp); //** each value access needs to done with according DPT parameter
}
}
// callback from reset-GO
void resetCallback(GroupObject& go)
{
//** callbacks are now handled in the class, not per instance,
//** this means, we have to check, which GroupObject is calling back
if (go.asap() == goReset.asap())
{
if (go.value(DPT_Trigger)) //** each value access needs to done with according DPT parameter
{
maxValue = 0;
minValue = 10000;
}
}
}
void setup()
{
Serial.begin(115200);
ArduinoPlatform::SerialDebug = &Serial;
randomSeed(millis());
#ifdef ARDUINO_ARCH_ESP8266
WiFiManager wifiManager;
wifiManager.autoConnect("knx-demo");
#endif
// read adress table, association table, groupobject table and parameters from eeprom
knx.readMemory();
// print values of parameters if device is already configured
if (knx.configured())
{
// register callback for reset GO
GroupObject::classCallback(resetCallback); //** callbacks are now handled per class, not per instance
//** there is no global assignment of DPT for GroupObjects
// goReset.dataPointType(DPT_Trigger);
// goCurrent.dataPointType(DPT_Value_Temp);
// goMin.dataPointType(DPT_Value_Temp);
// goMax.dataPointType(DPT_Value_Temp);
Serial.print("Timeout: ");
Serial.println(knx.paramByte(0));
Serial.print("Zykl. senden: ");
Serial.println(knx.paramByte(1));
Serial.print("Min/Max senden: ");
Serial.println(knx.paramByte(2));
Serial.print("Aenderung senden: ");
Serial.println(knx.paramByte(3));
Serial.print("Abgleich: ");
Serial.println(knx.paramByte(4));
}
// pin or GPIO the programming led is connected to. Default is LED_BUILTIN
// knx.ledPin(LED_BUILTIN);
// is the led active on HIGH or low? Default is LOW
// knx.ledPinActiveOn(HIGH);
// pin or GPIO programming button is connected to. Default is 0
// knx.buttonPin(0);
// Is the interrup created in RISING or FALLING signal? Default is RISING
// knx.buttonPinInterruptOn(FALLING);
// start the framework.
knx.start();
}
void loop()
{
// don't delay here to much. Otherwise you might lose packages or mess up the timing with ETS
knx.loop();
// only run the application code if the device was configured with ETS
if (!knx.configured())
return;
measureTemp();
}

View File

@ -1,117 +0,0 @@
;PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[platformio]
; We have to keep libdeps dir out the project directory otherwise,
; library scanner seems to have issues so compilation fails
libdeps_dir = /tmp/libdeps
src_dir = .
;--- SAMD --------------------------------------------------
[env:zeroUSB]
platform = atmelsam
board = zeroUSB
framework = arduino
; We consider that the this projects is opened within its project directory
; while working with VS Code.
lib_extra_dirs = ../../../
lib_deps =
SPI
knx
build_flags =
-DMASK_VERSION=0x07B0
-DSMALL_GROUPOBJECT
-Wno-unknown-pragmas
; [env:adafruit_feather_m0_rf]
; platform = atmelsam
; board = adafruit_feather_m0
; framework = arduino
; ; We consider that the this projects is opened within its project directory
; ; while working with VS Code.
; lib_extra_dirs = ../../../
; lib_deps =
; SPI
; knx
; build_flags =
; -DMASK_VERSION=0x27B0
; -Wno-unknown-pragmas
;-----------------------------------------------------------
;--- ESP8266 -----------------------------------------------
#[env:nodemcuv2_ip]
#platform = espressif8266
#board = nodemcuv2
#framework = arduino
; We consider that the this projects is opened within its project directory
; while working with VS Code.
#lib_extra_dirs = ../../../
#lib_deps =
# WifiManager
# knx
#build_flags =
# -DMASK_VERSION=0x57B0
# -Wno-unknown-pragmas
; [env:nodemcuv2_tp]
; platform = espressif8266
; board = nodemcuv2
; framework = arduino
; ; We consider that the this projects is opened within its project directory
; ; while working with VS Code.
; lib_extra_dirs = ../../../
; lib_deps =
; WifiManager
; knx
; build_flags =
; -DMASK_VERSION=0x07B0
; -Wno-unknown-pragmas
;---------------------------------------------------------
;--- ESP32 -----------------------------------------------
; [env:esp32dev_ip]
; platform = espressif32
; board = esp32dev
; framework = arduino
; ; We consider that the this projects is opened within its project directory
; ; while working with VS Code.
; lib_extra_dirs = ../../../
; lib_deps =
; knx
; build_flags =
; -DMASK_VERSION=0x57B0
; -Wno-unknown-pragmas
; [env:esp32dev_tp]
; platform = espressif32
; board = esp32dev
; framework = arduino
; ; We consider that the this projects is opened within its project directory
; ; while working with VS Code.
; lib_extra_dirs = ../../../
; lib_deps =
; knx
; build_flags =
; -DMASK_VERSION=0x07B0
; -Wno-unknown-pragmas

View File

@ -2,9 +2,20 @@
#include <knx.h>
#if MASK_VERSION != 0x07B0 && (defined ARDUINO_ARCH_ESP8266 || defined ARDUINO_ARCH_ESP32)
#include <WiFiManager.h>
#include <WiFiManager.h>
#endif
/** If you don't want a global knx object, for example because you want
* to more finely control it's construction, this is an example
* of how to do so. Define KNX_NO_AUTOMATIC_GLOBAL_INSTANCE
* and then you can DIY a knx object as shown below. In this case we use
* the ESP32's secondary UART and late-bind the ISR function in setup().
Esp32Platform knxPlatform(&Serial2);
Bau07B0 knxBau(knxPlatform);
KnxFacade<Esp32Platform, Bau07B0> knx(knxBau);
*/
// create named references for easy access to group objects
#define goCurrent knx.getGroupObject(1)
#define goMax knx.getGroupObject(2)
@ -19,6 +30,7 @@ long lastsend = 0;
void measureTemp()
{
long now = millis();
if ((now - lastsend) < 2000)
return;
@ -44,9 +56,9 @@ void measureTemp()
}
// callback from reset-GO
void resetCallback(GroupObject& go)
void handler(GroupObject& go)
{
if (go.value())
if (go == goReset && go.value())
{
maxValue = 0;
minValue = 10000;
@ -55,6 +67,8 @@ void resetCallback(GroupObject& go)
void setup()
{
// You can configure the level of the different loggers.
//Logger::logLevel("ApplicationLayer", Logger::Info);
Serial.begin(115200);
ArduinoPlatform::SerialDebug = &Serial;
@ -67,12 +81,11 @@ void setup()
// read adress table, association table, groupobject table and parameters from eeprom
knx.readMemory();
GroupObject::classCallback(handler);
// print values of parameters if device is already configured
if (knx.configured())
{
// register callback for reset GO
goReset.callback(resetCallback);
goReset.dataPointType(DPT_Trigger);
goCurrent.dataPointType(DPT_Value_Temp);
goMin.dataPointType(DPT_Value_Temp);

View File

@ -77,9 +77,9 @@ void measureTemp()
GO_MIN.value(currentValue);
}
void resetCallback(GroupObject& go)
void handler(GroupObject& go)
{
if (go.value())
if (go == GO_RESET && go.value())
{
GO_MAX.valueNoSend(-273.0);
GO_MIN.valueNoSend(670433.28);
@ -105,6 +105,8 @@ void setup()
if (knx.individualAddress() == 0xFFFF)
knx.progMode(true);
GroupObject::classCallback(handler);
if (knx.configured())
{
GO_CURR.dataPointType(Dpt(9, 1));
@ -113,7 +115,6 @@ void setup()
GO_MAX.dataPointType(Dpt(9, 1));
GO_MAX.valueNoSend(-273.0);
GO_RESET.dataPointType(Dpt(1, 15));
//GO_RESET.callback(resetCallback);
LOGGER.info("Timeout: %d", knx.paramWord(0));
LOGGER.info("Zykl. senden: %d", knx.paramByte(2));
LOGGER.info("Min/Max senden: %d", knx.paramByte(3));

View File

@ -1,34 +0,0 @@
#!/usr/bin/env python
from subprocess import run
from datetime import datetime, timedelta
from os.path import expanduser
ocddir = expanduser("~/.platformio/packages/tool-openocd/")
chip = "stm32f1x"
def unlock(*args, **kwargs):
print("Please connect the board within the next two minutes.")
endtime = datetime.now() + timedelta(minutes = 1)
ret = 1
while ret != 0 and datetime.now() < endtime:
ret = run(["bin/openocd", "-f", "interface/stlink.cfg", "-f", "target/" + chip + ".cfg", "-c", "init", "-c", "reset halt", "-c", chip + " unlock 0", "-c", "reset halt", "-c", "exit"], cwd = ocddir).returncode
if ret != 0:
print("Timeout")
return ret
try:
Import("env")
except NameError:
import sys
if len(sys.argv) > 1:
chip = sys.argv[1]
if len(sys.argv) > 2:
ocddir = sys.argv[2]
unlock(None, None)
else:
ocddir = env.PioPlatform().get_package_dir("tool-openocd")
options = env.GetProjectOptions()
for option in options:
if "unlock_chip" == option[0]:
chip = option[1]
env.AddCustomTarget("unlock", None, unlock)

View File

@ -2,8 +2,9 @@
#include "datapoint_types.h"
#include "../interface_object/group_object_table_object.h"
#include "../bits.h"
#include "../util/logger.h"
#include "../bits.h"
#include <cstring>
@ -95,7 +96,7 @@ namespace Knx
return _data;
}
uint16_t GroupObject::asap()
uint16_t GroupObject::asap() const
{
return _asap;
}
@ -228,6 +229,7 @@ namespace Knx
void GroupObject::processClassCallback(GroupObject& go)
{
LOGGER.info("processClassCallback for go %d, handlerset:%d", go.asap(), _updateHandlerStatic != 0);
if (_updateHandlerStatic != 0)
_updateHandlerStatic(go);
}
@ -330,4 +332,9 @@ namespace Knx
return false;
}
bool operator==(const GroupObject& lhs, const GroupObject& rhs)
{
return lhs.asap() == rhs.asap();
}
}

View File

@ -142,7 +142,7 @@ namespace Knx
* returns the Application Service Access Point of the group object. In reality this is just the number of the group object.
* (in german "KO-Nr")
*/
uint16_t asap();
uint16_t asap() const;
/**
* return the current value of the group object.
@ -266,4 +266,6 @@ namespace Knx
Dpt _datapointType;
#endif
};
bool operator==(const GroupObject& lhs, const GroupObject& rhs);
}

View File

@ -1,7 +1,7 @@
#include "table_object.h"
#include "../bits.h"
#include "../util/memory.h"
#include "../util/logger.h"
#include "../bits.h"
#define LOGGER Logger::logger("TableObject")