From 68239f6199d6c2934c85c1c721889221fd633490 Mon Sep 17 00:00:00 2001 From: wellenvogel Date: Mon, 29 Sep 2025 19:34:35 +0200 Subject: [PATCH] add fixed baud to cibuild, allow enable pin also for pure rx/tx serial --- lib/channel/GwChannelList.cpp | 25 +++++++++++++++++-------- webinstall/build.yaml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 8 deletions(-) diff --git a/lib/channel/GwChannelList.cpp b/lib/channel/GwChannelList.cpp index d89f227..cc70ecc 100644 --- a/lib/channel/GwChannelList.cpp +++ b/lib/channel/GwChannelList.cpp @@ -346,15 +346,23 @@ static GwSerial * createSerialImpl(GwConfigHandler *config,GwLog *logger, int id return nullptr; } if (ena >= 0){ + int value=-1; if (type == GWSERIAL_TYPE_UNI){ - String cfgMode=config->getString(param->direction); - int value=0; - if (cfgMode == "send"){ + String cfgMode=config->getString(param->direction); + if (cfgMode == "send"){ value=elow?0:1; - } - else{ - value=elow?1:0; - } + } + else{ + value=elow?1:0; + } + } + if (type == GWSERIAL_TYPE_RX){ + value=elow?1:0; + } + if (type == GWSERIAL_TYPE_TX){ + value=elow?0:1; + } + if (value >= 0){ LOG_DEBUG(GwLog::LOG,"serial %d: setting output enable %d to %d",param->id,ena,value); pinMode(ena,OUTPUT); digitalWrite(ena,value); @@ -483,7 +491,8 @@ void GwChannelList::begin(bool fallbackSerial){ //new serial config handling for (auto &&init:serialInits){ - LOG_INFO("creating serial channel %d, rx=%d,tx=%d,type=%d",init.serial,init.rx,init.tx,init.mode); + LOG_INFO("creating serial channel %d, rx=%d,tx=%d,type=%d fixedBaud=%d ena=%d elow=%d", + init.serial,init.rx,init.tx,init.mode,init.fixedBaud,init.ena,init.elow); GwSerial *ser=createSerialImpl(config,logger,init.serial,init.mode,init.rx,init.tx,false,init.ena,init.elow); if (ser != nullptr){ channel=createChannel(logger,config,init.serial,ser); diff --git a/webinstall/build.yaml b/webinstall/build.yaml index 61ddf19..4085704 100644 --- a/webinstall/build.yaml +++ b/webinstall/build.yaml @@ -326,6 +326,24 @@ types: - PPIN23 - PPIN25 - PPIN33 + + - &baudselect + type: dropdown + help: 'Select the baud rate' + values: + - {label: unset,value:} + - 1200 + - 2400 + - 4800 + - 9600 + - 14400 + - 19200 + - 28800 + - 38400 + - 57600 + - 115200 + - 230400 + - 460800 - &serialRX <<: *gpioinput @@ -358,6 +376,13 @@ types: value: 1 - key: false value: 0 + + - &serialFixedBaud + <<: *baudselect + key: fixedBaud + label: "fixed baud" + help: "you can set a fixed baud rate here, this disables changing the baud rate in the UI" + target: "define:#serial#BAUD" - &serialValues - key: true @@ -377,6 +402,7 @@ types: - *serialTX - *serialEnablePin - *serialEnableLow + - *serialFixedBaud - key: bi value: 2 label: "BiDir" @@ -385,18 +411,25 @@ types: children: - *serialRX - *serialTX + - *serialFixedBaud - key: rx value: 3 label: "RX" description: "Input only" children: - *serialRX + - *serialEnablePin + - *serialEnableLow + - *serialFixedBaud - key: tx value: 1 label: "TX" description: "output only" children: - *serialTX + - *serialEnablePin + - *serialEnableLow + - *serialFixedBaud - &serial1 type: checkbox label: 'Serial 1'