Don't implement history expiration from the main steppersync_flush()
code. Instead, have callers directly invoke
steppersync_history_expire().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allocate the low-level C stepcompress object in the motion_queuing
module. This simplifies the mcu.py code as it no longer needs to
track the stepqueues for the steppersync object.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add an allocate_trapq() helper function to facilitate the creation of
a low-level C trapq object. Track all trapq objects and clear history
on them globally when the main motion queues are flushed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Create a new module to assist with host management of motion queues.
Register all MCU_stepper objects with this module and use the module
for step generation.
All steppers will now automatically generate steps whenever
toolhead._advance_flush_time() is invoked. It is no longer necessary
for callers to individually call stepper.generate_steps().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change note_mcu_movequeue_activity() to default to setting the
step_gen_time (instead of the previous default to not set it).
Most users of the mcu "move queue" will be for stepper activity.
There is also little harm in incrementing the tracking of the last
possible step generation time, but accidentally generating a step
without incrementing the tracking can lead to very hard to debug
failures.
The two cases (output_pin.py and pwm_tool.py) where
note_mcu_movequeue_activity() is called and definitely not related to
step generation can explicitly pass 'is_step_gen=False'.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Move the g-code command handlers to a new class. This reduces the
size of the main Toolhead() class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Python 2.7 does not allow loading the cffi lib
inside the thread, but function calls are allowed
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
The get_temp() code will stop reporting the last temperature of the
heater if there hasn't been any recent temperature updates. However,
on a full mcu communication loss this can cause the verify_heater code
to report a heating error prior to the mcu code reporting the
communication failure. Increase the heater timeout from 5 to 7
seconds to make it more likely the mcu failure is reported first.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
SHT3x would return a read NACK on host retries.
When the MCU receives the I2C CMD, it reads out data.
SHT3x clears the data buffer.
The MCU fails to deliver a response to the host.
The host retries, the device returns NACK,
then the MCU goes into the shutdown state.
Make sure there is at least 0.5s between retries.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Avoid using the name "config" as a local register storage variable as
it can be confused with the common "config" configfile reference.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit d120a313b incorrectly removed an assignment to self.config - in
this instance the reference was to a local variable not related to the
global configfile storage.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Update Code_Overview.md to note that the config object should not be
stored after the "config loading phase".
Remove a few inadvertent cases where a 'config' object was stored
in module member variables.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Validate host provided index prior to accessing memory using that
index.
Also, consistently use a uint8_t for max_sections (to account for
integer overflow issues).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Initial setup of Load Cell Probing. This implementation supports triggering from the Load Cell Probe on the MCU. It also supports, optiopnal, filtering of the force signal by sos filter to eliminate drift caused by bowden tubes or other mechanical causes.
Signed-off-by: Gareth Farrington <gareth@waves.ky>
As probes stop supporting `probe:z_virtual_endstop` this class will give users a polite and specific configuration error.
Signed-off-by: Gareth Farrington <gareth@waves.ky>
This is an implementation of the SOS fliltering algorithm that runs on the MCU.
The filter opperates on data in fixed point format to avoid use of the FPU as klipper does not support FPU usage.
This host object handles duties of initalizing and resetting the filter so client dont have to declare their own commands for these opperations. Clients can select how many integer bits they want to use for both the filter coefficients and the filters output value. An arbitrary number of filter sections can be configured. Filters can be designed on the fly with the SciPy library or loaded from another source.
Signed-off-by: Gareth Farrington <gareth@waves.ky>