Compare commits
3 Commits
519b095d16
...
417dbe34cd
| Author | SHA1 | Date | |
|---|---|---|---|
| 417dbe34cd | |||
| 9240622aa7 | |||
| 8108a83fe2 |
324
displayprodLinux/Network.share.xml
Normal file
324
displayprodLinux/Network.share.xml
Normal file
@ -0,0 +1,324 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<KNX xmlns:op="http://github.com/OpenKNX/OpenKNXproducer" xmlns="http://knx.org/xml/project/20"
|
||||
CreatedBy="KNX MT" ToolVersion="5.1.255.16695">
|
||||
<ManufacturerData>
|
||||
<Manufacturer RefId="M-00FA">
|
||||
<ApplicationPrograms>
|
||||
<ApplicationProgram>
|
||||
<Static>
|
||||
<ParameterTypes>
|
||||
<ParameterType Id="%AID%_PT-NetEnable" Name="NetEnable">
|
||||
<TypeRestriction Base="Value" SizeInBit="1">
|
||||
<Enumeration Text="Aus" Value="0" Id="%ENID%" />
|
||||
<Enumeration Text="Ein" Value="1" Id="%ENID%" />
|
||||
</TypeRestriction>
|
||||
</ParameterType>
|
||||
<ParameterType Id="%AID%_PT-NetMode" Name="NetMode">
|
||||
<TypeRestriction Base="Value" SizeInBit="1">
|
||||
<Enumeration Text="DHCP" Value="0" Id="%ENID%" />
|
||||
<Enumeration Text="Statisch" Value="1" Id="%ENID%" />
|
||||
</TypeRestriction>
|
||||
</ParameterType>
|
||||
<ParameterType Id="%AID%_PT-IpOctet" Name="IpOctet">
|
||||
<TypeNumber SizeInBit="8" Type="unsignedInt" minInclusive="0" maxInclusive="255" />
|
||||
</ParameterType>
|
||||
</ParameterTypes>
|
||||
<Parameters>
|
||||
<!-- Byte 0: Flags -->
|
||||
<Union SizeInBit="8">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="0" BitOffset="0" />
|
||||
<Parameter Id="%AID%_P-%TT%00001" Name="pLanEnable"
|
||||
ParameterType="%AID%_PT-NetEnable" Offset="0" BitOffset="0"
|
||||
Text="LAN aktivieren" Value="1" />
|
||||
<Parameter Id="%AID%_P-%TT%00002" Name="pLanDhcp"
|
||||
ParameterType="%AID%_PT-NetMode" Offset="0" BitOffset="1"
|
||||
Text="LAN Adressmodus" Value="0" />
|
||||
<Parameter Id="%AID%_P-%TT%00003" Name="pWlanEnable"
|
||||
ParameterType="%AID%_PT-NetEnable" Offset="0" BitOffset="2"
|
||||
Text="WLAN aktivieren" Value="0" />
|
||||
<Parameter Id="%AID%_P-%TT%00004" Name="pWlanDhcp"
|
||||
ParameterType="%AID%_PT-NetMode" Offset="0" BitOffset="3"
|
||||
Text="WLAN Adressmodus" Value="0" />
|
||||
</Union>
|
||||
|
||||
<!-- LAN Static IP: Bytes 1-4 -->
|
||||
<Parameter Id="%AID%_P-%TT%00010" Name="pLanIp1"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="LAN IP Adresse 1. Oktett" Value="192">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="1" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00011" Name="pLanIp2"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="LAN IP Adresse 2. Oktett" Value="168">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="2" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00012" Name="pLanIp3"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="LAN IP Adresse 3. Oktett" Value="1">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="3" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00013" Name="pLanIp4"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="LAN IP Adresse 4. Oktett" Value="100">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="4" BitOffset="0" />
|
||||
</Parameter>
|
||||
|
||||
<!-- LAN Subnet: Bytes 5-8 -->
|
||||
<Parameter Id="%AID%_P-%TT%00014" Name="pLanSub1"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="LAN Subnetzmaske 1. Oktett" Value="255">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="5" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00015" Name="pLanSub2"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="LAN Subnetzmaske 2. Oktett" Value="255">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="6" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00016" Name="pLanSub3"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="LAN Subnetzmaske 3. Oktett" Value="255">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="7" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00017" Name="pLanSub4"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="LAN Subnetzmaske 4. Oktett" Value="0">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="8" BitOffset="0" />
|
||||
</Parameter>
|
||||
|
||||
<!-- LAN Gateway: Bytes 9-12 -->
|
||||
<Parameter Id="%AID%_P-%TT%00018" Name="pLanGw1"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="LAN Gateway 1. Oktett" Value="192">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="9" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00019" Name="pLanGw2"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="LAN Gateway 2. Oktett" Value="168">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="10" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00020" Name="pLanGw3"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="LAN Gateway 3. Oktett" Value="1">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="11" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00021" Name="pLanGw4"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="LAN Gateway 4. Oktett" Value="1">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="12" BitOffset="0" />
|
||||
</Parameter>
|
||||
|
||||
<!-- LAN DNS: Bytes 13-16 -->
|
||||
<Parameter Id="%AID%_P-%TT%00022" Name="pLanDns1"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="LAN DNS 1. Oktett" Value="192">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="13" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00023" Name="pLanDns2"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="LAN DNS 2. Oktett" Value="168">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="14" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00024" Name="pLanDns3"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="LAN DNS 3. Oktett" Value="1">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="15" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00025" Name="pLanDns4"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="LAN DNS 4. Oktett" Value="1">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="16" BitOffset="0" />
|
||||
</Parameter>
|
||||
|
||||
<!-- WLAN Static IP: Bytes 17-20 -->
|
||||
<Parameter Id="%AID%_P-%TT%00030" Name="pWlanIp1"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="WLAN IP Adresse 1. Oktett" Value="192">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="17" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00031" Name="pWlanIp2"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="WLAN IP Adresse 2. Oktett" Value="168">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="18" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00032" Name="pWlanIp3"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="WLAN IP Adresse 3. Oktett" Value="1">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="19" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00033" Name="pWlanIp4"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="WLAN IP Adresse 4. Oktett" Value="200">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="20" BitOffset="0" />
|
||||
</Parameter>
|
||||
|
||||
<!-- WLAN Subnet: Bytes 21-24 -->
|
||||
<Parameter Id="%AID%_P-%TT%00034" Name="pWlanSub1"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="WLAN Subnetzmaske 1. Oktett" Value="255">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="21" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00035" Name="pWlanSub2"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="WLAN Subnetzmaske 2. Oktett" Value="255">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="22" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00036" Name="pWlanSub3"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="WLAN Subnetzmaske 3. Oktett" Value="255">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="23" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00037" Name="pWlanSub4"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="WLAN Subnetzmaske 4. Oktett" Value="0">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="24" BitOffset="0" />
|
||||
</Parameter>
|
||||
|
||||
<!-- WLAN Gateway: Bytes 25-28 -->
|
||||
<Parameter Id="%AID%_P-%TT%00038" Name="pWlanGw1"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="WLAN Gateway 1. Oktett" Value="192">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="25" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00039" Name="pWlanGw2"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="WLAN Gateway 2. Oktett" Value="168">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="26" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00040" Name="pWlanGw3"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="WLAN Gateway 3. Oktett" Value="1">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="27" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00041" Name="pWlanGw4"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="WLAN Gateway 4. Oktett" Value="1">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="28" BitOffset="0" />
|
||||
</Parameter>
|
||||
|
||||
<!-- WLAN DNS: Bytes 29-32 -->
|
||||
<Parameter Id="%AID%_P-%TT%00042" Name="pWlanDns1"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="WLAN DNS 1. Oktett" Value="192">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="29" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00043" Name="pWlanDns2"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="WLAN DNS 2. Oktett" Value="168">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="30" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00044" Name="pWlanDns3"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="WLAN DNS 3. Oktett" Value="1">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="31" BitOffset="0" />
|
||||
</Parameter>
|
||||
<Parameter Id="%AID%_P-%TT%00045" Name="pWlanDns4"
|
||||
ParameterType="%AID%_PT-IpOctet" Text="WLAN DNS 4. Oktett" Value="1">
|
||||
<Memory CodeSegment="%AID%_RS-04-00000" Offset="32" BitOffset="0" />
|
||||
</Parameter>
|
||||
</Parameters>
|
||||
<ParameterRefs>
|
||||
<!-- Flags -->
|
||||
<ParameterRef Id="%AID%_P-%TT%00001_R-%TT%0000101" RefId="%AID%_P-%TT%00001" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00002_R-%TT%0000201" RefId="%AID%_P-%TT%00002" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00003_R-%TT%0000301" RefId="%AID%_P-%TT%00003" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00004_R-%TT%0000401" RefId="%AID%_P-%TT%00004" />
|
||||
<!-- LAN IP -->
|
||||
<ParameterRef Id="%AID%_P-%TT%00010_R-%TT%0001001" RefId="%AID%_P-%TT%00010" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00011_R-%TT%0001101" RefId="%AID%_P-%TT%00011" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00012_R-%TT%0001201" RefId="%AID%_P-%TT%00012" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00013_R-%TT%0001301" RefId="%AID%_P-%TT%00013" />
|
||||
<!-- LAN Subnet -->
|
||||
<ParameterRef Id="%AID%_P-%TT%00014_R-%TT%0001401" RefId="%AID%_P-%TT%00014" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00015_R-%TT%0001501" RefId="%AID%_P-%TT%00015" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00016_R-%TT%0001601" RefId="%AID%_P-%TT%00016" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00017_R-%TT%0001701" RefId="%AID%_P-%TT%00017" />
|
||||
<!-- LAN Gateway -->
|
||||
<ParameterRef Id="%AID%_P-%TT%00018_R-%TT%0001801" RefId="%AID%_P-%TT%00018" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00019_R-%TT%0001901" RefId="%AID%_P-%TT%00019" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00020_R-%TT%0002001" RefId="%AID%_P-%TT%00020" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00021_R-%TT%0002101" RefId="%AID%_P-%TT%00021" />
|
||||
<!-- LAN DNS -->
|
||||
<ParameterRef Id="%AID%_P-%TT%00022_R-%TT%0002201" RefId="%AID%_P-%TT%00022" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00023_R-%TT%0002301" RefId="%AID%_P-%TT%00023" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00024_R-%TT%0002401" RefId="%AID%_P-%TT%00024" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00025_R-%TT%0002501" RefId="%AID%_P-%TT%00025" />
|
||||
<!-- WLAN IP -->
|
||||
<ParameterRef Id="%AID%_P-%TT%00030_R-%TT%0003001" RefId="%AID%_P-%TT%00030" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00031_R-%TT%0003101" RefId="%AID%_P-%TT%00031" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00032_R-%TT%0003201" RefId="%AID%_P-%TT%00032" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00033_R-%TT%0003301" RefId="%AID%_P-%TT%00033" />
|
||||
<!-- WLAN Subnet -->
|
||||
<ParameterRef Id="%AID%_P-%TT%00034_R-%TT%0003401" RefId="%AID%_P-%TT%00034" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00035_R-%TT%0003501" RefId="%AID%_P-%TT%00035" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00036_R-%TT%0003601" RefId="%AID%_P-%TT%00036" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00037_R-%TT%0003701" RefId="%AID%_P-%TT%00037" />
|
||||
<!-- WLAN Gateway -->
|
||||
<ParameterRef Id="%AID%_P-%TT%00038_R-%TT%0003801" RefId="%AID%_P-%TT%00038" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00039_R-%TT%0003901" RefId="%AID%_P-%TT%00039" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00040_R-%TT%0004001" RefId="%AID%_P-%TT%00040" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00041_R-%TT%0004101" RefId="%AID%_P-%TT%00041" />
|
||||
<!-- WLAN DNS -->
|
||||
<ParameterRef Id="%AID%_P-%TT%00042_R-%TT%0004201" RefId="%AID%_P-%TT%00042" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00043_R-%TT%0004301" RefId="%AID%_P-%TT%00043" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00044_R-%TT%0004401" RefId="%AID%_P-%TT%00044" />
|
||||
<ParameterRef Id="%AID%_P-%TT%00045_R-%TT%0004501" RefId="%AID%_P-%TT%00045" />
|
||||
</ParameterRefs>
|
||||
<ComObjectTable />
|
||||
<ComObjectRefs />
|
||||
</Static>
|
||||
<Dynamic>
|
||||
<Channel Id="%AID%_CH-%PREFIX%" Number="%PREFIX%" Name="Network" Text="Netzwerk"
|
||||
Icon="ethernet">
|
||||
|
||||
<!-- ===== LAN ===== -->
|
||||
<ParameterBlock Id="%AID%_PB-nnn" Name="LAN" Text="LAN Einstellungen"
|
||||
ShowInComObjectTree="false">
|
||||
<ParameterSeparator Id="%AID%_PS-nnn" Text="LAN" UIHint="Headline" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00001_R-%TT%0000101" IndentLevel="1" />
|
||||
|
||||
<choose ParamRefId="%AID%_P-%TT%00001_R-%TT%0000101">
|
||||
<when test="1">
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00002_R-%TT%0000201" IndentLevel="1" />
|
||||
|
||||
<choose ParamRefId="%AID%_P-%TT%00002_R-%TT%0000201">
|
||||
<when test="1">
|
||||
<ParameterSeparator Id="%AID%_PS-nnn" Text="LAN IP Adresse" UIHint="Headline" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00010_R-%TT%0001001" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00011_R-%TT%0001101" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00012_R-%TT%0001201" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00013_R-%TT%0001301" IndentLevel="2" />
|
||||
<ParameterSeparator Id="%AID%_PS-nnn" Text="LAN Subnetzmaske" UIHint="Headline" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00014_R-%TT%0001401" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00015_R-%TT%0001501" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00016_R-%TT%0001601" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00017_R-%TT%0001701" IndentLevel="2" />
|
||||
<ParameterSeparator Id="%AID%_PS-nnn" Text="LAN Gateway" UIHint="Headline" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00018_R-%TT%0001801" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00019_R-%TT%0001901" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00020_R-%TT%0002001" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00021_R-%TT%0002101" IndentLevel="2" />
|
||||
<ParameterSeparator Id="%AID%_PS-nnn" Text="LAN DNS" UIHint="Headline" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00022_R-%TT%0002201" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00023_R-%TT%0002301" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00024_R-%TT%0002401" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00025_R-%TT%0002501" IndentLevel="2" />
|
||||
</when>
|
||||
</choose>
|
||||
</when>
|
||||
</choose>
|
||||
</ParameterBlock>
|
||||
|
||||
<!-- ===== WLAN ===== -->
|
||||
<ParameterBlock Id="%AID%_PB-nnn" Name="WLAN" Text="WLAN Einstellungen"
|
||||
ShowInComObjectTree="false">
|
||||
<ParameterSeparator Id="%AID%_PS-nnn" Text="WLAN" UIHint="Headline" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00003_R-%TT%0000301" IndentLevel="1" />
|
||||
|
||||
<choose ParamRefId="%AID%_P-%TT%00003_R-%TT%0000301">
|
||||
<when test="1">
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00004_R-%TT%0000401" IndentLevel="1" />
|
||||
|
||||
<choose ParamRefId="%AID%_P-%TT%00004_R-%TT%0000401">
|
||||
<when test="1">
|
||||
<ParameterSeparator Id="%AID%_PS-nnn" Text="WLAN IP Adresse" UIHint="Headline" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00030_R-%TT%0003001" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00031_R-%TT%0003101" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00032_R-%TT%0003201" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00033_R-%TT%0003301" IndentLevel="2" />
|
||||
<ParameterSeparator Id="%AID%_PS-nnn" Text="WLAN Subnetzmaske" UIHint="Headline" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00034_R-%TT%0003401" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00035_R-%TT%0003501" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00036_R-%TT%0003601" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00037_R-%TT%0003701" IndentLevel="2" />
|
||||
<ParameterSeparator Id="%AID%_PS-nnn" Text="WLAN Gateway" UIHint="Headline" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00038_R-%TT%0003801" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00039_R-%TT%0003901" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00040_R-%TT%0004001" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00041_R-%TT%0004101" IndentLevel="2" />
|
||||
<ParameterSeparator Id="%AID%_PS-nnn" Text="WLAN DNS" UIHint="Headline" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00042_R-%TT%0004201" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00043_R-%TT%0004301" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00044_R-%TT%0004401" IndentLevel="2" />
|
||||
<ParameterRefRef RefId="%AID%_P-%TT%00045_R-%TT%0004501" IndentLevel="2" />
|
||||
</when>
|
||||
</choose>
|
||||
</when>
|
||||
</choose>
|
||||
</ParameterBlock>
|
||||
|
||||
</Channel>
|
||||
</Dynamic>
|
||||
</ApplicationProgram>
|
||||
</ApplicationPrograms>
|
||||
</Manufacturer>
|
||||
</ManufacturerData>
|
||||
</KNX>
|
||||
@ -25,6 +25,11 @@
|
||||
<!-- <op:verify File="../lib/OGM-Common/library.json" ModuleVersion="%BASE_VerifyVersion%" />-->
|
||||
</op:define>
|
||||
|
||||
<op:define prefix="NW"
|
||||
share="Network.share.xml"
|
||||
ModuleType="10">
|
||||
<!-- <op:verify File="../lib/OGM-Common/library.json" ModuleVersion="%BASE_VerifyVersion%" />-->
|
||||
</op:define>
|
||||
|
||||
<op:define prefix="SC"
|
||||
share="Section.share.xml"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
idf_component_register(SRCS "HistoryStore.cpp" "KnxWorker.cpp" "Nvs.cpp" "main.cpp" "Display.cpp" "Touch.cpp" "Gui.cpp" "Wifi.cpp" "LvglIdle.c" "Gui/WifiSetting.cpp" "Gui/EthSetting.cpp" "Hardware/Eth.cpp" "WidgetManager.cpp" "WidgetConfig.cpp" "SdCard.cpp" "Fonts.cpp"
|
||||
idf_component_register(SRCS "HistoryStore.cpp" "KnxWorker.cpp" "Nvs.cpp" "main.cpp" "Display.cpp" "Touch.cpp" "Gui.cpp" "Wifi.cpp" "LvglIdle.c" "Hardware/Eth.cpp" "NetworkConfig.cpp" "WidgetManager.cpp" "WidgetConfig.cpp" "SdCard.cpp" "Fonts.cpp"
|
||||
"widgets/Widget.cpp"
|
||||
"widgets/LabelWidget.cpp"
|
||||
"widgets/ButtonWidget.cpp"
|
||||
|
||||
13
main/Gui.cpp
13
main/Gui.cpp
@ -3,8 +3,6 @@
|
||||
#include "esp_log.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_system.h"
|
||||
#include "Gui/WifiSetting.hpp"
|
||||
#include "Gui/EthSetting.hpp"
|
||||
#include "WidgetManager.hpp"
|
||||
#include "lvgl.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
@ -12,14 +10,6 @@
|
||||
|
||||
KnxWorker Gui::knxWorker; // Define the static member
|
||||
|
||||
static void screen_long_press_handler(lv_event_t * e)
|
||||
{
|
||||
if (lv_event_get_code(e) == LV_EVENT_LONG_PRESSED) {
|
||||
//WifiSetting::instance().show();
|
||||
EthSetting::instance().show();
|
||||
}
|
||||
}
|
||||
|
||||
static void widget_manager_timer_cb(lv_timer_t* timer)
|
||||
{
|
||||
(void)timer;
|
||||
@ -37,9 +27,6 @@ void Gui::create()
|
||||
WidgetManager::instance().init();
|
||||
|
||||
if (esp_lv_adapter_lock(-1) == ESP_OK) {
|
||||
// TEMP: Disabled long press handler for testing
|
||||
// lv_obj_add_event_cb(lv_scr_act(), screen_long_press_handler,
|
||||
// LV_EVENT_LONG_PRESSED, NULL);
|
||||
lv_timer_create(widget_manager_timer_cb, 50, nullptr);
|
||||
|
||||
esp_lv_adapter_unlock();
|
||||
|
||||
@ -1,86 +0,0 @@
|
||||
#include "EthSetting.hpp"
|
||||
#include "../Fonts.hpp"
|
||||
#include "esp_lv_adapter.h"
|
||||
#include "esp_log.h"
|
||||
#include <cstring>
|
||||
|
||||
static const char* TAG = "EthSetting";
|
||||
|
||||
EthSetting& EthSetting::instance() {
|
||||
static EthSetting instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void EthSetting::show() {
|
||||
if (visible_) {
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "Showing ETH settings");
|
||||
|
||||
if (esp_lv_adapter_lock(-1) == ESP_OK) {
|
||||
createUI();
|
||||
visible_ = true;
|
||||
esp_lv_adapter_unlock();
|
||||
}
|
||||
}
|
||||
|
||||
void EthSetting::hide() {
|
||||
if (!visible_) {
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "Hiding ETH settings");
|
||||
|
||||
if (esp_lv_adapter_lock(-1) == ESP_OK) {
|
||||
|
||||
if (overlay_) {
|
||||
lv_obj_del(overlay_);
|
||||
overlay_ = nullptr;
|
||||
}
|
||||
visible_ = false;
|
||||
esp_lv_adapter_unlock();
|
||||
}
|
||||
}
|
||||
|
||||
bool EthSetting::isVisible() {
|
||||
return visible_;
|
||||
}
|
||||
|
||||
void EthSetting::createUI() {
|
||||
overlay_ = lv_obj_create(lv_scr_act());
|
||||
lv_obj_set_size(overlay_, LV_PCT(100), LV_PCT(100));
|
||||
lv_obj_set_style_bg_color(overlay_, lv_color_hex(0x202020), 0);
|
||||
lv_obj_set_style_bg_opa(overlay_, LV_OPA_COVER, 0);
|
||||
lv_obj_set_style_text_font(overlay_, Fonts::bySizeIndex(0), 0);
|
||||
lv_obj_set_style_pad_all(overlay_, 10, 0);
|
||||
lv_obj_clear_flag(overlay_, LV_OBJ_FLAG_SCROLLABLE);
|
||||
|
||||
lv_obj_t* header = lv_obj_create(overlay_);
|
||||
lv_obj_set_size(header, LV_PCT(100), 50);
|
||||
lv_obj_align(header, LV_ALIGN_TOP_MID, 0, 0);
|
||||
lv_obj_set_style_bg_color(header, lv_color_hex(0x303030), 0);
|
||||
lv_obj_set_style_pad_all(header, 5, 0);
|
||||
lv_obj_clear_flag(header, LV_OBJ_FLAG_SCROLLABLE);
|
||||
|
||||
lv_obj_t* closeBtn = lv_btn_create(header);
|
||||
lv_obj_set_size(closeBtn, 40, 40);
|
||||
lv_obj_align(closeBtn, LV_ALIGN_LEFT_MID, 0, 0);
|
||||
lv_obj_set_style_bg_color(closeBtn, lv_color_hex(0x804040), 0);
|
||||
//lv_obj_add_event_cb(closeBtn, onCloseClick, LV_EVENT_CLICKED, nullptr);
|
||||
|
||||
lv_obj_t* closeLbl = lv_label_create(closeBtn);
|
||||
lv_label_set_text(closeLbl, "X");
|
||||
lv_obj_center(closeLbl);
|
||||
|
||||
lv_obj_t* titleLbl = lv_label_create(header);
|
||||
lv_label_set_text(titleLbl, "Eth Settings");
|
||||
lv_obj_set_style_text_font(titleLbl, Fonts::bySizeIndex(0), 0);
|
||||
lv_obj_align(titleLbl, LV_ALIGN_CENTER, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
void EthSetting::onCloseClick(lv_event_t* e) {
|
||||
(void)e;
|
||||
EthSetting::instance().hide();
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "lvgl.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class EthSetting {
|
||||
public:
|
||||
static EthSetting& instance();
|
||||
|
||||
void show();
|
||||
void hide();
|
||||
bool isVisible();
|
||||
|
||||
private:
|
||||
EthSetting() = default;
|
||||
EthSetting(const EthSetting&) = delete;
|
||||
EthSetting& operator=(const EthSetting&) = delete;
|
||||
|
||||
void createUI();
|
||||
|
||||
static void onCloseClick(lv_event_t* e);
|
||||
|
||||
lv_obj_t* overlay_ = nullptr;
|
||||
bool visible_ = false;
|
||||
};
|
||||
@ -1,413 +0,0 @@
|
||||
#include "WifiSetting.hpp"
|
||||
#include "../Wifi.hpp"
|
||||
#include "../Fonts.hpp"
|
||||
#include "esp_lv_adapter.h"
|
||||
#include "esp_log.h"
|
||||
#include <cstring>
|
||||
|
||||
static const char* TAG = "WifiSetting";
|
||||
|
||||
WifiSetting& WifiSetting::instance() {
|
||||
static WifiSetting instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void WifiSetting::show() {
|
||||
if (visible_) {
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "Showing WiFi settings");
|
||||
|
||||
if (esp_lv_adapter_lock(-1) == ESP_OK) {
|
||||
createUI();
|
||||
visible_ = true;
|
||||
|
||||
Wifi::instance().setStatusCallback([](bool connected) {
|
||||
if (esp_lv_adapter_lock(100) == ESP_OK) {
|
||||
WifiSetting::instance().updateStatusDisplay();
|
||||
esp_lv_adapter_unlock();
|
||||
}
|
||||
});
|
||||
|
||||
refreshNetworkList();
|
||||
refreshSavedNetworks();
|
||||
updateStatusDisplay();
|
||||
|
||||
esp_lv_adapter_unlock();
|
||||
}
|
||||
}
|
||||
|
||||
void WifiSetting::hide() {
|
||||
if (!visible_) {
|
||||
return;
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "Hiding WiFi settings");
|
||||
|
||||
if (esp_lv_adapter_lock(-1) == ESP_OK) {
|
||||
Wifi::instance().setStatusCallback(nullptr);
|
||||
|
||||
if (overlay_) {
|
||||
lv_obj_del(overlay_);
|
||||
overlay_ = nullptr;
|
||||
statusLabel_ = nullptr;
|
||||
disconnectBtn_ = nullptr;
|
||||
networkList_ = nullptr;
|
||||
savedList_ = nullptr;
|
||||
passwordDialog_ = nullptr;
|
||||
passwordInput_ = nullptr;
|
||||
keyboard_ = nullptr;
|
||||
}
|
||||
visible_ = false;
|
||||
esp_lv_adapter_unlock();
|
||||
}
|
||||
}
|
||||
|
||||
bool WifiSetting::isVisible() {
|
||||
return visible_;
|
||||
}
|
||||
|
||||
void WifiSetting::createUI() {
|
||||
overlay_ = lv_obj_create(lv_scr_act());
|
||||
lv_obj_set_size(overlay_, LV_PCT(100), LV_PCT(100));
|
||||
lv_obj_set_style_bg_color(overlay_, lv_color_hex(0x202020), 0);
|
||||
lv_obj_set_style_bg_opa(overlay_, LV_OPA_COVER, 0);
|
||||
lv_obj_set_style_text_font(overlay_, Fonts::bySizeIndex(0), 0);
|
||||
lv_obj_set_style_pad_all(overlay_, 10, 0);
|
||||
lv_obj_clear_flag(overlay_, LV_OBJ_FLAG_SCROLLABLE);
|
||||
|
||||
lv_obj_t* header = lv_obj_create(overlay_);
|
||||
lv_obj_set_size(header, LV_PCT(100), 50);
|
||||
lv_obj_align(header, LV_ALIGN_TOP_MID, 0, 0);
|
||||
lv_obj_set_style_bg_color(header, lv_color_hex(0x303030), 0);
|
||||
lv_obj_set_style_pad_all(header, 5, 0);
|
||||
lv_obj_clear_flag(header, LV_OBJ_FLAG_SCROLLABLE);
|
||||
|
||||
lv_obj_t* closeBtn = lv_btn_create(header);
|
||||
lv_obj_set_size(closeBtn, 40, 40);
|
||||
lv_obj_align(closeBtn, LV_ALIGN_LEFT_MID, 0, 0);
|
||||
lv_obj_set_style_bg_color(closeBtn, lv_color_hex(0x804040), 0);
|
||||
//lv_obj_add_event_cb(closeBtn, onCloseClick, LV_EVENT_CLICKED, nullptr);
|
||||
|
||||
lv_obj_t* closeLbl = lv_label_create(closeBtn);
|
||||
lv_label_set_text(closeLbl, "X");
|
||||
lv_obj_center(closeLbl);
|
||||
|
||||
lv_obj_t* titleLbl = lv_label_create(header);
|
||||
lv_label_set_text(titleLbl, "WiFi Settings");
|
||||
lv_obj_set_style_text_font(titleLbl, Fonts::bySizeIndex(0), 0);
|
||||
lv_obj_align(titleLbl, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
lv_obj_t* statusSection = lv_obj_create(overlay_);
|
||||
lv_obj_set_size(statusSection, LV_PCT(100), 80);
|
||||
lv_obj_align_to(statusSection, header, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
|
||||
lv_obj_set_style_bg_color(statusSection, lv_color_hex(0x303030), 0);
|
||||
lv_obj_set_style_pad_all(statusSection, 10, 0);
|
||||
lv_obj_clear_flag(statusSection, LV_OBJ_FLAG_SCROLLABLE);
|
||||
|
||||
statusLabel_ = lv_label_create(statusSection);
|
||||
lv_label_set_text(statusLabel_, "Status: Nicht verbunden");
|
||||
lv_obj_align(statusLabel_, LV_ALIGN_LEFT_MID, 0, 0);
|
||||
|
||||
disconnectBtn_ = lv_btn_create(statusSection);
|
||||
lv_obj_set_size(disconnectBtn_, 100, 40);
|
||||
lv_obj_align(disconnectBtn_, LV_ALIGN_RIGHT_MID, 0, 0);
|
||||
//lv_obj_add_event_cb(disconnectBtn_, onDisconnectClick, LV_EVENT_CLICKED, nullptr);
|
||||
lv_obj_add_flag(disconnectBtn_, LV_OBJ_FLAG_HIDDEN);
|
||||
|
||||
lv_obj_t* disconnectLbl = lv_label_create(disconnectBtn_);
|
||||
lv_label_set_text(disconnectLbl, "Trennen");
|
||||
lv_obj_center(disconnectLbl);
|
||||
|
||||
lv_obj_t* availableSection = lv_obj_create(overlay_);
|
||||
lv_obj_set_size(availableSection, LV_PCT(100), 280);
|
||||
lv_obj_align_to(availableSection, statusSection, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
|
||||
lv_obj_set_style_bg_color(availableSection, lv_color_hex(0x303030), 0);
|
||||
lv_obj_set_style_pad_all(availableSection, 10, 0);
|
||||
lv_obj_clear_flag(availableSection, LV_OBJ_FLAG_SCROLLABLE);
|
||||
|
||||
lv_obj_t* availableHeader = lv_obj_create(availableSection);
|
||||
lv_obj_set_size(availableHeader, LV_PCT(100), 40);
|
||||
lv_obj_align(availableHeader, LV_ALIGN_TOP_MID, 0, 0);
|
||||
lv_obj_set_style_bg_opa(availableHeader, LV_OPA_TRANSP, 0);
|
||||
lv_obj_set_style_border_width(availableHeader, 0, 0);
|
||||
lv_obj_set_style_pad_all(availableHeader, 0, 0);
|
||||
lv_obj_clear_flag(availableHeader, LV_OBJ_FLAG_SCROLLABLE);
|
||||
|
||||
lv_obj_t* availableLbl = lv_label_create(availableHeader);
|
||||
lv_label_set_text(availableLbl, "Verfuegbare Netzwerke:");
|
||||
lv_obj_align(availableLbl, LV_ALIGN_LEFT_MID, 0, 0);
|
||||
|
||||
lv_obj_t* scanBtn = lv_btn_create(availableHeader);
|
||||
lv_obj_set_size(scanBtn, 100, 35);
|
||||
lv_obj_align(scanBtn, LV_ALIGN_RIGHT_MID, 0, 0);
|
||||
//lv_obj_add_event_cb(scanBtn, onScanClick, LV_EVENT_CLICKED, nullptr);
|
||||
|
||||
lv_obj_t* scanLbl = lv_label_create(scanBtn);
|
||||
lv_label_set_text(scanLbl, "Scannen");
|
||||
lv_obj_center(scanLbl);
|
||||
|
||||
networkList_ = lv_list_create(availableSection);
|
||||
lv_obj_set_size(networkList_, LV_PCT(100), 220);
|
||||
lv_obj_align_to(networkList_, availableHeader, LV_ALIGN_OUT_BOTTOM_MID, 0, 5);
|
||||
lv_obj_set_style_bg_color(networkList_, lv_color_hex(0x252525), 0);
|
||||
|
||||
lv_obj_t* savedSection = lv_obj_create(overlay_);
|
||||
lv_obj_set_size(savedSection, LV_PCT(100), 200);
|
||||
lv_obj_align_to(savedSection, availableSection, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
|
||||
lv_obj_set_style_bg_color(savedSection, lv_color_hex(0x303030), 0);
|
||||
lv_obj_set_style_pad_all(savedSection, 10, 0);
|
||||
lv_obj_clear_flag(savedSection, LV_OBJ_FLAG_SCROLLABLE);
|
||||
|
||||
lv_obj_t* savedLbl = lv_label_create(savedSection);
|
||||
lv_label_set_text(savedLbl, "Gespeicherte Netzwerke:");
|
||||
lv_obj_align(savedLbl, LV_ALIGN_TOP_LEFT, 0, 0);
|
||||
|
||||
savedList_ = lv_list_create(savedSection);
|
||||
lv_obj_set_size(savedList_, LV_PCT(100), 150);
|
||||
lv_obj_align(savedList_, LV_ALIGN_BOTTOM_MID, 0, 0);
|
||||
lv_obj_set_style_bg_color(savedList_, lv_color_hex(0x252525), 0);
|
||||
}
|
||||
|
||||
void WifiSetting::refreshNetworkList() {
|
||||
ESP_LOGI(TAG, "Starting network scan");
|
||||
|
||||
if (networkList_) {
|
||||
lv_obj_clean(networkList_);
|
||||
lv_obj_t* scanningLbl = lv_list_add_text(networkList_, "Scanning...");
|
||||
(void)scanningLbl;
|
||||
}
|
||||
|
||||
Wifi::instance().scan([](std::vector<wifi_ap_record_t>& networks) {
|
||||
WifiSetting& settings = WifiSetting::instance();
|
||||
settings.scannedNetworks_ = networks;
|
||||
|
||||
if (esp_lv_adapter_lock(100) == ESP_OK) {
|
||||
if (settings.networkList_) {
|
||||
lv_obj_clean(settings.networkList_);
|
||||
|
||||
for (const auto& ap : networks) {
|
||||
char signalStr[64];
|
||||
int bars = 0;
|
||||
if (ap.rssi >= -50) bars = 4;
|
||||
else if (ap.rssi >= -60) bars = 3;
|
||||
else if (ap.rssi >= -70) bars = 2;
|
||||
else bars = 1;
|
||||
|
||||
const char* barSymbols[] = {"[# ]", "[## ]", "[### ]", "[####]"};
|
||||
snprintf(signalStr, sizeof(signalStr), "%s %s %ddBm",
|
||||
(const char*)ap.ssid, barSymbols[bars - 1], ap.rssi);
|
||||
|
||||
lv_obj_t* btn = lv_list_add_btn(settings.networkList_, LV_SYMBOL_WIFI, signalStr);
|
||||
//lv_obj_add_event_cb(btn, onNetworkSelect, LV_EVENT_CLICKED, nullptr);
|
||||
|
||||
size_t ssidLen = strlen((const char*)ap.ssid);
|
||||
char* ssidCopy = (char*)lv_malloc(ssidLen + 1);
|
||||
strcpy(ssidCopy, (const char*)ap.ssid);
|
||||
lv_obj_set_user_data(btn, ssidCopy);
|
||||
}
|
||||
|
||||
if (networks.empty()) {
|
||||
lv_list_add_text(settings.networkList_, "Keine Netzwerke gefunden");
|
||||
}
|
||||
}
|
||||
esp_lv_adapter_unlock();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void WifiSetting::refreshSavedNetworks() {
|
||||
if (!savedList_) return;
|
||||
|
||||
lv_obj_clean(savedList_);
|
||||
|
||||
auto savedNetworks = Wifi::instance().getSavedNetworks();
|
||||
|
||||
for (const auto& ssid : savedNetworks) {
|
||||
lv_obj_t* item = lv_obj_create(savedList_);
|
||||
lv_obj_set_size(item, LV_PCT(100), 40);
|
||||
lv_obj_set_style_bg_color(item, lv_color_hex(0x353535), 0);
|
||||
lv_obj_set_style_pad_all(item, 5, 0);
|
||||
lv_obj_clear_flag(item, LV_OBJ_FLAG_SCROLLABLE);
|
||||
|
||||
lv_obj_t* nameLbl = lv_label_create(item);
|
||||
lv_label_set_text(nameLbl, ssid.c_str());
|
||||
lv_obj_align(nameLbl, LV_ALIGN_LEFT_MID, 0, 0);
|
||||
|
||||
lv_obj_t* deleteBtn = lv_btn_create(item);
|
||||
lv_obj_set_size(deleteBtn, 80, 30);
|
||||
lv_obj_align(deleteBtn, LV_ALIGN_RIGHT_MID, 0, 0);
|
||||
lv_obj_set_style_bg_color(deleteBtn, lv_color_hex(0x804040), 0);
|
||||
//lv_obj_add_event_cb(deleteBtn, onDeleteSavedClick, LV_EVENT_CLICKED, nullptr);
|
||||
|
||||
char* ssidCopy = (char*)lv_malloc(ssid.size() + 1);
|
||||
strcpy(ssidCopy, ssid.c_str());
|
||||
lv_obj_set_user_data(deleteBtn, ssidCopy);
|
||||
|
||||
lv_obj_t* deleteLbl = lv_label_create(deleteBtn);
|
||||
lv_label_set_text(deleteLbl, "Loeschen");
|
||||
lv_obj_center(deleteLbl);
|
||||
}
|
||||
|
||||
if (savedNetworks.empty()) {
|
||||
lv_list_add_text(savedList_, "Keine gespeicherten Netzwerke");
|
||||
}
|
||||
}
|
||||
|
||||
void WifiSetting::updateStatusDisplay() {
|
||||
if (!statusLabel_ || !disconnectBtn_) return;
|
||||
|
||||
Wifi& wifi = Wifi::instance();
|
||||
|
||||
if (wifi.isConnected()) {
|
||||
char statusText[64];
|
||||
snprintf(statusText, sizeof(statusText), "Verbunden: %s", wifi.getCurrentSSID().c_str());
|
||||
lv_label_set_text(statusLabel_, statusText);
|
||||
lv_obj_clear_flag(disconnectBtn_, LV_OBJ_FLAG_HIDDEN);
|
||||
} else {
|
||||
lv_label_set_text(statusLabel_, "Status: Nicht verbunden");
|
||||
lv_obj_add_flag(disconnectBtn_, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
}
|
||||
|
||||
static void showPasswordDialogAsync(void* arg) {
|
||||
WifiSetting::instance().createPasswordDialogUI();
|
||||
}
|
||||
|
||||
void WifiSetting::showPasswordDialog(const char* ssid) {
|
||||
selectedSSID_ = ssid;
|
||||
lv_async_call(showPasswordDialogAsync, nullptr);
|
||||
}
|
||||
|
||||
void WifiSetting::createPasswordDialogUI() {
|
||||
if (passwordDialog_) return;
|
||||
|
||||
ESP_LOGI(TAG, "Creating password dialog for: %s", selectedSSID_.c_str());
|
||||
|
||||
passwordDialog_ = lv_obj_create(lv_scr_act());
|
||||
lv_obj_set_size(passwordDialog_, LV_PCT(100), LV_PCT(100));
|
||||
lv_obj_set_pos(passwordDialog_, 0, 0);
|
||||
lv_obj_set_style_bg_color(passwordDialog_, lv_color_hex(0x303030), 0);
|
||||
lv_obj_set_style_bg_opa(passwordDialog_, LV_OPA_COVER, 0);
|
||||
lv_obj_set_style_pad_all(passwordDialog_, 20, 0);
|
||||
lv_obj_clear_flag(passwordDialog_, LV_OBJ_FLAG_SCROLLABLE);
|
||||
|
||||
char title[64];
|
||||
snprintf(title, sizeof(title), "Verbinden mit: %s", selectedSSID_.c_str());
|
||||
lv_obj_t* titleLbl = lv_label_create(passwordDialog_);
|
||||
lv_label_set_text(titleLbl, title);
|
||||
lv_obj_align(titleLbl, LV_ALIGN_TOP_MID, 0, 10);
|
||||
|
||||
lv_obj_t* pwLabel = lv_label_create(passwordDialog_);
|
||||
lv_label_set_text(pwLabel, "Passwort:");
|
||||
lv_obj_align(pwLabel, LV_ALIGN_TOP_LEFT, 10, 50);
|
||||
|
||||
passwordInput_ = lv_textarea_create(passwordDialog_);
|
||||
lv_obj_set_size(passwordInput_, LV_PCT(90), 50);
|
||||
lv_obj_align(passwordInput_, LV_ALIGN_TOP_MID, 0, 80);
|
||||
lv_textarea_set_password_mode(passwordInput_, true);
|
||||
lv_textarea_set_one_line(passwordInput_, true);
|
||||
lv_textarea_set_placeholder_text(passwordInput_, "Passwort eingeben...");
|
||||
|
||||
lv_obj_t* cancelBtn = lv_btn_create(passwordDialog_);
|
||||
lv_obj_set_size(cancelBtn, 150, 50);
|
||||
lv_obj_align(cancelBtn, LV_ALIGN_TOP_LEFT, 20, 150);
|
||||
lv_obj_set_style_bg_color(cancelBtn, lv_color_hex(0x606060), 0);
|
||||
//lv_obj_add_event_cb(cancelBtn, onCancelClick, LV_EVENT_CLICKED, nullptr);
|
||||
|
||||
lv_obj_t* cancelLbl = lv_label_create(cancelBtn);
|
||||
lv_label_set_text(cancelLbl, "Abbrechen");
|
||||
lv_obj_center(cancelLbl);
|
||||
|
||||
lv_obj_t* connectBtn = lv_btn_create(passwordDialog_);
|
||||
lv_obj_set_size(connectBtn, 150, 50);
|
||||
lv_obj_align(connectBtn, LV_ALIGN_TOP_RIGHT, -20, 150);
|
||||
lv_obj_set_style_bg_color(connectBtn, lv_color_hex(0x408040), 0);
|
||||
//lv_obj_add_event_cb(connectBtn, onConnectClick, LV_EVENT_CLICKED, nullptr);
|
||||
|
||||
lv_obj_t* connectLbl = lv_label_create(connectBtn);
|
||||
lv_label_set_text(connectLbl, "Verbinden");
|
||||
lv_obj_center(connectLbl);
|
||||
|
||||
keyboard_ = lv_keyboard_create(passwordDialog_);
|
||||
lv_obj_set_size(keyboard_, LV_PCT(100), 300);
|
||||
lv_obj_align(keyboard_, LV_ALIGN_BOTTOM_MID, 0, 0);
|
||||
lv_keyboard_set_textarea(keyboard_, passwordInput_);
|
||||
//lv_obj_add_event_cb(keyboard_, onKeyboardReady, LV_EVENT_READY, nullptr);
|
||||
|
||||
ESP_LOGI(TAG, "Password dialog created");
|
||||
}
|
||||
|
||||
void WifiSetting::hidePasswordDialog() {
|
||||
if (passwordDialog_) {
|
||||
lv_obj_del(passwordDialog_);
|
||||
passwordDialog_ = nullptr;
|
||||
passwordInput_ = nullptr;
|
||||
keyboard_ = nullptr;
|
||||
}
|
||||
selectedSSID_.clear();
|
||||
}
|
||||
|
||||
void WifiSetting::onCloseClick(lv_event_t* e) {
|
||||
(void)e;
|
||||
WifiSetting::instance().hide();
|
||||
}
|
||||
|
||||
void WifiSetting::onNetworkSelect(lv_event_t* e) {
|
||||
lv_obj_t* btn = (lv_obj_t*)lv_event_get_target(e);
|
||||
char* ssid = (char*)lv_obj_get_user_data(btn);
|
||||
if (ssid) {
|
||||
ESP_LOGI(TAG, "Selected network: %s", ssid);
|
||||
WifiSetting::instance().showPasswordDialog(ssid);
|
||||
}
|
||||
}
|
||||
|
||||
void WifiSetting::onScanClick(lv_event_t* e) {
|
||||
(void)e;
|
||||
WifiSetting::instance().refreshNetworkList();
|
||||
}
|
||||
|
||||
void WifiSetting::onDisconnectClick(lv_event_t* e) {
|
||||
(void)e;
|
||||
Wifi::instance().disconnect();
|
||||
WifiSetting::instance().updateStatusDisplay();
|
||||
}
|
||||
|
||||
void WifiSetting::onConnectClick(lv_event_t* e) {
|
||||
(void)e;
|
||||
WifiSetting& settings = WifiSetting::instance();
|
||||
|
||||
if (settings.passwordInput_ && !settings.selectedSSID_.empty()) {
|
||||
const char* password = lv_textarea_get_text(settings.passwordInput_);
|
||||
|
||||
ESP_LOGI(TAG, "Connecting to %s", settings.selectedSSID_.c_str());
|
||||
|
||||
Wifi::instance().connect(settings.selectedSSID_.c_str(), password);
|
||||
Wifi::instance().saveNetwork(settings.selectedSSID_.c_str(), password);
|
||||
|
||||
settings.hidePasswordDialog();
|
||||
settings.refreshSavedNetworks();
|
||||
}
|
||||
}
|
||||
|
||||
void WifiSetting::onCancelClick(lv_event_t* e) {
|
||||
(void)e;
|
||||
WifiSetting::instance().hidePasswordDialog();
|
||||
}
|
||||
|
||||
void WifiSetting::onDeleteSavedClick(lv_event_t* e) {
|
||||
lv_obj_t* btn = (lv_obj_t*)lv_event_get_target(e);
|
||||
char* ssid = (char*)lv_obj_get_user_data(btn);
|
||||
if (ssid) {
|
||||
ESP_LOGI(TAG, "Deleting saved network: %s", ssid);
|
||||
Wifi::instance().removeNetwork(ssid);
|
||||
lv_free(ssid);
|
||||
WifiSetting::instance().refreshSavedNetworks();
|
||||
}
|
||||
}
|
||||
|
||||
void WifiSetting::onKeyboardReady(lv_event_t* e) {
|
||||
(void)e;
|
||||
onConnectClick(nullptr);
|
||||
}
|
||||
@ -1,51 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "lvgl.h"
|
||||
#include "esp_wifi.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class WifiSetting {
|
||||
public:
|
||||
static WifiSetting& instance();
|
||||
|
||||
void show();
|
||||
void hide();
|
||||
bool isVisible();
|
||||
void createPasswordDialogUI();
|
||||
|
||||
private:
|
||||
WifiSetting() = default;
|
||||
WifiSetting(const WifiSetting&) = delete;
|
||||
WifiSetting& operator=(const WifiSetting&) = delete;
|
||||
|
||||
void createUI();
|
||||
void refreshNetworkList();
|
||||
void refreshSavedNetworks();
|
||||
void updateStatusDisplay();
|
||||
void showPasswordDialog(const char* ssid);
|
||||
void hidePasswordDialog();
|
||||
|
||||
static void onCloseClick(lv_event_t* e);
|
||||
static void onNetworkSelect(lv_event_t* e);
|
||||
static void onScanClick(lv_event_t* e);
|
||||
static void onDisconnectClick(lv_event_t* e);
|
||||
static void onConnectClick(lv_event_t* e);
|
||||
static void onCancelClick(lv_event_t* e);
|
||||
static void onDeleteSavedClick(lv_event_t* e);
|
||||
static void onKeyboardReady(lv_event_t* e);
|
||||
|
||||
lv_obj_t* overlay_ = nullptr;
|
||||
lv_obj_t* statusLabel_ = nullptr;
|
||||
lv_obj_t* disconnectBtn_ = nullptr;
|
||||
lv_obj_t* networkList_ = nullptr;
|
||||
lv_obj_t* savedList_ = nullptr;
|
||||
lv_obj_t* passwordDialog_ = nullptr;
|
||||
lv_obj_t* passwordInput_ = nullptr;
|
||||
lv_obj_t* keyboard_ = nullptr;
|
||||
|
||||
std::string selectedSSID_;
|
||||
std::vector<wifi_ap_record_t> scannedNetworks_;
|
||||
|
||||
bool visible_ = false;
|
||||
};
|
||||
@ -3,6 +3,7 @@
|
||||
#include "esp_netif.h"
|
||||
#include "esp_eth.h"
|
||||
#include "ethernet_init.h"
|
||||
#include "lwip/ip4_addr.h"
|
||||
|
||||
|
||||
static const char* TAG = "Ethernet";
|
||||
@ -86,6 +87,7 @@ void Eth::init() {
|
||||
// default esp-netif configuration parameters.
|
||||
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();
|
||||
eth_netifs[0] = esp_netif_new(&cfg);
|
||||
netif_ = eth_netifs[0];
|
||||
eth_netif_glues[0] = esp_eth_new_netif_glue(eth_handles[0]);
|
||||
// Attach Ethernet driver to TCP/IP stack
|
||||
ESP_ERROR_CHECK(esp_netif_attach(eth_netifs[0], eth_netif_glues[0]));
|
||||
@ -98,4 +100,45 @@ void Eth::init() {
|
||||
for (int i = 0; i < eth_port_cnt; i++) {
|
||||
ESP_ERROR_CHECK(esp_eth_start(eth_handles[i]));
|
||||
}
|
||||
|
||||
initialized_ = true;
|
||||
}
|
||||
|
||||
void Eth::applyStaticIp(const StaticIpConfig& cfg) {
|
||||
if (!netif_) {
|
||||
ESP_LOGW(TAG, "applyStaticIp: no netif");
|
||||
return;
|
||||
}
|
||||
|
||||
esp_netif_dhcpc_stop(netif_);
|
||||
|
||||
esp_netif_ip_info_t ip_info = {};
|
||||
IP4_ADDR(&ip_info.ip, cfg.ip[0], cfg.ip[1], cfg.ip[2], cfg.ip[3]);
|
||||
IP4_ADDR(&ip_info.netmask, cfg.subnet[0], cfg.subnet[1], cfg.subnet[2], cfg.subnet[3]);
|
||||
IP4_ADDR(&ip_info.gw, cfg.gateway[0], cfg.gateway[1], cfg.gateway[2], cfg.gateway[3]);
|
||||
|
||||
esp_err_t err = esp_netif_set_ip_info(netif_, &ip_info);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to set static IP: %s", esp_err_to_name(err));
|
||||
esp_netif_dhcpc_start(netif_);
|
||||
return;
|
||||
}
|
||||
|
||||
esp_netif_dns_info_t dns_info = {};
|
||||
IP4_ADDR(&dns_info.ip.u_addr.ip4, cfg.dns[0], cfg.dns[1], cfg.dns[2], cfg.dns[3]);
|
||||
dns_info.ip.type = ESP_IPADDR_TYPE_V4;
|
||||
esp_netif_set_dns_info(netif_, ESP_NETIF_DNS_MAIN, &dns_info);
|
||||
|
||||
ESP_LOGI(TAG, "Static IP set: %d.%d.%d.%d", cfg.ip[0], cfg.ip[1], cfg.ip[2], cfg.ip[3]);
|
||||
}
|
||||
|
||||
std::string Eth::getIPAddress() {
|
||||
if (!netif_) return "";
|
||||
esp_netif_ip_info_t ip_info;
|
||||
if (esp_netif_get_ip_info(netif_, &ip_info) == ESP_OK) {
|
||||
char buf[16];
|
||||
snprintf(buf, sizeof(buf), IPSTR, IP2STR(&ip_info.ip));
|
||||
return buf;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@ -3,15 +3,25 @@
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include "esp_event.h"
|
||||
#include "esp_netif.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/event_groups.h"
|
||||
|
||||
struct StaticIpConfig {
|
||||
uint8_t ip[4];
|
||||
uint8_t subnet[4];
|
||||
uint8_t gateway[4];
|
||||
uint8_t dns[4];
|
||||
};
|
||||
|
||||
class Eth {
|
||||
|
||||
public:
|
||||
static Eth& instance();
|
||||
|
||||
void init();
|
||||
void applyStaticIp(const StaticIpConfig& cfg);
|
||||
std::string getIPAddress();
|
||||
|
||||
private:
|
||||
Eth() = default;
|
||||
@ -25,4 +35,5 @@ private:
|
||||
|
||||
bool initialized_ = false;
|
||||
EventGroupHandle_t ethEventGroup_ = nullptr;
|
||||
esp_netif_t* netif_ = nullptr;
|
||||
};
|
||||
@ -59,7 +59,9 @@ bool HistoryStore::isNumericSource(TextSource source) {
|
||||
source == TextSource::KNX_DPT_PERCENT ||
|
||||
source == TextSource::KNX_DPT_POWER ||
|
||||
source == TextSource::KNX_DPT_ENERGY ||
|
||||
source == TextSource::KNX_DPT_DECIMALFACTOR;
|
||||
source == TextSource::KNX_DPT_DECIMALFACTOR ||
|
||||
source == TextSource::KNX_DPT_HUMIDITY ||
|
||||
source == TextSource::KNX_DPT_LUX;
|
||||
}
|
||||
|
||||
bool HistoryStore::keysEqual(const SeriesKey& a, const SeriesKey& b) {
|
||||
|
||||
@ -153,6 +153,18 @@ void KnxWorker::init() {
|
||||
TextSource::KNX_DPT_ENERGY);
|
||||
}
|
||||
|
||||
KNXValue humidityValue = 0.0f;
|
||||
if (go.tryValue(humidityValue, DPT_Value_Humidity)) {
|
||||
WidgetManager::instance().onKnxValue(groupAddr, static_cast<float>(humidityValue),
|
||||
TextSource::KNX_DPT_HUMIDITY);
|
||||
}
|
||||
|
||||
KNXValue luxValue = 0.0f;
|
||||
if (go.tryValue(luxValue, DPT_Value_Lux)) {
|
||||
WidgetManager::instance().onKnxValue(groupAddr, static_cast<float>(luxValue),
|
||||
TextSource::KNX_DPT_LUX);
|
||||
}
|
||||
|
||||
struct tm timeTm = {};
|
||||
KNXValue timeValue(timeTm);
|
||||
if (go.tryValue(timeValue, DPT_TimeOfDay)) {
|
||||
|
||||
96
main/NetworkConfig.cpp
Normal file
96
main/NetworkConfig.cpp
Normal file
@ -0,0 +1,96 @@
|
||||
#include "NetworkConfig.hpp"
|
||||
#include "Hardware/Eth.hpp"
|
||||
#include "Wifi.hpp"
|
||||
#include "knx_facade.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
static const char* TAG = "NetworkConfig";
|
||||
|
||||
// Parameter offsets within the NW module's parameter block.
|
||||
// These must match the offsets generated by OpenKNXproducer for the NW module.
|
||||
// The producer assigns a base offset; these are relative offsets within Network.share.xml.
|
||||
// After running the producer, update NW_PARAM_BASE to the assigned base offset.
|
||||
|
||||
static constexpr uint16_t NW_PARAM_BASE = 0; // Will be set by producer
|
||||
|
||||
// Byte 0: Flags
|
||||
static constexpr uint16_t NW_FLAGS = NW_PARAM_BASE + 0;
|
||||
static constexpr uint8_t NW_LAN_ENABLE_MASK = 0x80; // Bit 7
|
||||
static constexpr uint8_t NW_LAN_STATIC_MASK = 0x40; // Bit 6
|
||||
static constexpr uint8_t NW_WLAN_ENABLE_MASK = 0x20; // Bit 5
|
||||
static constexpr uint8_t NW_WLAN_STATIC_MASK = 0x10; // Bit 4
|
||||
|
||||
// LAN IP config: bytes 1-16
|
||||
static constexpr uint16_t NW_LAN_IP = NW_PARAM_BASE + 1;
|
||||
static constexpr uint16_t NW_LAN_SUBNET = NW_PARAM_BASE + 5;
|
||||
static constexpr uint16_t NW_LAN_GATEWAY = NW_PARAM_BASE + 9;
|
||||
static constexpr uint16_t NW_LAN_DNS = NW_PARAM_BASE + 13;
|
||||
|
||||
// WLAN IP config: bytes 17-32
|
||||
static constexpr uint16_t NW_WLAN_IP = NW_PARAM_BASE + 17;
|
||||
static constexpr uint16_t NW_WLAN_SUBNET = NW_PARAM_BASE + 21;
|
||||
static constexpr uint16_t NW_WLAN_GATEWAY = NW_PARAM_BASE + 25;
|
||||
static constexpr uint16_t NW_WLAN_DNS = NW_PARAM_BASE + 29;
|
||||
|
||||
extern KnxFacade<Esp32IdfPlatform, Bau07B0> knx;
|
||||
|
||||
static void readIpOctets(uint16_t offset, uint8_t out[4]) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
out[i] = knx.paramByte(offset + i);
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkConfig::applyFromKnx() {
|
||||
if (!knx.configured()) {
|
||||
ESP_LOGW(TAG, "KNX not configured, using default network settings");
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t flags = knx.paramByte(NW_FLAGS);
|
||||
bool lanEnabled = (flags & NW_LAN_ENABLE_MASK) != 0;
|
||||
bool lanStatic = (flags & NW_LAN_STATIC_MASK) != 0;
|
||||
bool wlanEnabled = (flags & NW_WLAN_ENABLE_MASK) != 0;
|
||||
bool wlanStatic = (flags & NW_WLAN_STATIC_MASK) != 0;
|
||||
|
||||
ESP_LOGI(TAG, "Network config: LAN=%s(%s) WLAN=%s(%s)",
|
||||
lanEnabled ? "on" : "off", lanStatic ? "static" : "dhcp",
|
||||
wlanEnabled ? "on" : "off", wlanStatic ? "static" : "dhcp");
|
||||
|
||||
// Apply LAN static IP if configured
|
||||
if (lanEnabled && lanStatic) {
|
||||
StaticIpConfig cfg = {};
|
||||
readIpOctets(NW_LAN_IP, cfg.ip);
|
||||
readIpOctets(NW_LAN_SUBNET, cfg.subnet);
|
||||
readIpOctets(NW_LAN_GATEWAY, cfg.gateway);
|
||||
readIpOctets(NW_LAN_DNS, cfg.dns);
|
||||
|
||||
ESP_LOGI(TAG, "LAN static: %d.%d.%d.%d/%d.%d.%d.%d gw %d.%d.%d.%d dns %d.%d.%d.%d",
|
||||
cfg.ip[0], cfg.ip[1], cfg.ip[2], cfg.ip[3],
|
||||
cfg.subnet[0], cfg.subnet[1], cfg.subnet[2], cfg.subnet[3],
|
||||
cfg.gateway[0], cfg.gateway[1], cfg.gateway[2], cfg.gateway[3],
|
||||
cfg.dns[0], cfg.dns[1], cfg.dns[2], cfg.dns[3]);
|
||||
|
||||
Eth::instance().applyStaticIp(cfg);
|
||||
}
|
||||
|
||||
// Initialize WLAN if enabled
|
||||
if (wlanEnabled) {
|
||||
Wifi::instance().init();
|
||||
|
||||
if (wlanStatic) {
|
||||
StaticIpConfig cfg = {};
|
||||
readIpOctets(NW_WLAN_IP, cfg.ip);
|
||||
readIpOctets(NW_WLAN_SUBNET, cfg.subnet);
|
||||
readIpOctets(NW_WLAN_GATEWAY, cfg.gateway);
|
||||
readIpOctets(NW_WLAN_DNS, cfg.dns);
|
||||
|
||||
ESP_LOGI(TAG, "WLAN static: %d.%d.%d.%d/%d.%d.%d.%d gw %d.%d.%d.%d dns %d.%d.%d.%d",
|
||||
cfg.ip[0], cfg.ip[1], cfg.ip[2], cfg.ip[3],
|
||||
cfg.subnet[0], cfg.subnet[1], cfg.subnet[2], cfg.subnet[3],
|
||||
cfg.gateway[0], cfg.gateway[1], cfg.gateway[2], cfg.gateway[3],
|
||||
cfg.dns[0], cfg.dns[1], cfg.dns[2], cfg.dns[3]);
|
||||
|
||||
Wifi::instance().applyStaticIp(cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
8
main/NetworkConfig.hpp
Normal file
8
main/NetworkConfig.hpp
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class NetworkConfig {
|
||||
public:
|
||||
static void applyFromKnx();
|
||||
};
|
||||
@ -57,6 +57,7 @@ enum class ButtonAction : uint8_t {
|
||||
KNX = 0,
|
||||
JUMP = 1,
|
||||
BACK = 2,
|
||||
NONE = 3,
|
||||
};
|
||||
|
||||
enum class ChartPeriod : uint8_t {
|
||||
@ -84,6 +85,8 @@ enum class TextSource : uint8_t {
|
||||
SYSTEM_TIME = 11, // System Time (RTC)
|
||||
SYSTEM_DATE = 12, // System Date (RTC)
|
||||
SYSTEM_DATETIME = 13, // System DateTime (RTC)
|
||||
KNX_DPT_HUMIDITY = 14, // KNX Humidity (DPT 9.007)
|
||||
KNX_DPT_LUX = 15, // KNX Lux (DPT 9.004)
|
||||
};
|
||||
|
||||
enum class TextAlign : uint8_t {
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
#include "Wifi.hpp"
|
||||
#include "Hardware/Eth.hpp"
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_netif.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "nvs.h"
|
||||
#include "lwip/ip4_addr.h"
|
||||
#include <cstring>
|
||||
#include <algorithm>
|
||||
|
||||
@ -61,9 +63,8 @@ void Wifi::init() {
|
||||
|
||||
wifiEventGroup_ = xEventGroupCreate();
|
||||
|
||||
ESP_ERROR_CHECK(esp_netif_init());
|
||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||
esp_netif_create_default_wifi_sta();
|
||||
// esp_netif_init() and esp_event_loop_create_default() are already called by Eth::init()
|
||||
netif_ = esp_netif_create_default_wifi_sta();
|
||||
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
||||
@ -323,3 +324,42 @@ bool Wifi::getSavedPassword(const char* ssid, std::string& password) {
|
||||
nvs_close(handle);
|
||||
return false;
|
||||
}
|
||||
|
||||
void Wifi::applyStaticIp(const StaticIpConfig& cfg) {
|
||||
if (!netif_) {
|
||||
ESP_LOGW(TAG, "applyStaticIp: no netif");
|
||||
return;
|
||||
}
|
||||
|
||||
esp_netif_dhcpc_stop(netif_);
|
||||
|
||||
esp_netif_ip_info_t ip_info = {};
|
||||
IP4_ADDR(&ip_info.ip, cfg.ip[0], cfg.ip[1], cfg.ip[2], cfg.ip[3]);
|
||||
IP4_ADDR(&ip_info.netmask, cfg.subnet[0], cfg.subnet[1], cfg.subnet[2], cfg.subnet[3]);
|
||||
IP4_ADDR(&ip_info.gw, cfg.gateway[0], cfg.gateway[1], cfg.gateway[2], cfg.gateway[3]);
|
||||
|
||||
esp_err_t err = esp_netif_set_ip_info(netif_, &ip_info);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to set static IP: %s", esp_err_to_name(err));
|
||||
esp_netif_dhcpc_start(netif_);
|
||||
return;
|
||||
}
|
||||
|
||||
esp_netif_dns_info_t dns_info = {};
|
||||
IP4_ADDR(&dns_info.ip.u_addr.ip4, cfg.dns[0], cfg.dns[1], cfg.dns[2], cfg.dns[3]);
|
||||
dns_info.ip.type = ESP_IPADDR_TYPE_V4;
|
||||
esp_netif_set_dns_info(netif_, ESP_NETIF_DNS_MAIN, &dns_info);
|
||||
|
||||
ESP_LOGI(TAG, "WiFi static IP set: %d.%d.%d.%d", cfg.ip[0], cfg.ip[1], cfg.ip[2], cfg.ip[3]);
|
||||
}
|
||||
|
||||
std::string Wifi::getIPAddress() {
|
||||
if (!netif_) return "";
|
||||
esp_netif_ip_info_t ip_info;
|
||||
if (esp_netif_get_ip_info(netif_, &ip_info) == ESP_OK) {
|
||||
char buf[16];
|
||||
snprintf(buf, sizeof(buf), IPSTR, IP2STR(&ip_info.ip));
|
||||
return buf;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -5,14 +5,18 @@
|
||||
#include <functional>
|
||||
#include "esp_wifi.h"
|
||||
#include "esp_event.h"
|
||||
#include "esp_netif.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/event_groups.h"
|
||||
|
||||
struct StaticIpConfig;
|
||||
|
||||
class Wifi {
|
||||
public:
|
||||
static Wifi& instance();
|
||||
|
||||
void init();
|
||||
void applyStaticIp(const StaticIpConfig& cfg);
|
||||
void scan(std::function<void(std::vector<wifi_ap_record_t>&)> callback);
|
||||
void connect(const char* ssid, const char* password);
|
||||
void disconnect();
|
||||
@ -52,4 +56,6 @@ private:
|
||||
|
||||
static constexpr const char* NVS_NAMESPACE = "wifi_creds";
|
||||
static constexpr int MAX_SAVED_NETWORKS = 10;
|
||||
|
||||
esp_netif_t* netif_ = nullptr;
|
||||
};
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include "KnxWorker.hpp"
|
||||
#include "Wifi.hpp"
|
||||
#include "Hardware/Eth.hpp"
|
||||
#include "NetworkConfig.hpp"
|
||||
#include "WebServer.hpp"
|
||||
#include "SdCard.hpp"
|
||||
#include "Fonts.hpp"
|
||||
@ -22,6 +23,10 @@
|
||||
static void knx_task(void* arg) {
|
||||
KnxWorker* worker = static_cast<KnxWorker*>(arg);
|
||||
worker->init();
|
||||
|
||||
// Apply network config from KNX parameters after KNX is initialized
|
||||
NetworkConfig::applyFromKnx();
|
||||
|
||||
while (true) {
|
||||
worker->loop();
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
|
||||
@ -174,6 +174,8 @@ void ArcWidget::onKnxValue(float value) {
|
||||
case TextSource::KNX_DPT_POWER:
|
||||
case TextSource::KNX_DPT_ENERGY:
|
||||
case TextSource::KNX_DPT_DECIMALFACTOR:
|
||||
case TextSource::KNX_DPT_HUMIDITY:
|
||||
case TextSource::KNX_DPT_LUX:
|
||||
lastValue_ = value;
|
||||
lv_arc_set_value(obj_, clampToRange(value, config_.arcMin, config_.arcMax));
|
||||
updateValueLabel(value);
|
||||
|
||||
@ -243,7 +243,9 @@ void LabelWidget::onKnxValue(float value) {
|
||||
config_.textSource != TextSource::KNX_DPT_PERCENT &&
|
||||
config_.textSource != TextSource::KNX_DPT_POWER &&
|
||||
config_.textSource != TextSource::KNX_DPT_ENERGY &&
|
||||
config_.textSource != TextSource::KNX_DPT_DECIMALFACTOR) {
|
||||
config_.textSource != TextSource::KNX_DPT_DECIMALFACTOR &&
|
||||
config_.textSource != TextSource::KNX_DPT_HUMIDITY &&
|
||||
config_.textSource != TextSource::KNX_DPT_LUX) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -256,7 +256,9 @@ void PowerLinkWidget::onKnxValue(float value) {
|
||||
config_.textSource != TextSource::KNX_DPT_PERCENT &&
|
||||
config_.textSource != TextSource::KNX_DPT_POWER &&
|
||||
config_.textSource != TextSource::KNX_DPT_ENERGY &&
|
||||
config_.textSource != TextSource::KNX_DPT_DECIMALFACTOR) return;
|
||||
config_.textSource != TextSource::KNX_DPT_DECIMALFACTOR &&
|
||||
config_.textSource != TextSource::KNX_DPT_HUMIDITY &&
|
||||
config_.textSource != TextSource::KNX_DPT_LUX) return;
|
||||
|
||||
float factor = parseFloatOr(config_.text, 1.0f);
|
||||
float speed = std::fabs(value) * factor;
|
||||
|
||||
@ -289,7 +289,9 @@ static bool isNumericSource(TextSource source) {
|
||||
source == TextSource::KNX_DPT_PERCENT ||
|
||||
source == TextSource::KNX_DPT_POWER ||
|
||||
source == TextSource::KNX_DPT_ENERGY ||
|
||||
source == TextSource::KNX_DPT_DECIMALFACTOR;
|
||||
source == TextSource::KNX_DPT_DECIMALFACTOR ||
|
||||
source == TextSource::KNX_DPT_HUMIDITY ||
|
||||
source == TextSource::KNX_DPT_LUX;
|
||||
}
|
||||
|
||||
static void formatValue(char* buf, size_t bufSize, float value, const char* fmt, TextSource source) {
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
<template v-else>
|
||||
<div class="absolute inset-0 overflow-hidden" :style="roomCardTileContainerStyle">
|
||||
<!-- Room name (top-left) -->
|
||||
<div class="absolute" :style="{ left: '16px', top: '12px', color: widget.textColor, fontSize: fontSizes[widget.fontSize || 2] + 'px', fontWeight: 600 }">
|
||||
<div class="absolute" :style="{ left: (16 * scale) + 'px', top: (12 * scale) + 'px', color: widget.textColor, fontSize: (fontSizes[widget.fontSize || 2] * scale) + 'px', fontWeight: 600 }">
|
||||
{{ roomCardParts.name }}
|
||||
</div>
|
||||
<!-- Text Lines -->
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
</template>
|
||||
<div :class="rowClass"><label :class="labelClass">Klick-Aktion</label>
|
||||
<select :class="inputClass" v-model.number="widget.action">
|
||||
<option :value="BUTTON_ACTIONS.NONE">Keine</option>
|
||||
<option :value="BUTTON_ACTIONS.JUMP">Sprung</option>
|
||||
<option :value="BUTTON_ACTIONS.BACK">Zurueck</option>
|
||||
</select>
|
||||
|
||||
@ -30,7 +30,8 @@ export const ICON_POSITIONS = {
|
||||
export const BUTTON_ACTIONS = {
|
||||
KNX: 0,
|
||||
JUMP: 1,
|
||||
BACK: 2
|
||||
BACK: 2,
|
||||
NONE: 3
|
||||
};
|
||||
|
||||
export const TEXT_ALIGNS = {
|
||||
@ -90,7 +91,9 @@ export const textSources = {
|
||||
10: 'KNX Datum & Uhrzeit (DPT 19.001)',
|
||||
11: 'System Uhrzeit',
|
||||
12: 'System Datum',
|
||||
13: 'System Datum & Uhrzeit'
|
||||
13: 'System Datum & Uhrzeit',
|
||||
14: 'KNX Luftfeuchtigkeit (DPT 9.007)',
|
||||
15: 'KNX Helligkeit (DPT 9.004)'
|
||||
};
|
||||
|
||||
export const textSourceGroups = [
|
||||
@ -98,7 +101,7 @@ export const textSourceGroups = [
|
||||
{ label: 'System', values: [11, 12, 13] },
|
||||
{ label: 'DPT 1.x', values: [2] },
|
||||
{ label: 'DPT 5.x', values: [3, 7] },
|
||||
{ label: 'DPT 9.x', values: [1] },
|
||||
{ label: 'DPT 9.x', values: [1, 14, 15] },
|
||||
{ label: 'DPT 10.x', values: [8] },
|
||||
{ label: 'DPT 11.x', values: [9] },
|
||||
{ label: 'DPT 13.x', values: [6] },
|
||||
@ -108,17 +111,17 @@ export const textSourceGroups = [
|
||||
];
|
||||
|
||||
export const sourceOptions = {
|
||||
label: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
|
||||
label: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
||||
button: [0],
|
||||
led: [0, 2],
|
||||
icon: [0, 2],
|
||||
powernode: [0, 1, 2, 3, 4, 5, 6, 7],
|
||||
powerlink: [0, 1, 3, 5, 6, 7],
|
||||
chart: [1, 3, 5, 6, 7],
|
||||
powernode: [0, 1, 2, 3, 4, 5, 6, 7, 14, 15],
|
||||
powerlink: [0, 1, 3, 5, 6, 7, 14, 15],
|
||||
chart: [1, 3, 5, 6, 7, 14, 15],
|
||||
clock: [11],
|
||||
roomcard: [0, 1, 3, 5, 6, 7], // Temperature sources
|
||||
roomcard: [0, 1, 3, 5, 6, 7, 14, 15],
|
||||
rectangle: [0],
|
||||
arc: [0, 1, 2, 3, 5, 6, 7],
|
||||
arc: [0, 1, 2, 3, 5, 6, 7, 14, 15],
|
||||
buttonmatrix: [0]
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user