Skip to content

Commit

Permalink
add second channel import
Browse files Browse the repository at this point in the history
  • Loading branch information
openshwprojects committed Feb 21, 2024
1 parent 7de7b7b commit 685ba77
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions templateParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,20 @@ function processJSON_OpenBekenTemplateStyle(tmpl) {
for (const pin in pins) {
pinDesc = pins[pin];
console.log(`Pin ${pin} is connected to ${pinDesc}.`);
[roleName, channel] = pinDesc.split(';');
[roleName, channel, channel2] = pinDesc.split(';');
// remap some old convention
if(roleName == "Button") {roleName = "Btn"; }
if(roleName == "Button_n") {roleName = "Btn_n"; }
if(roleName == "Relay") {roleName = "Rel"; }
if(roleName == "Relay_n") {roleName = "Rel_n"; }
desc += "- P"+pin+" is " + roleName + " on channel " + channel +"\n";
scr += "backlog setPinRole "+pin+" "+roleName+"; setPinChannel " + pin + " " +channel+"\n";
scr += "backlog setPinRole "+pin+" "+roleName+"; setPinChannel " + pin + " " +channel;
// setPinChannel command can take now third argument, which is optional
if(channel2 != undefined && channel2 != 0)
{
scr += " " +channel2+"";
}
scr += "\n";
}
if(tmpl.flags != undefined) {
scr += "Flags "+tmpl.flags+"\n";
Expand Down

0 comments on commit 685ba77

Please sign in to comment.