Skip to content

Commit

Permalink
Merge branch 'main' into python_package
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerlz authored Dec 11, 2024
2 parents 2cb5c81 + b9a62e1 commit ba44407
Show file tree
Hide file tree
Showing 13 changed files with 160 additions and 81 deletions.
4 changes: 2 additions & 2 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ko_fi: koconnor
custom: https://www.klipper3d.org/Sponsors.html#klipper-developers
ko_fi: kalicocrew
custom: https://docs.kalico.gg/Sponsors.html#the-crew
9 changes: 8 additions & 1 deletion docs/Config_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,13 @@ extended [G-Code command](G-Codes.md#z_tilt) becomes available.

#### [z_tilt_ng]

z_tilt's next generation, adding the Z_TILT_CALIBRATE and Z_TILT_AUTODETECT
extended [G-Code commands](G-Codes.md#z_tilt_ng). Z_TILT_CALIBRATE performs multiple
probing runs to calculate z_offsets, enabling accurate tilt adjustment with fewer
probe points. Z_TILT_AUTODETECT automatically determines pivot positions for each
Z stepper through iterative probing. When this section is present, these extended
commands become available, enhancing bed leveling accuracy and calibration efficiency.

```
[z_tilt_ng]
#z_positions:
Expand Down Expand Up @@ -5714,7 +5721,7 @@ Trad Rack multimaterial system support. See the following documents from the
TradRack repo for additional information:
- [Tuning.md](https://github.com/Annex-Engineering/TradRack/blob/main/docs/Tuning.md):
document referenced by some of the config options below.
- [Trad Rack config reference document](https://github.com/Annex-Engineering/TradRack/blob/main/docs/klipper/Config_Reference.md): contains info on additional config
- [Trad Rack config reference document](https://github.com/Annex-Engineering/TradRack/blob/main/docs/kalico/Config_Reference.md): contains info on additional config
sections that are expected to be used alongside [trad_rack].

```
Expand Down
24 changes: 17 additions & 7 deletions docs/G-Codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ from executing.
### [delta_calibrate]

The following commands are available when the
[delta_calibrate] config section is enabled (also see the
[delta_calibrate] config section is enabled (also see the
[delta calibrate guide](Delta_Calibrate.md)).

#### DELTA_CALIBRATE
Expand Down Expand Up @@ -1618,7 +1618,7 @@ specified and it is higher than the extruder's current temperature,
then the extruder will be heated to at least `MIN_TEMP` before
unloading/loading; the current extruder temperature target may be used
instead if it is higher than `MIN_TEMP`, and if not then
[tr_last_heater_target](https://github.com/Annex-Engineering/TradRack/blob/main/docs/klipper/Save_Variables.md)
[tr_last_heater_target](https://github.com/Annex-Engineering/TradRack/blob/main/docs/kalico/Save_Variables.md)
may be used. If `EXACT_TEMP` is specified, the extruder will be heated
to `EXACT_TEMP` before unloading/loading, regardless of any other
temperature setting. If any of the optional length parameters are
Expand All @@ -1643,7 +1643,7 @@ the extruder's current temperature, then the extruder will be heated
to at least `MIN_TEMP` before unloading; the current extruder
temperature target may be used instead if it is higher than
`MIN_TEMP`, and if not then
[tr_last_heater_target](https://github.com/Annex-Engineering/TradRack/blob/main/docs/klipper/Save_Variables.md)
[tr_last_heater_target](https://github.com/Annex-Engineering/TradRack/blob/main/docs/kalico/Save_Variables.md)
may be used. If `EXACT_TEMP` is specified, the extruder will be heated
to `EXACT_TEMP` before unloading/loading, regardless of any other
temperature setting.
Expand Down Expand Up @@ -1738,15 +1738,15 @@ hotend_load_length will be set to the value passed in. If the ADJUST
parameter is used, the adjustment will be added to the current value
of hotend_load_length.

### TR_DISCARD_BOWDEN_LENGTHS
#### TR_DISCARD_BOWDEN_LENGTHS
`TR_DISCARD_BOWDEN_LENGTHS [MODE=[ALL|LOAD|UNLOAD]]`: Discards saved
values for "bowden_load_length" and/or "bowden_unload_length" (see
[bowden lengths](https://github.com/Annex-Engineering/TradRack/blob/main/docs/Tuning.md#bowden-lengths)
for details on how these settings are used). These settings will each
be reset to the value of `bowden_length` from the
[trad_rack config section](Config_Reference.md#trad_rack), and empty
dictionaries will be saved for
[tr_calib_bowden_load_length and tr_calib_bowden_unload_length](https://github.com/Annex-Engineering/TradRack/blob/main/docs/klipper/Save_Variables.md).
[tr_calib_bowden_load_length and tr_calib_bowden_unload_length](https://github.com/Annex-Engineering/TradRack/blob/main/docs/kalico/Save_Variables.md).
"bowden_load_length" and tr_calib_bowden_load_length will be
affected if MODE=LOAD is specified, "bowden_unload_length" and
tr_calib_bowden_unload_length will be affected if MODE=UNLOAD is
Expand Down Expand Up @@ -1876,6 +1876,18 @@ and detach a mag-probe for these commands!
The following commands are available when the
[z_tilt config section](Config_Reference.md#z_tilt) is enabled.

#### Z_TILT_ADJUST
`Z_TILT_ADJUST [HORIZONTAL_MOVE_Z=<value>] [<probe_parameter>=<value>]`: This
command will probe the points specified in the config and then make independent
adjustments to each Z stepper to compensate for tilt. See the PROBE command for
details on the optional probe parameters. The optional `HORIZONTAL_MOVE_Z`
value overrides the `horizontal_move_z` option specified in the config file.

### [z_tilt_ng]

The following commands are available when the
[z_tilt_ng config section](Config_Reference.md#z_tilt_ng) is enabled.

#### Z_TILT_ADJUST
`Z_TILT_ADJUST [HORIZONTAL_MOVE_Z=<value>] [<probe_parameter>=<value>]
[INCREASING_THRESHOLD=<value>]`: This
Expand All @@ -1900,5 +1912,3 @@ configured in the z_tilt_ng section:
small misalgnments of the steppers. The amount of misalignment can be
configured with the DELTA paramter. It iterates until the calculated
positions cannot be improved any further. This is can be lengthy procedure.
IMPORTANT: For the Z_TILT_CALIBRATE and Z_TILT_AUTODETECT commands to work
the numpy package has to be installed via ~/klippy-env/bin/pip install -v numpy.
52 changes: 31 additions & 21 deletions docs/Sponsors.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,38 @@
# Sponsors

Kalico is Free Software. We depend on the generous support from
sponsors. Please consider sponsoring Kalico or supporting our
sponsors.
Kalico is a community-driven, open-source project that is free to use (as in "free beer").
While we don't have official sponsors yet, we are deeply grateful for the generous support
from our community. Every contribution helps us continue improving Kalico for everyone.

## Kalico Developers
If you'd like to support Kalico, donations to our Ko-Fi are more than welcome:
👉 [https://ko-fi.com/kalicocrew](https://ko-fi.com/kalicocrew)

### Rogerio Goncalves (@rogerlz)
## The People behind Kalico

Rogerio initiated the Kalico project, forking the awesome Klipper firmware originally as "Danger-Klipper" to add some bleeding edge spice to it.
### The Crew

Contact: [[email protected]](mailto:[email protected])
| Name | Alias | GitHub |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ------------------------------------------ |
| **Bea Nance**<br>Bea initiated the Kalico project together with Maël, forking the awesome Klipper firmware originally as "Danger-Klipper" to add some bleeding edge spice to it. <br> _"So I saw people wanted some community-driven features in klipper, so i was like "ehh, i'll just fork it and give it a go"_ | bwnance | [@bwnance](https://github.com/bwnance) |
| **Maël Kerbiriou**<br>Maël together with Bea brought Kalico to life. | piezoid | [@Piezoid](https://github.com/Piezoid) |
| **Rogerio Goncalves**<br>Roger chimed in early into the development of Kalico, and has since been a crucial contributor to the project. | rogerlz | [@rogerlz](https://github.com/rogerlz) |
| **Frank Tackitt**<br>Frank started his klipper hacking with exclude_object and just forgot to stop there | frank.af | [@kageurufu](https://github.com/kageurufu) |

### Lasse Dalegaard (@dalegaard)
### Contributors

| Name | Alias | GitHub |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------- | ---------------------------------------------------- |
| **Vinzenz Hassert**<br>_"Uhh dunno... I mean I did pid profiles, filament sensors and curve control mainly. And I am best at giving Roger grey hairs cause I do huge pull requests!"_ | LastZeanon | [@LastZeanon](https://github.com/LastZeanon) |
| **Yancey Arrington**<br>Yancey wrote the docs for all the bleeding edge features and model predictive control, otherwise you wouldn't know about all the fancy stuff Kalico brings to the table! He also helps other community members a lot with their questions. What a great guy! | Ray_Boy | [@YanceyA](https://github.com/YanceyA) |
| **Ryan Ghosh**<br>All Ryan cares about are the TradRack and Belay modules of Kalico. How selfish! (no, in fact, that is very generous. Thanks Ryan!) | RyanG | [@rsghosh](https://github.com/rsghosh) |
| **Lasse Dalegaard**<br>Our secret consultant for roasting everything. He also contributed a lot more than he is willing to admit. Silly Lasse. | dalegaard | [@dalegaard](https://github.com/dalegaard) |
| **Philipp Molitor**<br>Phil started hacking around with the docs because he does web stuff and 3D printers, and liked the Kalico Crew so much he just... stuck around.<br>_"Hehehe... I wrote this page!"_ | philm0 | [@PhilippMolitor](https://github.com/PhilippMolitor) |

## Other Kalico Contributors

Contact: [[email protected]](mailto:[email protected])

### Bea Nance (@bwnance)



Contact: [[email protected]](mailto:[email protected])
Kalico is a community effort, and we have a lot more people helping us!
For a full list of people, have a look at the members of
the [GitHub Organization](https://github.com/orgs/KalicoCrew/people) and our [Contributors](https://github.com/KalicoCrew/kalico/graphs/contributors).

## Original Klipper Developers

Expand All @@ -37,16 +47,16 @@ at: [https://ko-fi.com/koconnor](https://ko-fi.com/koconnor) or
### Eric Callahan

Eric is the author of bed_mesh, spi_flash, and several other Klipper
modules. Eric has a donations page at:
modules. Eric has a donations page at:
[https://ko-fi.com/arksine](https://ko-fi.com/arksine)

## Related Kalico Projects

Kalico is frequently used with other Free Software. Consider using or
supporting these projects.

* [Moonraker](https://github.com/Arksine/moonraker)
* [Mainsail](https://github.com/mainsail-crew/mainsail)
* [Fluidd](https://github.com/fluidd-core/fluidd)
* [OctoPrint](https://octoprint.org/)
* [KlipperScreen](https://github.com/jordanruthe/KlipperScreen)
- [Moonraker](https://github.com/Arksine/moonraker)
- [Mainsail](https://github.com/mainsail-crew/mainsail)
- [Fluidd](https://github.com/fluidd-core/fluidd)
- [OctoPrint](https://octoprint.org/)
- [KlipperScreen](https://github.com/jordanruthe/KlipperScreen)
2 changes: 1 addition & 1 deletion docs/Status_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ on a cartesian, hybrid_corexy or hybrid_corexz robot
## tools_calibrate

The following information is available in the
[tools_calibrate](Config_Reference.md#️-tools_calibrate) object:
[tools_calibrate](Config_Reference.md#tools_calibrate) object:
- `sensor_location`: Once calibrated, the location of the sensor
- `last_result`: The last tool calibration result
- `calibration_probe_inactive`: Status of the calibration probe as of
Expand Down
4 changes: 2 additions & 2 deletions docs/Z_Calibration.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ But, there are some requirements to use it:
Temperature or humindity changes are not a big deal since the switch is not
affected much by them and all values are probed in a small time period and only
the releations to each other are used. The nozzle height in step 2 can be
determined some time later and even many celsius higher in the printer's
determined some time later and even many Celsius higher in the printer's
chamber, compared to the homing in step 1. That is why the nozzle is probed
again and can vary a little to the first homing position.

Expand Down Expand Up @@ -286,4 +286,4 @@ at 250, you can preheat the nozzle to 180, and run this script before finishing
temperature. This may have varying effects depending on temperatures used.

Also consider picking up your probe prior to your nozzle wipe, to allow this script to probe the
nozzle immediately after cleaning it.
nozzle immediately after cleaning it.
7 changes: 5 additions & 2 deletions klippy/configfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
# Copyright (C) 2016-2021 Kevin O'Connor <[email protected]>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import sys, os, glob, re, time, logging, configparser, io
import sys, os, glob, re, time, logging, configparser, io, mathutil
from .extras.danger_options import get_danger_options


error = configparser.Error


Expand Down Expand Up @@ -49,6 +50,8 @@ def _get_wrapper(
"Option '%s' in section '%s' must be specified"
% (option, self.section)
)
if parser is float:
parser = mathutil.safe_float
try:
v = parser(self.section, option)
except self.error as e:
Expand Down Expand Up @@ -209,7 +212,7 @@ def getfloatlist(
default,
seps=(sep,),
count=count,
parser=float,
parser=mathutil.safe_float,
note_valid=note_valid,
)

Expand Down
2 changes: 1 addition & 1 deletion klippy/extras/control_mpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def process(eventtime):
ret = temp > target
if ret and not reported[0]:
gcmd.respond_info(
f"Waiting for heater to drop below {target} degrees celcius"
f"Waiting for heater to drop below {target} degrees Celsius"
)
reported[0] = True
return ret
Expand Down
50 changes: 37 additions & 13 deletions klippy/extras/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import pathlib
import platform
import sys
import shlex
import threading
import urllib.request
import uuid
Expand Down Expand Up @@ -129,9 +130,7 @@ def cmd_TELEMETRY_EXAMPLE(self, gcmd):
with filename.open("w", encoding="utf-8") as fp:
json.dump(data, fp, indent=2)

gcmd.respond_info(
f"Example telemetry saved to {filename.relative_to(pathlib.Path.home())}"
)
gcmd.respond_info(f"Example telemetry saved to {filename}")

def _get_machine_id(self):
"""
Expand Down Expand Up @@ -198,26 +197,51 @@ def _collect_platform(self):
{
"machine": "x86_64",
"os_release": {
"NAME": "Debian GNU/Linux",
"ID": "debian",
"PRETTY_NAME": "Debian GNU/Linux trixie/sid",
"VERSION_CODENAME": "trixie",
"HOME_URL": "https://www.debian.org/",
"SUPPORT_URL": "https://www.debian.org/support",
"BUG_REPORT_URL": "https://bugs.debian.org/"
},
"os_release": { ... },
"version": "#1 SMP PREEMPT_DYNAMIC Debian 6.12~rc6-1~exp1 (2024-11-10)",
"python": "3.12.7 (main, Nov 8 2024, 17:55:36) [GCC 14.2.0]"
}
"""
return {
"machine": platform.machine(),
"os_release": platform.freedesktop_os_release(),
"os_release": self._collect_os_release(),
"version": platform.version(),
"python": sys.version,
}

def _collect_os_release(self):
"""
Collect the freedesktop OS-RELEASE information.
See also `platform.freedesktop_os_release()` (available in Python 3.10+)
{
"NAME": "Debian GNU/Linux",
"ID": "debian",
"PRETTY_NAME": "Debian GNU/Linux trixie/sid",
"VERSION_CODENAME": "trixie",
"HOME_URL": "https://www.debian.org/",
"SUPPORT_URL": "https://www.debian.org/support",
"BUG_REPORT_URL": "https://bugs.debian.org/"
}
"""
paths = [
pathlib.Path("/etc/os-release"),
pathlib.Path("/usr/lib/os-release"),
]
path = next(filter(pathlib.Path.exists, paths), None)
if not path:
return

result = {}
with path.open("r") as fp:
for line in fp:
if "=" not in line:
continue
key, value = line.split("=", maxsplit=1)
result[key] = shlex.split(value)[0]

return result

def _collect_printer_objects(self):
"""
Collect a list of all enabled objects in the current Kalico runtime
Expand Down
7 changes: 5 additions & 2 deletions klippy/gcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import os, re, logging, collections, shlex
import mathutil


class CommandError(Exception):
Expand Down Expand Up @@ -73,6 +74,8 @@ def get(
above=None,
below=None,
):
if parser is float:
parser = mathutil.safe_float
value = self._params.get(name)
if value is None:
if default is self.sentinel:
Expand Down Expand Up @@ -123,7 +126,7 @@ def get_float(
return self.get(
name,
default,
parser=float,
parser=mathutil.safe_float,
minval=minval,
maxval=maxval,
above=above,
Expand Down Expand Up @@ -438,7 +441,7 @@ def cmd_M112(self, gcmd):
def cmd_M115(self, gcmd):
# Get Firmware Version and Capabilities
software_version = self.printer.get_start_args().get("software_version")
kw = {"FIRMWARE_NAME": "Klipper", "FIRMWARE_VERSION": software_version}
kw = {"FIRMWARE_NAME": "Kalico", "FIRMWARE_VERSION": software_version}
msg = " ".join(["%s:%s" % (k, v) for k, v in kw.items()])
did_ack = gcmd.ack(msg)
if not did_ack:
Expand Down
7 changes: 7 additions & 0 deletions klippy/mathutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
from . import queuelogger


def safe_float(v: str) -> float:
f = float(v)
if math.isnan(f) or math.isinf(f):
raise ValueError(f"{v} is not a valid float")
return f


######################################################################
# Coordinate descent
######################################################################
Expand Down
Loading

0 comments on commit ba44407

Please sign in to comment.