Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/stale-issue-bot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ jobs:
if: github.repository == 'Klipper3d/klipper'
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v4
- uses: dessant/lock-threads@v6
with:
issue-inactive-days: '180'
issue-lock-reason: ''
Expand Down
3 changes: 2 additions & 1 deletion docs/Load_Cell.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,12 @@ Set up z_thermal_adjust to reference the `extruder` as the source of temperature
data. E.g.:

```
[z_thermal_adjust nozzle]
[z_thermal_adjust]
temp_coeff=-0.00045455
sensor_type: temperature_combined
sensor_list: extruder
combination_method: max
maximum_deviation: 999
min_temp: 0
max_temp: 400
max_z_adjustment: 0.1
Expand Down
22 changes: 21 additions & 1 deletion docs/SDCard_Updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ All options can be viewed by the help screen:
./scripts/flash-sdcard.sh -h
SD Card upload utility for Klipper

usage: flash_sdcard.sh [-h] [-l] [-c] [-b <baud>] [-f <firmware>]
usage: flash_sdcard.sh [-h] [-l] [-c] [-s] [-b <baud>] [-f <firmware>]
<device> <board>

positional arguments:
Expand All @@ -59,6 +59,7 @@ optional arguments:
-h show this message
-l list available boards
-c run flash check/verify only (skip upload)
-s use fast SPI speed (4MHz)
-b <baud> serial baud rate (default is 250000)
-f <firmware> path to klipper.bin
```
Expand Down Expand Up @@ -87,6 +88,25 @@ use SDIO mode instead of SPI to access their SD Cards. (See Caveats below)
But, it can also be used anytime to verify if the code flashed into the board
matches the version in your build folder on any supported board.

## Failure to Initialize

Some SD cards may fail to initialize at the default SPI speed of 400KHz. In
this situation it is possible to use `-s` to drive the SPI peripheral at 4MHz.
For example:

```
./scripts/flash-sdcard.sh -s /dev/ttyACM0 btt-skr-v1.3
```

If the device still fails to initialize then cause of the failure is
unrelated to the speed and likely a result of one of the following
conditions:

- The SD card is improperly formatted. Must be `fat` or `fat32`.
- Attempt to initialize a card using the SPI interface that has already
been initialized over SDIO.
- The SD card has failed or is corrupt.

## Caveats

- As mentioned in the introduction, this method only works for upgrading
Expand Down
27 changes: 17 additions & 10 deletions docs/Status_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,22 +316,29 @@ The following information is available for each `[led led_name]`,
## load_cell

The following information is available for each `[load_cell name]`:
- 'is_calibrated': True/False is the load cell calibrated
- 'counts_per_gram': The number of raw sensor counts that equals 1 gram of force
- 'reference_tare_counts': The reference number of raw sensor counts for 0 force
- 'tare_counts': The current number of raw sensor counts for 0 force
- 'force_g': The force in grams, averaged over the last polling period.
- 'min_force_g': The minimum force in grams, over the last polling period.
- 'max_force_g': The maximum force in grams, over the last polling period.
- `is_calibrated`: True/False whether the load cell is calibrated.
- `counts_per_gram`: The number of raw sensor counts that equals 1 gram of force.
- `reference_tare_counts`: The reference number of raw sensor counts for 0 force.
- `tare_counts`: The current number of raw sensor counts for 0 force.
- `force_g`: The force in grams, averaged over the last polling period.
- `min_force_g`: The minimum force in grams, over the last polling period.
- `max_force_g`: The maximum force in grams, over the last polling period.
- `errors`: The number of sensor errors detected since the last start
of measurements.
- `overflows`: The number of data buffer overflows detected since the last
start of measurements.
- `sample_rate`: The sensor's sample rate in samples per second.

## load_cell_probe

The following information is available for `[load_cell_probe]`:
- all items from [load_cell](Status_Reference.md#load_cell)
- all items from [probe](Status_Reference.md#probe)
- 'endstop_tare_counts': the load cell probe keeps a tare value independent of
the load cell. This re-set at the start of each probe.
- 'last_trigger_time': timestamp of the last homing trigger
- `endstop_tare_counts`: The load cell probe keeps a tare value independent of
the load cell. This is re-set at the start of each probe.
- `last_trigger_time`: Timestamp of the last homing trigger.
- `last_z_result`: The Z position result of the last tap.
- `is_last_tap_valid`: True if the last tap result is valid.

## manual_probe

Expand Down
7 changes: 7 additions & 0 deletions klippy/extras/ads1220.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ def get_mcu(self):
def get_samples_per_second(self):
return self.sps

def get_status(self, eventtime):
return {
'errors': self.last_error_count,
'overflows': self.ffreader.get_last_overflows(),
'sample_rate': self.get_samples_per_second(),
}

def lookup_sensor_error(self, error_code):
return "Unknown ads1220 error" % (error_code,)

Expand Down
7 changes: 7 additions & 0 deletions klippy/extras/ads131m0x.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ def get_mcu(self):
def get_samples_per_second(self):
return self.sps

def get_status(self, eventtime):
return {
'errors': self.last_error_count,
'overflows': self.ffreader.get_last_overflows(),
'sample_rate': self.get_samples_per_second(),
}

def lookup_sensor_error(self, error_code):
return self._sensor_errors.get(error_code,
"Unknown %s error" % (self.sensor_type,))
Expand Down
7 changes: 7 additions & 0 deletions klippy/extras/hx71x.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ def get_mcu(self):
def get_samples_per_second(self):
return self.sps

def get_status(self, eventtime):
return {
'errors': self.last_error_count,
'overflows': self.ffreader.get_last_overflows(),
'sample_rate': self.get_samples_per_second(),
}

def lookup_sensor_error(self, error_code):
return "Unknown hx71x error %d" % (error_code,)

Expand Down
23 changes: 16 additions & 7 deletions klippy/extras/load_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,14 @@ def __init__(self, printer, load_cell):
self._samples = []
self._errors = 0
self._overflows = 0
self._start_errors = 0
self._start_overflows = 0

def _on_samples(self, msg):
if not self.is_started:
return False # already stopped, ignore
self._errors += msg['errors']
self._overflows += msg['overflows']
self._errors = msg['errors']
self._overflows = msg['overflows']
samples = msg['data']
for sample in samples:
time = sample[0]
Expand All @@ -310,9 +312,9 @@ def _finish_collecting(self):
self.min_count = float("inf") # In Python 3.5 math.inf is better
samples = self._samples
self._samples = []
errors = self._errors
errors = max(0, self._errors - self._start_errors)
self._errors = 0
overflows = self._overflows
overflows = max(0, self._overflows - self._start_overflows)
self._overflows = 0
if self._mcu.is_fileoutput():
samples = [(0., 0., 0.)]
Expand All @@ -323,10 +325,12 @@ def _collect_until(self, timeout):
while self.is_started:
now = self._reactor.monotonic()
if self._mcu.estimated_print_time(now) > timeout:
_, (errors, overflows) = self._finish_collecting()
samples, err = self._finish_collecting()
errors, overflows = err if err else (0, 0)
raise self._printer.command_error(
"LoadCellSampleCollector timed out! Errors: %i,"
" Overflows: %i" % (errors, overflows))
"LoadCellSampleCollector timed out! Collected %i samples,"
" Errors: %i, Overflows: %i" % (len(samples), errors,
overflows))
if self._mcu.is_fileoutput():
break
self._reactor.pause(now + RETRY_DELAY)
Expand All @@ -338,6 +342,10 @@ def start_collecting(self, min_time=None):
return
self.min_time = min_time if min_time is not None else self.min_time
self.is_started = True
sensor_status = self._load_cell.sensor.get_status(
self._reactor.monotonic())
self._start_errors = sensor_status['errors']
self._start_overflows = sensor_status['overflows']
self._load_cell.add_client(self._on_samples)

# stop collecting immediately and return results
Expand Down Expand Up @@ -517,6 +525,7 @@ def get_status(self, eventtime):
'counts_per_gram': self.counts_per_gram,
'reference_tare_counts': self.reference_tare_counts,
'tare_counts': self.tare_counts})
status.update(self.sensor.get_status(eventtime))
return status


Expand Down
Loading