Skip to content

Commit

Permalink
Fix/Improve Batch-Export: Check Channel-Definition before Start of Ex…
Browse files Browse the repository at this point in the history
…port + UI

* Fix: Check Before Export (Channel in Range)
* Batch Export UI: Improve Layout for Multi-Export Format
* Fix: ExportSourcesString should reset ...
  • Loading branch information
cornelius-koepp committed Oct 8, 2024
1 parent 7e7391b commit 5906ee8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/ConfigTransfer.script.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,19 @@ function uctParseRangesString(channelsString) {
function uctBtnExport(device, online, progress, context) {
Log.info("OpenKNX ConfigTransfer: Handle Channel Export ...")
var module = uctModuleOrder[device.getParameterByName(context.p_moduleSelection).value];
var moduleChannelCount = uctChannelParams[module].channels;

var channelSource = device.getParameterByName(context.p_channelSource).value;
var channels = [channelSource];
if (channelSource == 253) {
channels = uctParseRangesString(device.getParameterByName(context.p_channelSourcesString).value);
}
if (channels.length == 0) {
throw new Error("Kein Kanal definiert!");
}
if (/* channels.length > 0 */ channels[channels.length - 1] > moduleChannelCount) {
throw new Error("Kanal außerhalb von Modul-Bereich!");
}
if (channels.length > 1) {
Log.info("OpenKNX ConfigTransfer: Multi-Channel " + channels.join(","));
}
Expand Down
14 changes: 13 additions & 1 deletion src/ConfigTransfer.share.xml
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@
<LParameters>
<ParameterRefRef RefId="%AID%_P-%TT%00200_R-%TT%0020001" AliasName="ExportModul" />
<ParameterRefRef RefId="%AID%_P-%TT%00201_R-%TT%0020101" AliasName="ExportSource" />
<ParameterRefRef RefId="%AID%_P-%TT%00206_R-%TT%0020601" AliasName="ExportSourcesString" />
<ParameterRefRef RefId="%AID%_P-%TT%00205_R-%TT%0020501" AliasName="ExportParamSelection" />
<ParameterRefRef RefId="%AID%_P-%TT%00202_R-%TT%0020201" AliasName="ExportFormat" />
</LParameters>
Expand Down Expand Up @@ -561,7 +562,18 @@
</choose>
<choose ParamRefId="%AID%_P-%TT%00201_R-%TT%0020101">
<when test="253">
<ParameterSeparator Id="%AID%_PS-nnn" Text="Format: Je eine Zeile pro Kanal im Standardformat (Import als Einzelkanäle möglich in älteren Versionen von Konfigurationstransfer)" />
<ParameterBlock Id="%AID%_PB-nnn" Name="ExportFormatBatch" Inline="true" Layout="Grid" HelpContext="UCT-Format" >
<Rows>
<Row Id="%AID%_PB-nnn_R-1" Name="Row1" />
</Rows>
<Columns>
<!-- col1>45% to prevent text left of other elements on right side -->
<Column Id="%AID%_PB-nnn_C-1" Name="Col1" Width="46%" />
<Column Id="%AID%_PB-nnn_C-2" Name="Col2" Width="54%" />
</Columns>
<ParameterSeparator Id="%AID%_PS-nnn" Text="Format" Cell="1,1" />
<ParameterSeparator Id="%AID%_PS-nnn" Text="Je eine Zeile pro Kanal im Standardformat&#xD;&#xA;(Import als Einzelkanäle möglich in älteren Versionen von Konfigurationstransfer)" Cell="1,2" />
</ParameterBlock>
</when>
<when default="true">
<ParameterRefRef RefId="%AID%_P-%TT%00202_R-%TT%0020201" HelpContext="UCT-Format" />
Expand Down

0 comments on commit 5906ee8

Please sign in to comment.