mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-06 21:44:13 -06:00
klippy: fix typos in python code (#6989)
Some checks failed
Build test / build (push) Has been cancelled
Some checks failed
Build test / build (push) Has been cancelled
Signed-off-by: Thijs Triemstra <info@collab.nl>
This commit is contained in:
parent
ef4c76fe94
commit
60879fd298
24 changed files with 43 additions and 43 deletions
|
@ -274,7 +274,7 @@ FFI_main = None
|
|||
FFI_lib = None
|
||||
pyhelper_logging_callback = None
|
||||
|
||||
# Hepler invoked from C errorf() code to log errors
|
||||
# Helper invoked from C errorf() code to log errors
|
||||
def logging_callback(msg):
|
||||
logging.error(FFI_main.string(msg))
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ class AngleCalibration:
|
|||
return None
|
||||
return self.mcu_stepper.mcu_to_commanded_position(self.mcu_pos_offset)
|
||||
def load_calibration(self, angles):
|
||||
# Calculate linear intepolation calibration buckets by solving
|
||||
# Calculate linear interpolation calibration buckets by solving
|
||||
# linear equations
|
||||
angle_max = 1 << ANGLE_BITS
|
||||
calibration_count = 1 << CALIBRATION_BITS
|
||||
|
|
|
@ -34,7 +34,7 @@ def constrain(val, min_val, max_val):
|
|||
def lerp(t, v0, v1):
|
||||
return (1. - t) * v0 + t * v1
|
||||
|
||||
# retreive commma separated pair from config
|
||||
# retrieve comma separated pair from config
|
||||
def parse_config_pair(config, option, default, minval=None, maxval=None):
|
||||
pair = config.getintlist(option, (default, default))
|
||||
if len(pair) != 2:
|
||||
|
@ -54,7 +54,7 @@ def parse_config_pair(config, option, default, minval=None, maxval=None):
|
|||
% (option, str(maxval)))
|
||||
return pair
|
||||
|
||||
# retreive commma separated pair from a g-code command
|
||||
# retrieve comma separated pair from a g-code command
|
||||
def parse_gcmd_pair(gcmd, name, minval=None, maxval=None):
|
||||
try:
|
||||
pair = [int(v.strip()) for v in gcmd.get(name).split(',')]
|
||||
|
@ -74,7 +74,7 @@ def parse_gcmd_pair(gcmd, name, minval=None, maxval=None):
|
|||
% (name, maxval))
|
||||
return pair
|
||||
|
||||
# retreive commma separated coordinate from a g-code command
|
||||
# retrieve comma separated coordinate from a g-code command
|
||||
def parse_gcmd_coord(gcmd, name):
|
||||
try:
|
||||
v1, v2 = [float(v.strip()) for v in gcmd.get(name).split(',')]
|
||||
|
@ -914,7 +914,7 @@ class ProbeManager:
|
|||
for i in range(y_cnt):
|
||||
for j in range(x_cnt):
|
||||
if not i % 2:
|
||||
# move in positive directon
|
||||
# move in positive direction
|
||||
pos_x = min_x + j * x_dist
|
||||
else:
|
||||
# move in negative direction
|
||||
|
@ -1164,7 +1164,7 @@ class ProbeManager:
|
|||
|
||||
def _gen_arc(self, origin, radius, start, step, count):
|
||||
end = start + step * count
|
||||
# create a segent for every 3 degress of travel
|
||||
# create a segent for every 3 degrees of travel
|
||||
for angle in range(start, end, step):
|
||||
rad = math.radians(angle % 360)
|
||||
opp = math.sin(rad) * radius
|
||||
|
|
|
@ -12,7 +12,7 @@ def load_config_prefix(config):
|
|||
if not config.has_section('display'):
|
||||
raise config.error(
|
||||
"A primary [display] section must be defined in printer.cfg "
|
||||
"to use auxilary displays")
|
||||
"to use auxiliary displays")
|
||||
name = config.get_name().split()[-1]
|
||||
if name == "display":
|
||||
raise config.error(
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# ftp://ftp.simtel.net/pub/simtelnet/msdos/screen/fntcol16.zip
|
||||
# (c) Joseph Gil
|
||||
#
|
||||
# Indivdual fonts are public domain
|
||||
# Individual fonts are public domain
|
||||
######################################################################
|
||||
|
||||
VGA_FONT = [
|
||||
|
|
|
@ -43,7 +43,7 @@ class FirmwareRetraction:
|
|||
self.unretract_length = (self.retract_length
|
||||
+ self.unretract_extra_length)
|
||||
self.is_retracted = False
|
||||
cmd_GET_RETRACTION_help = ("Report firmware retraction paramters")
|
||||
cmd_GET_RETRACTION_help = ("Report firmware retraction parameters")
|
||||
def cmd_GET_RETRACTION(self, gcmd):
|
||||
gcmd.respond_info("RETRACT_LENGTH=%.5f RETRACT_SPEED=%.5f"
|
||||
" UNRETRACT_EXTRA_LENGTH=%.5f UNRETRACT_SPEED=%.5f"
|
||||
|
|
|
@ -158,7 +158,7 @@ class HTU21D:
|
|||
|
||||
def _sample_htu21d(self, eventtime):
|
||||
try:
|
||||
# Read Temeprature
|
||||
# Read Temperature
|
||||
if self.hold_master_mode:
|
||||
params = self.i2c.i2c_write([HTU21D_COMMANDS['HTU21D_TEMP']])
|
||||
else:
|
||||
|
|
|
@ -53,7 +53,7 @@ class ApiClientHelper(object):
|
|||
wh = self.printer.lookup_object('webhooks')
|
||||
wh.register_mux_endpoint(path, key, value, self._add_webhooks_client)
|
||||
|
||||
# Class for handling commands related ot load cells
|
||||
# Class for handling commands related to load cells
|
||||
class LoadCellCommandHelper:
|
||||
def __init__(self, config, load_cell):
|
||||
self.printer = config.get_printer()
|
||||
|
|
|
@ -235,7 +235,7 @@ class Palette2:
|
|||
"Initialize the print, and check connection with the Palette 2")
|
||||
|
||||
def cmd_O1(self, gcmd):
|
||||
logging.info("Initializing print with Pallete 2")
|
||||
logging.info("Initializing print with Palette 2")
|
||||
if not self._check_P2(gcmd):
|
||||
raise self.printer.command_error(
|
||||
"Cannot initialize print, palette 2 is not connected")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Mechanicaly conforms a moving gantry to the bed with 4 Z steppers
|
||||
# Mechanically conforms a moving gantry to the bed with 4 Z steppers
|
||||
#
|
||||
# Copyright (C) 2018 Maks Zolin <mzolin@vorondesign.com>
|
||||
#
|
||||
|
|
|
@ -295,7 +295,7 @@ class ResonanceTester:
|
|||
return parsed_chips
|
||||
def _get_max_calibration_freq(self):
|
||||
return 1.5 * self.generator.get_max_freq()
|
||||
cmd_TEST_RESONANCES_help = ("Runs the resonance test for a specifed axis")
|
||||
cmd_TEST_RESONANCES_help = ("Runs the resonance test for a specified axis")
|
||||
def cmd_TEST_RESONANCES(self, gcmd):
|
||||
# Parse parameters
|
||||
axis = _parse_axis(gcmd, gcmd.get("AXIS").lower())
|
||||
|
@ -345,7 +345,7 @@ class ResonanceTester:
|
|||
gcmd.respond_info(
|
||||
"Resonances data written to %s file" % (csv_name,))
|
||||
cmd_SHAPER_CALIBRATE_help = (
|
||||
"Simular to TEST_RESONANCES but suggest input shaper config")
|
||||
"Similar to TEST_RESONANCES but suggest input shaper config")
|
||||
def cmd_SHAPER_CALIBRATE(self, gcmd):
|
||||
# Parse parameters
|
||||
axis = gcmd.get("AXIS", None)
|
||||
|
|
|
@ -100,12 +100,12 @@ class SHT3X:
|
|||
self.i2c.i2c_write_wait_ack(
|
||||
SHT3X_CMD['PERIODIC']['2HZ']['HIGH_REP']
|
||||
)
|
||||
# Wait <=15.5ms for first measurment
|
||||
# Wait <=15.5ms for first measurement
|
||||
self.reactor.pause(self.reactor.monotonic() + .0155)
|
||||
|
||||
def _sample_sht3x(self, eventtime):
|
||||
try:
|
||||
# Read measurment
|
||||
# Read measurement
|
||||
retries = 5
|
||||
params = None
|
||||
error = None
|
||||
|
|
|
@ -129,7 +129,7 @@ class SmartEffectorProbe:
|
|||
start_time = toolhead.get_last_move_time()
|
||||
# Write generated bits to the control pin
|
||||
end_time = self.control_pin.write_bits(start_time, bit_stream)
|
||||
# Dwell to make sure no subseqent actions are queued together
|
||||
# Dwell to make sure no subsequent actions are queued together
|
||||
# with the SmartEffector programming
|
||||
toolhead.dwell(end_time - start_time)
|
||||
toolhead.wait_moves()
|
||||
|
|
|
@ -116,7 +116,7 @@ class FixedPointSosFilter:
|
|||
if col != 3: # omit column 3
|
||||
fixed_coeff = to_fixed_32(coeff, self._coeff_int_bits)
|
||||
fixed_section.append(fixed_coeff)
|
||||
elif coeff != 1.0: # double check colum 3 is always 1.0
|
||||
elif coeff != 1.0: # double check column 3 is always 1.0
|
||||
raise ValueError("Coefficient 3 is expected to be 1.0"
|
||||
" but was %f" % (coeff,))
|
||||
sos_fixed.append(fixed_section)
|
||||
|
|
|
@ -408,7 +408,7 @@ class TemperatureProbe:
|
|||
except self.printer.command_error:
|
||||
self._finalize_drift_cal(False, "Error during initial move")
|
||||
raise
|
||||
# Caputure start position and begin initial probe
|
||||
# Capture start position and begin initial probe
|
||||
toolhead = self.printer.lookup_object("toolhead")
|
||||
self.start_pos = toolhead.get_position()[:2]
|
||||
manual_probe.ManualProbeHelper(
|
||||
|
@ -637,7 +637,7 @@ class EddyDriftCompensation:
|
|||
gcode = self.printer.lookup_object("gcode")
|
||||
if len(cal_samples) < 3:
|
||||
raise gcode.error(
|
||||
"calbration error, not enough samples"
|
||||
"calibration error, not enough samples"
|
||||
)
|
||||
min_temp, _ = cal_samples[0][0]
|
||||
max_temp, _ = cal_samples[-1][0]
|
||||
|
@ -687,7 +687,7 @@ class EddyDriftCompensation:
|
|||
return self._calc_freq(freq, origin_temp, self.cal_temp)
|
||||
|
||||
def unadjust_freq(self, freq, dest_temp=None):
|
||||
# Given a frequency and its orignal sampled temp, find the
|
||||
# Given a frequency and its original sampled temp, find the
|
||||
# offset frequency based on the current temp
|
||||
if not self.enabled or freq < self.min_freq:
|
||||
return freq
|
||||
|
@ -703,7 +703,7 @@ class EddyDriftCompensation:
|
|||
low_freq = poly(origin_temp)
|
||||
if freq >= low_freq:
|
||||
if high_freq is None:
|
||||
# Freqency above max calibration value
|
||||
# Frequency above max calibration value
|
||||
err = poly(dest_temp) - low_freq
|
||||
return freq + err
|
||||
t = min(1., max(0., (freq - low_freq) / (high_freq - low_freq)))
|
||||
|
|
|
@ -15,7 +15,7 @@ class Thermistor:
|
|||
self.inline_resistor = inline_resistor
|
||||
self.c1 = self.c2 = self.c3 = 0.
|
||||
def setup_coefficients(self, t1, r1, t2, r2, t3, r3, name=""):
|
||||
# Calculate Steinhart-Hart coefficents from temp measurements.
|
||||
# Calculate Steinhart-Hart coefficients from temp measurements.
|
||||
# Arrange samples as 3 linear equations and solve for c1, c2, and c3.
|
||||
inv_t1 = 1. / (t1 - KELVIN_TO_CELSIUS)
|
||||
inv_t2 = 1. / (t2 - KELVIN_TO_CELSIUS)
|
||||
|
@ -40,7 +40,7 @@ class Thermistor:
|
|||
self.c2 = (inv_t12 - self.c3 * ln3_r12) / ln_r12
|
||||
self.c1 = inv_t1 - self.c2 * ln_r1 - self.c3 * ln3_r1
|
||||
def setup_coefficients_beta(self, t1, r1, beta):
|
||||
# Calculate equivalent Steinhart-Hart coefficents from beta
|
||||
# Calculate equivalent Steinhart-Hart coefficients from beta
|
||||
inv_t1 = 1. / (t1 - KELVIN_TO_CELSIUS)
|
||||
ln_r1 = math.log(r1)
|
||||
self.c3 = 0.
|
||||
|
|
|
@ -86,7 +86,7 @@ class MCU_stepper:
|
|||
if self._step_pulse_duration > MIN_BOTH_EDGE_DURATION:
|
||||
# If user has requested a very large step pulse duration
|
||||
# then disable step on both edges (rise and fall times may
|
||||
# not be symetric)
|
||||
# not be symmetric)
|
||||
want_both_edges = False
|
||||
elif sbe and self._step_pulse_duration>MIN_OPTIMIZED_BOTH_EDGE_DURATION:
|
||||
# Older MCU and user has requested large pulse duration
|
||||
|
|
|
@ -12,7 +12,7 @@ except ImportError:
|
|||
import json
|
||||
|
||||
# Json decodes strings as unicode types in Python 2.x. This doesn't
|
||||
# play well with some parts of Klipper (particuarly displays), so we
|
||||
# play well with some parts of Klipper (particularly displays), so we
|
||||
# need to create an object hook. This solution borrowed from:
|
||||
#
|
||||
# https://stackoverflow.com/questions/956867/
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
"metadata": {},
|
||||
"source": [
|
||||
"## Sensor Information\n",
|
||||
"Fill out the sensor's sample frequency, in samples per second, below. This must match the frquency of the captured data in `probe_data`."
|
||||
"Fill out the sensor's sample frequency, in samples per second, below. This must match the frequency of the captured data in `probe_data`."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -104,7 +104,7 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# set filter settig here. If you dont want a filter to be used, assign `None` to it\n",
|
||||
"# set filter setting here. If you dont want a filter to be used, assign `None` to it\n",
|
||||
"drift_filter_cutoff_frequency = 0.8\n",
|
||||
"buzz_filter_cutoff_frequency = 150.0\n",
|
||||
"notch_filter_frequencies = [50.0, 60.0]\n",
|
||||
|
@ -182,7 +182,7 @@
|
|||
"### Calculate Filter Initial Consitions (zi)\n",
|
||||
"This block automatically calculates the filters starting conditions using `signal.sosfilt_zi`.\n",
|
||||
"\n",
|
||||
"On the MCU, the tare functionality zeros out the grams value so the inital zi matrix doesnt have to be calculated and there will be no filter settling time."
|
||||
"On the MCU, the tare functionality zeros out the grams value so the initial zi matrix doesnt have to be calculated and there will be no filter settling time."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -214,7 +214,7 @@
|
|||
"metadata": {},
|
||||
"source": [
|
||||
"## Display Filter Frequency Response\n",
|
||||
"This block plots the filter's response to sinals from 0 up to the [nyquist frequency]() which is 1/2 the `sensor_frequency`. "
|
||||
"This block plots the filter's response to signals from 0 up to the [nyquist frequency]() which is 1/2 the `sensor_frequency`. "
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -260,7 +260,7 @@
|
|||
"## Test Filter Performance\n",
|
||||
"Test `filter_design` on `probe_data`. This shows plots of the filters performance when filtering the force graph in `probe_data`.\n",
|
||||
"\n",
|
||||
"To help decorate the graphs please prvide the desired trigger threashold of the probe:"
|
||||
"To help decorate the graphs please provide the desired trigger threshold of the probe:"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -339,7 +339,7 @@
|
|||
"metadata": {},
|
||||
"source": [
|
||||
"#### `force` vs force filtered with `filter_design`\n",
|
||||
"In this graph we are looking to see the 'Filtered Force' line remain inside the red lines denoting the trigger force. A Properly filtered force grpah will be horizontal."
|
||||
"In this graph we are looking to see the 'Filtered Force' line remain inside the red lines denoting the trigger force. A Properly filtered force graph will be horizontal."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
# This script launches flash_sdcard.py, a utitlity that enables
|
||||
# This script launches flash_sdcard.py, a utility that enables
|
||||
# unattended firmware updates on boards with "SD Card" bootloaders
|
||||
|
||||
# Non-standard installations may need to change this location
|
||||
|
|
|
@ -20,7 +20,7 @@ SHAPER_DAMPING_RATIO=0.1
|
|||
STEP_SIMULATION_RESONANCE_FREQ=60.
|
||||
STEP_SIMULATION_DAMPING_RATIO=0.15
|
||||
|
||||
# If set, defines which range of frequencies to plot shaper frequency responce
|
||||
# If set, defines which range of frequencies to plot shaper frequency response
|
||||
PLOT_FREQ_RANGE = [] # If empty, will be automatically determined
|
||||
#PLOT_FREQ_RANGE = [10., 100.]
|
||||
|
||||
|
@ -159,7 +159,7 @@ def find_shaper_plot_range(shaper, vib_tol):
|
|||
return (left, right)
|
||||
|
||||
def gen_shaper_response(shaper):
|
||||
# Calculate shaper vibration responce on a range of requencies
|
||||
# Calculate shaper vibration response on a range of frequencies
|
||||
response = []
|
||||
freqs = []
|
||||
freq, freq_end = find_shaper_plot_range(shaper, vib_tol=0.25)
|
||||
|
|
|
@ -234,7 +234,7 @@ class HandleStepQ:
|
|||
step_data.append((step_time, step_halfpos, step_pos))
|
||||
LogHandlers["stepq"] = HandleStepQ
|
||||
|
||||
# Extract tmc currect and stallguard data from the log
|
||||
# Extract tmc current and stallguard data from the log
|
||||
class HandleStallguard:
|
||||
SubscriptionIdParts = 2
|
||||
ParametersMin = 2
|
||||
|
|
|
@ -46,7 +46,7 @@ def calc_crc7(data, with_padding=True):
|
|||
crc ^= b & 0xFF
|
||||
for i in range(8):
|
||||
crc = (crc << 1) ^ poly if crc & 0x80 else crc << 1
|
||||
# The sdcard protocol likes the crc left justfied with a
|
||||
# The sdcard protocol likes the crc left justified with a
|
||||
# padded bit
|
||||
if not with_padding:
|
||||
return crc
|
||||
|
@ -566,7 +566,7 @@ class SDCardSPI:
|
|||
# At this time MMC is not supported
|
||||
if len(resp) == 5:
|
||||
if self.sd_version == 1 and resp[0] == 1:
|
||||
# Check acceptable volatage range for V1 cards
|
||||
# Check acceptable voltage range for V1 cards
|
||||
if resp[2] != 0xFF:
|
||||
raise OSError("flash_sdcard: card does not support"
|
||||
" 3.3v range")
|
||||
|
@ -903,7 +903,7 @@ class SDCardSDIO:
|
|||
" out of IDLE after reset")
|
||||
if len(resp) == 4:
|
||||
if self.sd_version == 1:
|
||||
# Check acceptable volatage range for V1 cards
|
||||
# Check acceptable voltage range for V1 cards
|
||||
if resp[1] != 0xFF:
|
||||
raise OSError("flash_sdcard: card does not support"
|
||||
" 3.3v range")
|
||||
|
@ -1643,7 +1643,7 @@ def main():
|
|||
logging.basicConfig(level=log_level)
|
||||
flash_args = board_defs.lookup_board(args.board)
|
||||
if flash_args is None:
|
||||
output_line("Unable to find defintion for board: %s" % (args.board,))
|
||||
output_line("Unable to find definition for board: %s" % (args.board,))
|
||||
sys.exit(-1)
|
||||
flash_args['device'] = args.device
|
||||
flash_args['baud'] = args.baud
|
||||
|
|
|
@ -76,7 +76,7 @@ def encode_file(input, output_file, file_length):
|
|||
|
||||
xor_crc = 0xef3d4323;
|
||||
|
||||
# the input file is exepcted to be in chunks of 0x800
|
||||
# the input file is expected to be in chunks of 0x800
|
||||
# so round the size
|
||||
while len(input_file) % block_size != 0:
|
||||
input_file.extend(b'0x0')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue