1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2026-02-11 07:03:07 +01:00

add fixed baud to cibuild, allow enable pin also for pure rx/tx serial

This commit is contained in:
wellenvogel
2025-09-29 19:34:35 +02:00
parent b683413129
commit 68239f6199
2 changed files with 50 additions and 8 deletions

View File

@@ -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);

View File

@@ -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'