Skip to content

Commit

Permalink
serial_bridge: Add serial bridge module
Browse files Browse the repository at this point in the history
Add functionality that allows communicating and configuring
uart ports on the target MCU. Currently supports the STM32
architecture.

Signed-off-by: Jeremy Putnam <[email protected]>
  • Loading branch information
E4ST2W3ST committed Jan 1, 2024
1 parent 77619e9 commit b83f303
Show file tree
Hide file tree
Showing 13 changed files with 1,935 additions and 0 deletions.
20 changes: 20 additions & 0 deletions config/printer-elegoo-neptune3-pro-2023.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@
# To use this config, during "make menuconfig" select the STM32F401 with a
# "32KiB bootloader" and serial (on USART1 PA10/PA9) communication.

# For screen support, enable "Enable extra low-level configuration options"
# and select "Enable serial bridge" and then "USART6" then uncommit the [neptune_screen]
# and serial_bridge sections


# Note that the "make flash" command does not work with ZNP Robin boards.
# After running "make", rename the out/klipper.bin file to out/ZNP_ROBIN_NANO.bin
# Copy the file out/ZNP_ROBIN_NANO.bin to an SD card formatted to FAT32
# and then restart the printer with the SD card inserted.


# See docs/Config_Reference.md for a description of parameters.

# Core
Expand All @@ -22,6 +28,20 @@ max_accel: 3000
max_z_velocity: 5
max_z_accel: 100

# Screen

#[serial_bridge UART6]
#rx_pin: PA12
#tx_pin: PA11
#baud: 115200
#config: 4
#eol:\xff\xff\xff

#[neptune_screen]
#serial_bridge: UART6
#variant: 3Pro


# Steppers

[stepper_x]
Expand Down
49 changes: 49 additions & 0 deletions docs/Config_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -4301,6 +4301,24 @@ information on menu attributes available during template rendering.
# mode start or end.
```

### [neptune screen]
Support for the Elegoo screen for the Neptune 3/3 Plus/3 Max.
A [serial bridge](#serial_bridge) must be setup for communciation to
take place. Communication is based on versions (1.4.2) and earlier.

```
[neptune_screen]
#serial_bridge:
# Name of the serial_bridge to be used for communication
#variant:
# The device variant to report to the screen. Possible values are
# 3Pro: Neptune 3 Pro
# 3Max: Neptune 3 Max
# 3Plus: Neptune 3 Plus
# The default value is 3Pro
#logging:
# Boolean used to enable/disable verbose logging. Default is False.
```
## Filament sensors

### [filament_switch_sensor]
Expand Down Expand Up @@ -4735,3 +4753,34 @@ via the `i2c_speed` parameter. All other Klipper micro-controllers use a
# to 100000 and changing this value has no effect. The default is
# 100000. Linux, RP2040 and ATmega support 400000.
```

### [serial_bridge]
Communication between the mcu and devices connected to its UART ports
such as third-party screens can be bridged with this module. This feature
must be enabled with the low-level configuration options when compiling the
firmware specifying which ports should be available for the bridge to use.
Currently only STM32 devices are supported.

See the [command reference](G-Codes.md#serial_bridge) for the different
options and configurations available.

```
[serial_bridge bridge_screen]
#eol:
# The character or string of characters to be sent at the end of each
# call. Defaults to \n
#baud
# The baud rate for communication. Default is 115200
#config:
# The serial configuration to use. These define the port and pins.
# List them using the [command reference](G-Codes.md#serial_bridge)
# SERIAL_BRIDGE_LIST_CONFIGS
#tx_pin:
# Pin used for Tx. This is used to reserve the pin and to look up
# the appropriate MCU
#rx_pin
# Pin used for Rx. This is used to reserve the pin and to look up
# the appropriate MCU
#logging
# Boolean to turn logging of or on for debugging communication
```
19 changes: 19 additions & 0 deletions docs/G-Codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,25 @@ loaded into the `printer.save_variables.variables` dict at startup and
can be used in gcode macros. The provided VALUE is parsed as a Python
literal.

### [serial_bridge]
The following command is enabled if a
[serial_bridge config section](Config_Reference.md#serial_bridge)
has been enabled.

#### SERIAL_BRIDGE_SEND
`SERIAL_BRIDGE_SEND [TEXT=<value>] [BRIDGE=<value>]`: This command will
send a serial message (TEXT) to the bridge specificed (BRIDGE).

#### SERIAL_BRIDGE_LIST_CONFIGS
`SERIAL_BRIDGE_LIST_CONFIGS`: This command will list the available
configurations reported by the MCU for use. This config should be used
when setting up a new [serial_bridge](Config_Reference.md#serial_bridge).

#### SERIAL_BRIDGE_LIST_BRIDGES
`SERIAL_BRIDGE_LIST_BRIDGES`: This command will list the available
bridges ready for use from the printer configuration
[serial_bridge](Config_Reference.md#serial_bridge).

### [screws_tilt_adjust]

The following commands are available when the
Expand Down
Loading

0 comments on commit b83f303

Please sign in to comment.