Skip to content

Commit

Permalink
Changed "bootloader*" to "passthrough*"
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchBradley committed Feb 3, 2025
1 parent 8912661 commit 3207f5f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
18 changes: 9 additions & 9 deletions FluidNC/src/ProcessSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -766,22 +766,22 @@ static Error showGPIOs(const char* value, AuthenticationLevel auth_level, Channe

static Error uartPassthrough(const char* value, AuthenticationLevel auth_level, Channel& out) {
Uart* downstream_uart = nullptr;
int uart_num;
if (!value) {
value = "uart1";
value = "auto";
}
int uart_num;
if (strcasecmp(value, "auto") == 0) {
// Find a UART device with a non-empty bootloader_baud config item
// Find a UART device with a non-empty passthrough_baud config item
for (uart_num = 1; uart_num < MAX_N_UARTS; ++uart_num) {
downstream_uart = config->_uarts[uart_num];
if (downstream_uart) {
if (downstream_uart->_bootloader_baud != 0) {
if (downstream_uart->_passthrough_baud != 0) {
break;
}
}
}
if (uart_num == MAX_N_UARTS) {
log_error_to(out, "No uart has bootloader_baud configured");
log_error_to(out, "No uart has passthrough_baud configured");
return Error::InvalidValue;
}
} else {
Expand All @@ -790,8 +790,8 @@ static Error uartPassthrough(const char* value, AuthenticationLevel auth_level,
downstream_uart = config->_uarts[uart_num];
if (downstream_uart) {
if (downstream_uart->name() == value) {
if (downstream_uart->_bootloader_baud == 0) {
log_error_to(out, value << " does not have bootloader_baud configured");
if (downstream_uart->_passthrough_baud == 0) {
log_error_to(out, value << " does not have passthrough_baud configured");
return Error::InvalidValue;
} else {
break;
Expand Down Expand Up @@ -822,7 +822,7 @@ static Error uartPassthrough(const char* value, AuthenticationLevel auth_level,
if (channel) {
channel->pause();
}
downstream_uart->enterBootloader();
downstream_uart->enterPassthrough();

const int buflen = 256;
uint8_t buffer[buflen];
Expand All @@ -846,7 +846,7 @@ static Error uartPassthrough(const char* value, AuthenticationLevel auth_level,
}
}

downstream_uart->exitBootloader();
downstream_uart->exitPassthrough();
if (channel) {
channel->resume();
}
Expand Down
6 changes: 3 additions & 3 deletions FluidNC/src/Uart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ void Uart::restoreMode() {
changeMode(_baud, _dataBits, _parity, _stopBits);
}

void Uart::enterBootloader() {
changeMode(_bootloader_baud, _bootloader_databits, _bootloader_parity, _bootloader_stopbits);
void Uart::enterPassthrough() {
changeMode(_passthrough_baud, _passthrough_databits, _passthrough_parity, _passthrough_stopbits);
}

void Uart::exitBootloader() {
void Uart::exitPassthrough() {
restoreMode();
if (_sw_flowcontrol_enabled) {
setSwFlowControl(_sw_flowcontrol_enabled, _xon_threshold, _xoff_threshold);
Expand Down
18 changes: 9 additions & 9 deletions FluidNC/src/Uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Uart : public Stream, public Configuration::Configurable {
int _xon_threshold = 0;
int _xoff_threshold = 0;

std::string bootloader_mode = "";
std::string passthrough_mode = "";
std::string _name;

public:
Expand All @@ -42,10 +42,10 @@ class Uart : public Stream, public Configuration::Configurable {
UartParity _parity = UartParity::None;
UartStop _stopBits = UartStop::Bits1;

int _bootloader_baud = 0;
UartData _bootloader_databits = UartData::Bits8;
UartParity _bootloader_parity = UartParity::Even;
UartStop _bootloader_stopbits = UartStop::Bits1;
int _passthrough_baud = 0;
UartData _passthrough_databits = UartData::Bits8;
UartParity _passthrough_parity = UartParity::Even;
UartStop _passthrough_stopbits = UartStop::Bits1;

Pin _txd_pin;
Pin _rxd_pin;
Expand Down Expand Up @@ -89,8 +89,8 @@ class Uart : public Stream, public Configuration::Configurable {
void changeMode(unsigned long baud, UartData dataBits, UartParity parity, UartStop stopBits);
void restoreMode();

void enterBootloader();
void exitBootloader();
void enterPassthrough();
void exitPassthrough();

// Configuration handlers:
void validate() override {
Expand All @@ -109,8 +109,8 @@ class Uart : public Stream, public Configuration::Configurable {

handler.item("baud", _baud, 2400, 10000000);
handler.item("mode", _dataBits, _parity, _stopBits);
handler.item("bootloader_baud", _bootloader_baud, 0, 10000000); // 0 means not configured
handler.item("bootloader_mode", _bootloader_databits, _bootloader_parity, _bootloader_stopbits);
handler.item("passthrough_baud", _passthrough_baud, 0, 10000000); // 0 means not configured
handler.item("passthrough_mode", _passthrough_databits, _passthrough_parity, _passthrough_stopbits);
}

void config_message(const char* prefix, const char* usage);
Expand Down

0 comments on commit 3207f5f

Please sign in to comment.