intermediate: serial defs

This commit is contained in:
andreas 2023-10-09 17:43:07 +02:00
parent 4c2ec46aae
commit 72a9afa27d
3 changed files with 53 additions and 11 deletions

View File

@ -131,16 +131,51 @@ types:
label: 'Serial 1'
key: serial1
values:
- type: frame
key: true
- key: true
children:
- <<: *gpiopin
key: RX
target: "define:GWSERIAL_RX"
- <<: *gpiopin
key: TX
target: "define:GWSERIAL_TX"
- type: select
key: type
target: "define:GWSERIAL_TYPE"
label: "Serial Type"
values:
- key: uni
value: 1
label: "UNI"
description: "Select direction at Config UI"
children:
- <<: *gpiopin
key: RX
target: "define:GWSERIAL_RX"
- <<: *gpiopin
key: TX
target: "define:GWSERIAL_TX"
- key: bi
value: 2
label: "BiDir"
description: "Input and Output"
children:
- <<: *gpiopin
key: RX
target: "define:GWSERIAL_RX"
- <<: *gpiopin
key: TX
target: "define:GWSERIAL_TX"
- key: rx
value: 3
label: "RX"
description: "Input only"
children:
- <<: *gpiopin
key: RX
target: "define:GWSERIAL_RX"
- key: tx
value: 1
label: "TX"
description: "output only"
children:
- <<: *gpiopin
key: TX
target: "define:GWSERIAL_TX"
resources:
default: &esp32default
serial: 2

View File

@ -141,8 +141,8 @@
margin-top: 0.3em;
}
.configui .tcheckbox .inputFrame,
.configui .tdropdown .inputFrame {
.configui .tcheckbox>.inputFrame,
.configui .tdropdown>.inputFrame {
display: flex;
flex-direction: row;
align-items: center;

View File

@ -303,6 +303,13 @@ class PipelineInfo{
initialConfig=config;
}
let expandedValues=expandList(config.values,config);
expandedValues.forEach((v)=>{
if (v.type !== undefined && v.type !== "frame"){
let err="value element with wrong type "+v.type+" at "+name;
alert(err);
throw new Error(err);
}
})
if (config.type === 'select') {
for (let idx=0;idx<expandedValues.length;idx++){
let v=expandedValues[idx];