Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update with latest "main" code. #12

Open
wants to merge 43 commits into
base: hc32f460_work
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9b342c6
armcm_link: Rename CONFIG_FLASH_START to CONFIG_FLASH_APPLICATION_ADD…
KevinOConnor Dec 14, 2022
fe0fc29
rp2040: Move watchdog code to new watchdog.c file
KevinOConnor Dec 15, 2022
f6199ef
config: Update generic-bigtreetech-octopus.cfg for f429 and h723 chips
KevinOConnor Dec 13, 2022
9d668d6
stm32: Rework usb_reboot_for_dfu_bootloader() so it works on stm32h723
KevinOConnor Dec 13, 2022
e33b41a
stm32g0: add stm32g0b0 support
leptun Dec 12, 2022
f31540b
stm32: Minor changes to stm32g0b0 ifdefs
KevinOConnor Dec 15, 2022
ac090d9
stm32: Fix stm32l4 build
KevinOConnor Dec 15, 2022
41c7bb8
test: Add compile test builds for stm32g431, stm32h723, stm32l412
KevinOConnor Dec 13, 2022
7d1df81
stm32: Fix USB support on stm32g0b1
KevinOConnor Dec 15, 2022
b0d9cbf
stm32: Fix usb build on stm32g0b0
KevinOConnor Dec 15, 2022
02b45c9
armcm_reset: Flush dcache before rebooting into canboot
KevinOConnor Dec 16, 2022
0c43ae1
stm32: Just clean dcache instead of disabling on stm32h7 dfu reboot
KevinOConnor Dec 16, 2022
3c1ed3b
initial_pins: Add check to reduce compile time size when not in use
KevinOConnor Dec 17, 2022
2a25733
screws_tilt_adjust: Add get_status() method (#5921)
theophile Dec 17, 2022
be74c72
stm32: Separate out USB DFU reboot logic in stm32g4.c
KevinOConnor Dec 15, 2022
b6cd77f
stm32: Separate out USB DFU reboot logic in stm32l4.c
KevinOConnor Dec 15, 2022
4af8786
stm32: Move dfu reboot logic to new dfu_reboot.c file
KevinOConnor Dec 15, 2022
8621ebb
bed_mesh: Allow bedmeshing at 1mm spaced intervals (#5918)
kmobs Dec 19, 2022
f078a27
manual_probe: Add Z_OFFSET_APPLY_ENDSTOP for delta
janherich Nov 25, 2022
aac613b
scripts: support CanBoot on RP2040 in flash_usb.py
clee Dec 19, 2022
9b60daf
tmc: Configurable microstep lookup table (#5920)
leptun Dec 22, 2022
d4bbb83
Merge pull request #1 from SteveGotthardt/hc32f460_work
bsas Dec 23, 2022
56bc3b8
Merge pull request #2 from Klipper3d/master
bsas Dec 23, 2022
4753315
Kconfig: No need to specify "default n" in main Kconfig file
KevinOConnor Dec 19, 2022
4ca1e5f
serial_irq: Rename SERIAL_BOOTLOADER_SIDECHANNEL to HAVE_BOOTLOADER_R…
KevinOConnor Dec 19, 2022
806cf23
stm32: Include "misc.h" in stm32l4.c and stm32g4.c
KevinOConnor Dec 19, 2022
34fd3f4
usb_cdc: Only call bootloader_request() if CONFIG_HAVE_BOOTLOADER_REQ…
KevinOConnor Dec 19, 2022
c620f48
canserial: Only call bootloader_request() if CONFIG_HAVE_BOOTLOADER_R…
KevinOConnor Dec 19, 2022
b51b068
avr: No need to define bootloader_request()
KevinOConnor Dec 19, 2022
1ff0a54
stm32: Check for CONFIG_HAVE_BOOTLOADER_REQUEST in dfu_reboot.c
KevinOConnor Dec 19, 2022
29ba5ab
delta: Better delta build volume constraint check
janherich Nov 30, 2022
f57ff2c
docs: Fix typo in mpu9250 documentation
CODeRUS Dec 29, 2022
6ae6aaf
board_defs: Add Fysetc Cheetah V2 to spi_flash (#5952)
JamesH1978 Dec 31, 2022
40d8c2e
palette2: Fix errors with bad handling of NoneType in a few locations
cmroche Dec 31, 2022
b337cc3
config: Added precise location of [bed_screws] for Ender-3-s1 (#5944)
fire1ce Jan 2, 2023
9c2ccce
stm32: Expand stm32g0 family (#5838)
leptun Jan 3, 2023
448c1a1
stm32: Reindent ifdefs in stm32f0_i2c.c
KevinOConnor Jan 3, 2023
3cd8a72
spi_flash: Add SKR2 F429 chip variant to spi_flash (#5956)
JamesH1978 Jan 4, 2023
cbc17a7
docs: Note v0.11.0 release in Config_Changes.md
KevinOConnor Jan 4, 2023
a564824
serialqueue: Add comment to do_write()
KevinOConnor Jan 5, 2023
4395ae9
serialhdl: Add a get_serialqueue() method
KevinOConnor Jan 5, 2023
01f90e8
console: No need to import pins module
KevinOConnor Jan 7, 2023
9eee141
Merge pull request #3 from Klipper3d/master
bsas Jan 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions config/generic-bigtreetech-octopus.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# This file contains common pin mappings for the BigTreeTech Octopus.
# To use this config, the firmware should be compiled for the
# STM32F446 with a "32KiB bootloader" and a "12MHz crystal" clock reference.
# This file contains common pin mappings for the BigTreeTech Octopus
# and Octopus Pro boards. To use this config, start by identifying the
# micro-controller on the board - it may be an STM32F446, STM32F429,
# or an STM32H723. Select the appropriate micro-controller in "make
# menuconfig" and select "Enable low-level configuration options". For
# STM32F446 boards the firmware should be compiled with a "32KiB
# bootloader" and a "12MHz crystal" clock reference. For STM32F429
# boards use a "32KiB bootloader" and an "8MHz crystal". For STM32H723
# boards use a "128KiB bootloader" and a "25Mhz crystal".

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

Expand Down
6 changes: 6 additions & 0 deletions config/printer-creality-ender3-s1-2021.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,9 @@ runout_gcode: PAUSE

[pause_resume]
recover_velocity: 25

[bed_screws]
screw1: 20, 29
screw2: 195, 29
screw3: 195, 198
screw4: 20, 198
7 changes: 7 additions & 0 deletions docs/Config_Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ All dates in this document are approximate.

## Changes

20230103: It is now possible with the flash-sdcard.sh script to flash
both variants of the Bigtreetech SKR-2, STM32F407 and STM32F429.
This means that the original tag of btt-skr2 now has changed to either
btt-skr-2-f407 or btt-skr-2-f429.

20221128: Klipper v0.11.0 released.

20221122: Previously, with safe_z_home, it was possible that the
z_hop after the g28 homing would go in the negative z direction.
Now, a z_hop is performed after g28 only if it results in a positive
Expand Down
50 changes: 49 additions & 1 deletion docs/Config_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1640,7 +1640,7 @@ cs_pin:

### [mpu9250]

Support for MPU-9250, MPU-9255, MPU-9255, MPU-6050, and MPU-6500
Support for MPU-9250, MPU-9255, MPU-6515, MPU-6050, and MPU-6500
accelerometers (one may define any number of sections with an
"mpu9250" prefix).

Expand Down Expand Up @@ -3073,6 +3073,30 @@ run_current:
# set, "stealthChop" mode will be enabled if the stepper motor
# velocity is below this value. The default is 0, which disables
# "stealthChop" mode.
#driver_MSLUT0: 2863314260
#driver_MSLUT1: 1251300522
#driver_MSLUT2: 608774441
#driver_MSLUT3: 269500962
#driver_MSLUT4: 4227858431
#driver_MSLUT5: 3048961917
#driver_MSLUT6: 1227445590
#driver_MSLUT7: 4211234
#driver_W0: 2
#driver_W1: 1
#driver_W2: 1
#driver_W3: 1
#driver_X1: 128
#driver_X2: 255
#driver_X3: 255
#driver_START_SIN: 0
#driver_START_SIN90: 247
# These fields control the Microstep Table registers directly. The optimal
# wave table is specific to each motor and might vary with current. An
# optimal configuration will have minimal print artifacts caused by
# non-linear stepper movement. The values specified above are the default
# values used by the driver. The value must be specified as a decimal integer
# (hex form is not supported). In order to compute the wave table fields,
# see the tmc2130 "Calculation Sheet" from the Trinamic website.
#driver_IHOLDDELAY: 8
#driver_TPOWERDOWN: 0
#driver_TBL: 1
Expand Down Expand Up @@ -3328,6 +3352,30 @@ run_current:
# set, "stealthChop" mode will be enabled if the stepper motor
# velocity is below this value. The default is 0, which disables
# "stealthChop" mode.
#driver_MSLUT0: 2863314260
#driver_MSLUT1: 1251300522
#driver_MSLUT2: 608774441
#driver_MSLUT3: 269500962
#driver_MSLUT4: 4227858431
#driver_MSLUT5: 3048961917
#driver_MSLUT6: 1227445590
#driver_MSLUT7: 4211234
#driver_W0: 2
#driver_W1: 1
#driver_W2: 1
#driver_W3: 1
#driver_X1: 128
#driver_X2: 255
#driver_X3: 255
#driver_START_SIN: 0
#driver_START_SIN90: 247
# These fields control the Microstep Table registers directly. The optimal
# wave table is specific to each motor and might vary with current. An
# optimal configuration will have minimal print artifacts caused by
# non-linear stepper movement. The values specified above are the default
# values used by the driver. The value must be specified as a decimal integer
# (hex form is not supported). In order to compute the wave table fields,
# see the tmc2130 "Calculation Sheet" from the Trinamic website.
#driver_IHOLDDELAY: 6
#driver_TPOWERDOWN: 10
#driver_TBL: 2
Expand Down
22 changes: 22 additions & 0 deletions docs/Status_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,28 @@ The following information is available in the `query_endstops` object
the QUERY_ENDSTOP command must be run prior to the macro containing
this reference.

## screws_tilt_adjust

The following information is available in the `screws_tilt_adjust`
object:
- `error`: Returns True if the most recent `SCREWS_TILT_CALCULATE`
command included the `MAX_DEVIATION` parameter and any of the probed
screw points exceeded the specified `MAX_DEVIATION`.
- `results`: A list of the probed screw locations. Each entry in
the list will be a dictionary containing the following keys:
- `name`: The name of the screw as specified in the config file.
- `x`: The X coordinate of the screw as specified in the config file.
- `y`: The Y coordinate of the screw as specified in the config file.
- `z`: The measured Z height of the screw location.
- `sign`: A string specifying the direction to turn to screw for the
necessary adjustment. Either "CW" for clockwise or "CCW" for
counterclockwise. The base screw will not have a `sign` key.
- `adjust`: The number of screw turns to adjust the screw, given in
the format "HH:MM," where "HH" is the number of full screw turns
and "MM" is the number of "minutes of a clock face" representing
a partial screw turn. (E.g. "01:15" would mean to turn the screw
one and a quarter revolutions.)

## servo

The following information is available in
Expand Down
1 change: 1 addition & 0 deletions klippy/chelper/serialqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ kick_event(struct serialqueue *sq, double eventtime)
pollreactor_update_timer(sq->pr, SQPT_COMMAND, PR_NOW);
}

// OS write of data to be sent to the mcu
static void
do_write(struct serialqueue *sq, void *buf, int buflen)
{
Expand Down
9 changes: 2 additions & 7 deletions klippy/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import sys, optparse, os, re, logging
import util, reactor, serialhdl, pins, msgproto, clocksync
import util, reactor, serialhdl, msgproto, clocksync

help_txt = """
This is a debugging console for the Klipper micro-controller.
Expand Down Expand Up @@ -43,7 +43,6 @@ def __init__(self, reactor, serialport, baud, canbus_iface, canbus_nodeid):
self.fd = sys.stdin.fileno()
util.set_nonblock(self.fd)
self.mcu_freq = 0
self.pins = pins.PinResolver(validate_aliases=False)
self.data = ""
reactor.register_fd(self.fd, self.process_kbd)
reactor.register_callback(self.connect)
Expand Down Expand Up @@ -223,11 +222,7 @@ def translate(self, line, eventtime):
return None
line = ''.join(evalparts)
self.output("Eval: %s" % (line,))
try:
line = self.pins.update_command(line).strip()
except:
self.output("Unable to map pin: %s" % (line,))
return None
line = line.strip()
if line:
parts = line.split()
if parts[0] in self.local_commands:
Expand Down
2 changes: 1 addition & 1 deletion klippy/extras/bed_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def _generate_points(self, error):
# floor distances down to next hundredth
x_dist = math.floor(x_dist * 100) / 100
y_dist = math.floor(y_dist * 100) / 100
if x_dist <= 1. or y_dist <= 1.:
if x_dist < 1. or y_dist < 1.:
raise error("bed_mesh: min/max points too close together")

if self.radius is not None:
Expand Down
45 changes: 45 additions & 0 deletions klippy/extras/manual_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,25 @@ def __init__(self, config):
self.gcode_move = self.printer.load_object(config, "gcode_move")
self.gcode.register_command('MANUAL_PROBE', self.cmd_MANUAL_PROBE,
desc=self.cmd_MANUAL_PROBE_help)
# Endstop value for cartesian printers with separate Z axis
zconfig = config.getsection('stepper_z')
self.z_position_endstop = zconfig.getfloat('position_endstop', None,
note_valid=False)
# Endstop values for linear delta printers with vertical A,B,C towers
a_tower_config = config.getsection('stepper_a')
self.a_position_endstop = a_tower_config.getfloat('position_endstop',
None,
note_valid=False)
b_tower_config = config.getsection('stepper_b')
self.b_position_endstop = b_tower_config.getfloat('position_endstop',
None,
note_valid=False)
c_tower_config = config.getsection('stepper_c')
self.c_position_endstop = c_tower_config.getfloat('position_endstop',
None,
note_valid=False)
# Conditionally register appropriate commands depending on printer
# Cartestian printers with separate Z Axis
if self.z_position_endstop is not None:
self.gcode.register_command(
'Z_ENDSTOP_CALIBRATE', self.cmd_Z_ENDSTOP_CALIBRATE,
Expand All @@ -24,6 +40,12 @@ def __init__(self, config):
'Z_OFFSET_APPLY_ENDSTOP',
self.cmd_Z_OFFSET_APPLY_ENDSTOP,
desc=self.cmd_Z_OFFSET_APPLY_ENDSTOP_help)
# Linear delta printers with A,B,C towers
if 'delta' == config.getsection('printer').get('kinematics'):
self.gcode.register_command(
'Z_OFFSET_APPLY_ENDSTOP',
self.cmd_Z_OFFSET_APPLY_DELTA_ENDSTOPS,
desc=self.cmd_Z_OFFSET_APPLY_ENDSTOP_help)
self.reset_status()
def manual_probe_finalize(self, kin_pos):
if kin_pos is not None:
Expand Down Expand Up @@ -66,6 +88,29 @@ def cmd_Z_OFFSET_APPLY_ENDSTOP(self,gcmd):
"with the above and restart the printer." % (new_calibrate))
configfile.set('stepper_z', 'position_endstop',
"%.3f" % (new_calibrate,))
def cmd_Z_OFFSET_APPLY_DELTA_ENDSTOPS(self,gcmd):
offset = self.gcode_move.get_status()['homing_origin'].z
configfile = self.printer.lookup_object('configfile')
if offset == 0:
self.gcode.respond_info("Nothing to do: Z Offset is 0")
else:
new_a_calibrate = self.a_position_endstop - offset
new_b_calibrate = self.b_position_endstop - offset
new_c_calibrate = self.c_position_endstop - offset
self.gcode.respond_info(
"stepper_a: position_endstop: %.3f\n"
"stepper_b: position_endstop: %.3f\n"
"stepper_c: position_endstop: %.3f\n"
"The SAVE_CONFIG command will update the printer config file\n"
"with the above and restart the printer." % (new_a_calibrate,
new_b_calibrate,
new_c_calibrate))
configfile.set('stepper_a', 'position_endstop',
"%.3f" % (new_a_calibrate,))
configfile.set('stepper_b', 'position_endstop',
"%.3f" % (new_b_calibrate,))
configfile.set('stepper_c', 'position_endstop',
"%.3f" % (new_c_calibrate,))
cmd_Z_OFFSET_APPLY_ENDSTOP_help = "Adjust the z endstop_position"

# Verify that a manual probe isn't already in progress
Expand Down
11 changes: 6 additions & 5 deletions klippy/extras/palette2.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ def cmd_OmegaDefault(self, gcmd):
def _wait_for_heartbeat(self):
startTs = self.reactor.monotonic()
currTs = startTs
while self.heartbeat is None and self.heartbeat < (
currTs - SETUP_TIMEOUT) and startTs > (
currTs - SETUP_TIMEOUT):
while self.heartbeat is None or (self.heartbeat < (
currTs - SETUP_TIMEOUT) and startTs > (
currTs - SETUP_TIMEOUT)):
currTs = self.reactor.pause(currTs + 1.)

if self.heartbeat < (currTs - SETUP_TIMEOUT):
Expand Down Expand Up @@ -401,7 +401,7 @@ def p2cmd_O50(self, params):
try:
fw = params[0][1:]
logging.info(
"Palette 2 firmware version %s detected" % os.fwalk)
"Palette 2 firmware version %s detected" % fw)
except (TypeError, IndexError):
logging.error("Unable to parse firmware version")

Expand Down Expand Up @@ -583,7 +583,7 @@ def _run_Heartbeat(self, eventtime):
self.write_queue.put(COMMAND_HEARTBEAT)
eventtime = self.reactor.pause(eventtime + 5)
if self.heartbeat and self.heartbeat < (
eventtime - HEARTBEAT_TIMEOUT):
eventtime - HEARTBEAT_TIMEOUT):
logging.error(
"P2 has not responded to heartbeat")
if not self.is_printing or self.is_setup_complete:
Expand Down Expand Up @@ -612,6 +612,7 @@ def _run_Write(self, eventtime):
logging.error("Unable to communicate with the Palette 2")
self.signal_disconnect = True
return self.reactor.NEVER
return eventtime + SERIAL_TIMER
return eventtime + SERIAL_TIMER

def _run_Smart_Load(self, eventtime):
Expand Down
14 changes: 14 additions & 0 deletions klippy/extras/screws_tilt_adjust.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ def __init__(self, config):
self.config = config
self.printer = config.get_printer()
self.screws = []
self.results = []
self.max_diff = None
self.max_diff_error = False
# Read config
for i in range(99):
prefix = "screw%d" % (i + 1,)
Expand Down Expand Up @@ -57,7 +59,13 @@ def cmd_SCREWS_TILT_CALCULATE(self, gcmd):
self.direction = direction
self.probe_helper.start_probe(gcmd)

def get_status(self, eventtime):
return {'error': self.max_diff_error,
'results': self.results}

def probe_finalize(self, offsets, positions):
self.results = []
self.max_diff_error = False
# Factors used for CW-M3, CCW-M3, CW-M4, CCW-M4, CW-M5 and CCW-M5
threads_factor = {0: 0.5, 1: 0.5, 2: 0.7, 3: 0.7, 4: 0.8, 5: 0.8}
is_clockwise_thread = (self.thread & 1) == 0
Expand All @@ -84,6 +92,8 @@ def probe_finalize(self, offsets, positions):
self.gcode.respond_info(
"%s : x=%.1f, y=%.1f, z=%.5f" %
(name + ' (base)', coord[0], coord[1], z))
self.results.append({'name': name + ' (base)', 'x': coord[0],
'y': coord[1], 'z': z, 'sign': 'CW', 'adjust':'00:00'})
else:
# Calculate how knob must be adjusted for other positions
diff = z_base - z
Expand All @@ -104,7 +114,11 @@ def probe_finalize(self, offsets, positions):
self.gcode.respond_info(
"%s : x=%.1f, y=%.1f, z=%.5f : adjust %s %02d:%02d" %
(name, coord[0], coord[1], z, sign, full_turns, minutes))
self.results.append({'name': name, 'x': coord[0], 'y': coord[1],
'z': z, 'sign': sign,
'adjust':"%02d:%02d" % (full_turns, minutes)})
if self.max_diff and any((d > self.max_diff) for d in screw_diff):
self.max_diff_error = True
raise self.gcode.error(
"bed level exceeds configured limits ({}mm)! " \
"Adjust screws and restart print.".format(self.max_diff))
Expand Down
21 changes: 21 additions & 0 deletions klippy/extras/tmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,27 @@ def handle_homing_move_end(self, hmove):
# Config reading helpers
######################################################################

# Helper to initialize the wave table from config or defaults
def TMCWaveTableHelper(config, mcu_tmc):
set_config_field = mcu_tmc.get_fields().set_config_field
set_config_field(config, "mslut0", 0xAAAAB554)
set_config_field(config, "mslut1", 0x4A9554AA)
set_config_field(config, "mslut2", 0x24492929)
set_config_field(config, "mslut3", 0x10104222)
set_config_field(config, "mslut4", 0xFBFFFFFF)
set_config_field(config, "mslut5", 0xB5BB777D)
set_config_field(config, "mslut6", 0x49295556)
set_config_field(config, "mslut7", 0x00404222)
set_config_field(config, "w0", 2)
set_config_field(config, "w1", 1)
set_config_field(config, "w2", 1)
set_config_field(config, "w3", 1)
set_config_field(config, "x1", 128)
set_config_field(config, "x2", 255)
set_config_field(config, "x3", 255)
set_config_field(config, "start_sin", 0)
set_config_field(config, "start_sin90", 247)

# Helper to configure and query the microstep settings
def TMCMicrostepHelper(config, mcu_tmc):
fields = mcu_tmc.get_fields()
Expand Down
Loading