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:
@@ -346,15 +346,23 @@ static GwSerial * createSerialImpl(GwConfigHandler *config,GwLog *logger, int id
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (ena >= 0){
|
if (ena >= 0){
|
||||||
|
int value=-1;
|
||||||
if (type == GWSERIAL_TYPE_UNI){
|
if (type == GWSERIAL_TYPE_UNI){
|
||||||
String cfgMode=config->getString(param->direction);
|
String cfgMode=config->getString(param->direction);
|
||||||
int value=0;
|
if (cfgMode == "send"){
|
||||||
if (cfgMode == "send"){
|
|
||||||
value=elow?0:1;
|
value=elow?0:1;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
value=elow?1:0;
|
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);
|
LOG_DEBUG(GwLog::LOG,"serial %d: setting output enable %d to %d",param->id,ena,value);
|
||||||
pinMode(ena,OUTPUT);
|
pinMode(ena,OUTPUT);
|
||||||
digitalWrite(ena,value);
|
digitalWrite(ena,value);
|
||||||
@@ -483,7 +491,8 @@ void GwChannelList::begin(bool fallbackSerial){
|
|||||||
|
|
||||||
//new serial config handling
|
//new serial config handling
|
||||||
for (auto &&init:serialInits){
|
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);
|
GwSerial *ser=createSerialImpl(config,logger,init.serial,init.mode,init.rx,init.tx,false,init.ena,init.elow);
|
||||||
if (ser != nullptr){
|
if (ser != nullptr){
|
||||||
channel=createChannel(logger,config,init.serial,ser);
|
channel=createChannel(logger,config,init.serial,ser);
|
||||||
|
|||||||
@@ -326,6 +326,24 @@ types:
|
|||||||
- PPIN23
|
- PPIN23
|
||||||
- PPIN25
|
- PPIN25
|
||||||
- PPIN33
|
- 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
|
- &serialRX
|
||||||
<<: *gpioinput
|
<<: *gpioinput
|
||||||
@@ -358,6 +376,13 @@ types:
|
|||||||
value: 1
|
value: 1
|
||||||
- key: false
|
- key: false
|
||||||
value: 0
|
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
|
- &serialValues
|
||||||
- key: true
|
- key: true
|
||||||
@@ -377,6 +402,7 @@ types:
|
|||||||
- *serialTX
|
- *serialTX
|
||||||
- *serialEnablePin
|
- *serialEnablePin
|
||||||
- *serialEnableLow
|
- *serialEnableLow
|
||||||
|
- *serialFixedBaud
|
||||||
- key: bi
|
- key: bi
|
||||||
value: 2
|
value: 2
|
||||||
label: "BiDir"
|
label: "BiDir"
|
||||||
@@ -385,18 +411,25 @@ types:
|
|||||||
children:
|
children:
|
||||||
- *serialRX
|
- *serialRX
|
||||||
- *serialTX
|
- *serialTX
|
||||||
|
- *serialFixedBaud
|
||||||
- key: rx
|
- key: rx
|
||||||
value: 3
|
value: 3
|
||||||
label: "RX"
|
label: "RX"
|
||||||
description: "Input only"
|
description: "Input only"
|
||||||
children:
|
children:
|
||||||
- *serialRX
|
- *serialRX
|
||||||
|
- *serialEnablePin
|
||||||
|
- *serialEnableLow
|
||||||
|
- *serialFixedBaud
|
||||||
- key: tx
|
- key: tx
|
||||||
value: 1
|
value: 1
|
||||||
label: "TX"
|
label: "TX"
|
||||||
description: "output only"
|
description: "output only"
|
||||||
children:
|
children:
|
||||||
- *serialTX
|
- *serialTX
|
||||||
|
- *serialEnablePin
|
||||||
|
- *serialEnableLow
|
||||||
|
- *serialFixedBaud
|
||||||
- &serial1
|
- &serial1
|
||||||
type: checkbox
|
type: checkbox
|
||||||
label: 'Serial 1'
|
label: 'Serial 1'
|
||||||
|
|||||||
Reference in New Issue
Block a user