Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/GuoGeTiertime/klipper
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoGeTiertime committed Oct 26, 2023
2 parents 29a8fee + 08dcaa8 commit 32f6471
Show file tree
Hide file tree
Showing 14 changed files with 476 additions and 186 deletions.
6 changes: 5 additions & 1 deletion config/printer-creality-ender5-2019.cfg
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# This file contains common pin mappings for the 2019 Creality
# Ender 5. To use this config, the firmware should be compiled for the
# AVR atmega1284p.
# AVR atmega1284p. This also works for the v1.1.5 silent boards.

# Note, a number of Melzi boards are shipped with a bootloader that
# requires the following command to flash the board:
# avrdude -p atmega1284p -c arduino -b 57600 -P /dev/ttyUSB0 -U out/klipper.elf.hex
# For v1.1.5 silent boards, the following command is used:
# avrdude -p atmega1284p -c arduino -P /dev/ttyUSB0 -b 115200 -U flash:w:out/klipper.elf.hex
# If the above command does not work and "make flash" does not work
# then one may need to flash a bootloader to the board - see the
# Klipper docs/Bootloaders.md file for more information.
Expand Down Expand Up @@ -80,6 +82,8 @@ pin: PB4

[mcu]
serial: /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0
# Silent boards tend to have the exact same serial ID, except without USB2.0, using USB instead.
# e.g. /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0

[printer]
kinematics: cartesian
Expand Down
9 changes: 9 additions & 0 deletions docs/Config_Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ All dates in this document are approximate.

## Changes

20230826: If `safe_distance` is set or calculated to be 0 in `[dual_carriage]`,
the carriages proximity checks will be disabled as per documentation. A user
may wish to configure `safe_distance` explicitly to prevent accidental crashes
of the carriages with each other. Additionally, the homing order of the primary
and the dual carriage is changed in some configurations (certain configurations
when both carriages home in the same direction, see
[[dual_carriage] configuration reference](./Config_Reference.md#dual_carriage)
for more details).

20230810: The flash-sdcard.sh script now supports both variants of the
Bigtreetech SKR-3, STM32H743 and STM32H723. For this, the original tag
of btt-skr-3 now has changed to be either btt-skr-3-h743 or btt-skr-3-h723.
Expand Down
8 changes: 8 additions & 0 deletions docs/Config_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2065,6 +2065,14 @@ in this section (CARRIAGE=0 will return activation to the primary carriage).
Dual carriage support is typically combined with extra extruders - the
SET_DUAL_CARRIAGE command is often called at the same time as the
ACTIVATE_EXTRUDER command. Be sure to park the carriages during deactivation.
Note that during G28 homing, typically the primary carriage is homed first
followed by the carriage defined in the `[dual_carriage]` config section.
However, the `[dual_carriage]` carriage will be homed first if both carriages
home in a positive direction and the [dual_carriage] carriage has a
`position_endstop` greater than the primary carriage, or if both carriages home
in a negative direction and the `[dual_carriage]` carriage has a
`position_endstop` less than the primary carriage.

Additionally, one could use "SET_DUAL_CARRIAGE CARRIAGE=1 MODE=COPY" or
"SET_DUAL_CARRIAGE CARRIAGE=1 MODE=MIRROR" commands to activate either copying
or mirroring mode of the dual carriage, in which case it will follow the
Expand Down
2 changes: 1 addition & 1 deletion docs/RPi_microcontroller.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ channels need to be enabled you can use `pwm-2chan`:
# Enable pwmchip sysfs interface
dtoverlay=pwm-2chan,pin=12,func=4,pin2=13,func2=4
```
This example additionaly enables PWM1 and routes it to gpio13.
This example additionally enables PWM1 and routes it to gpio13.

The overlay does not expose the pwm line on sysfs on boot and needs to
be exported by echo'ing the number of the pwm channel to
Expand Down
5 changes: 3 additions & 2 deletions docs/Sponsors.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sponsors.

## BIGTREETECH

[<img src="./img/sponsors/BTT_BTT.png" width="200" />](https://bigtree-tech.com/collections/all-products)
[<img src="./img/sponsors/BTT_BTT.png" width="200" style="margin:25px"/>](https://bigtree-tech.com/collections/all-products)

BIGTREETECH is the official mainboard sponsor of Klipper. BIGTREETECH
is committed to developing innovative and competitive products to
Expand All @@ -16,7 +16,8 @@ serve the 3D printing community better. Follow them on

## Sponsors

[<img src="./img/sponsors/obico-light-horizontal.png" width="200" />](https://obico.io/klipper.html?source=klipper_sponsor)
[<img src="./img/sponsors/obico-light-horizontal.png" width="200" style="margin:25px" />](https://obico.io/klipper.html?source=klipper_sponsor)
[<img src="./img/sponsors/peopoly-logo.png" width="200" style="margin:25px" />](https://peopoly.net)

## Klipper Developers

Expand Down
Binary file added docs/img/sponsors/peopoly-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions klippy/chelper/serialqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ struct serialqueue {
int ready_bytes, upcoming_bytes, need_ack_bytes, last_ack_bytes;
uint64_t need_kick_clock;
struct list_head notify_queue;
double last_write_fail_time;
// Received messages
struct list_head receive_queue;
// Fastreader support
Expand Down Expand Up @@ -376,8 +377,16 @@ do_write(struct serialqueue *sq, void *buf, int buflen)
int ret = write(sq->serial_fd, &cf, sizeof(cf));
if (ret < 0) {
report_errno("can write", ret);
double curtime = get_monotonic();
if (!sq->last_write_fail_time) {
sq->last_write_fail_time = curtime;
} else if (curtime > sq->last_write_fail_time + 10.0) {
errorf("Halting reads due to CAN write errors.");
pollreactor_do_exit(sq->pr);
}
return;
}
sq->last_write_fail_time = 0.0;
buf += size;
buflen -= size;
}
Expand Down
53 changes: 45 additions & 8 deletions klippy/kinematics/idex_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ def toggle_active_dc_rail(self, index, override_rail=False):
kin.update_limits(self.axis, target_dc.get_rail().get_range())
def home(self, homing_state):
kin = self.printer.lookup_object('toolhead').get_kinematics()
for i, dc_rail in enumerate(self.dc):
enumerated_dcs = list(enumerate(self.dc))
if (self.get_dc_order(0, 1) > 0) != \
self.dc[0].get_rail().get_homing_info().positive_dir:
# The second carriage must home first, because the carriages home in
# the same direction and the first carriage homes on the second one
enumerated_dcs.reverse()
for i, dc_rail in enumerated_dcs:
self.toggle_active_dc_rail(i, override_rail=True)
kin.home_axis(homing_state, self.axis, dc_rail.get_rail())
# Restore the original rails ordering
Expand All @@ -78,17 +84,23 @@ def get_kin_range(self, toolhead, mode):
axes_pos = [dc.get_axis_position(pos) for dc in self.dc]
dc0_rail = self.dc[0].get_rail()
dc1_rail = self.dc[1].get_rail()
range_min = dc0_rail.position_min
range_max = dc0_rail.position_max
if mode != PRIMARY or self.dc[0].is_active():
range_min = dc0_rail.position_min
range_max = dc0_rail.position_max
else:
range_min = dc1_rail.position_min
range_max = dc1_rail.position_max
safe_dist = self.safe_dist
if not safe_dist:
return (range_min, range_max)

if mode == COPY:
range_min = max(range_min,
axes_pos[0] - axes_pos[1] + dc1_rail.position_min)
range_max = min(range_max,
axes_pos[0] - axes_pos[1] + dc1_rail.position_max)
elif mode == MIRROR:
if dc0_rail.get_homing_info().positive_dir:
if self.get_dc_order(0, 1) > 0:
range_min = max(range_min,
0.5 * (sum(axes_pos) + safe_dist))
range_max = min(range_max,
Expand All @@ -102,14 +114,39 @@ def get_kin_range(self, toolhead, mode):
# mode == PRIMARY
active_idx = 1 if self.dc[1].is_active() else 0
inactive_idx = 1 - active_idx
if active_idx:
range_min = dc1_rail.position_min
range_max = dc1_rail.position_max
if self.dc[active_idx].get_rail().get_homing_info().positive_dir:
if self.get_dc_order(active_idx, inactive_idx) > 0:
range_min = max(range_min, axes_pos[inactive_idx] + safe_dist)
else:
range_max = min(range_max, axes_pos[inactive_idx] - safe_dist)
if range_min > range_max:
# During multi-MCU homing it is possible that the carriage
# position will end up below position_min or above position_max
# if position_endstop is too close to the rail motion ends due
# to inherent latencies of the data transmission between MCUs.
# This can result in an invalid range_min > range_max range
# in certain modes, which may confuse the kinematics code.
# So, return an empty range instead, which will correctly
# block the carriage motion until a different mode is selected
# which actually permits carriage motion.
return (range_min, range_min)
return (range_min, range_max)
def get_dc_order(self, first, second):
if first == second:
return 0
# Check the relative order of the first and second carriages and
# return -1 if the first carriage position is always smaller
# than the second one and 1 otherwise
first_rail = self.dc[first].get_rail()
second_rail = self.dc[second].get_rail()
first_homing_info = first_rail.get_homing_info()
second_homing_info = second_rail.get_homing_info()
if first_homing_info.positive_dir != second_homing_info.positive_dir:
# Carriages home away from each other
return 1 if first_homing_info.positive_dir else -1
# Carriages home in the same direction
if first_rail.position_endstop > second_rail.position_endstop:
return 1
return -1
def activate_dc_mode(self, index, mode):
toolhead = self.printer.lookup_object('toolhead')
toolhead.flush_step_generation()
Expand Down
2 changes: 1 addition & 1 deletion lib/README
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ used to upload firmware to devices flashed with the CanBoot bootloader.

The can2040 directory contains code from:
https://github.com/KevinOConnor/can2040
revision d1190afcaa6245c20da28199d06e453d2e743099.
version v1.6.0 (af3d21e5d61b8408c63fbdfb0aceb21d69d91693)

The Huada HC32F460 directory contains code from:
https://www.hdsc.com.cn/Category83-1490
Expand Down
Loading

0 comments on commit 32f6471

Please sign in to comment.