The first message always has a sync byte with it, so its size should
be one larger. Also, the idle_time should always be the minimum time
that the message could be received, so it should always be reset to
eventtime on a retransmit.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If a nak message causes a retransmission then also accept a second nak
message as long as it is for a sequence greater than the first nak.
This should allow faster retransmits when there are multiple
transmission errors in a small time period.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Track the sequence number of the message last retransmitted (not the
sequence number of the next message to be transmitted). This fixes a
small possibility of a valid nak not being honored.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If a retransmit is triggered by a nak, then it is not necessary to
increase the rto. The next retransmit time should be based on the
expected reception of the first retransmitted message, not the last.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Wait for any pending moves to be fully handled before exiting. Make
sure the wait is done inside the "self.is_processing_data" check to
avoid infinite recursion. Don't keep reading from the file while
waiting to exit.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The existing clock synchronization code has two flaws: intermittent
transmission latency during get_status requests can cause the
estimated clock to be too low, and the estimated clock calculation did
not take into account possible clock drift between samples. The
former could potentially lead to "Timer too close" errors and the
latter could potentially lead to "Move queue empty" errors.
Rework the code to avoid the above problems. It's not necessary to
estimate the micro-controller clock as an excellent estimate is
reported by the micro-controller (via the CLOCK_FREQ constant).
Account for a small drift from the reported value, and check on each
sample if the drift exceeds the expected limits. With a good starting
estimated clock, only the offset needs to be calculated. Use previous
offsets (and the estimated clock) in calculation of new offsets to
avoid intermittent latency from badly skewing the results. Finally,
add an additional time offset of one millisecond to account for any
minor inaccuracies.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Some systems point python to python3 instead of python2 - explicitly
request python2 to avoid conflicts.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Make sure the heater.target_temp is set during the auto-tune test so
that the heater.set_pwm() command will allow the heater to be turned
on.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The endstop_position is intended to support different values for each
stepper so that the individual tower heights can be configured.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit d0932009 introduced an error that could cause lost input in
cases where the sender did not wait for an "ok" message before sending
the next command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't modify dictionaries while iterating them and be careful to use
// when doing an integer divide.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Create add_printer_objects() functions in the fan, heater, extruder,
and toolhead modules. Create the necessary printer component objects
from this call instead of placing the code directly in klippy.py.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The atmega328 is basically the same as the atmega168 - it just adds
some additional memory. Allow the chip to be selected during the
build.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Instead of assuming the maximum PWM value is 255, export a constant
from the firmware to the host with the maximum value.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
On a retract move (which are common during "wipe" operations), treat
the move as if it were an extrude only move. It's valid for a retract
move to reverse more filament then it would be practical to push.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
When the log file does a rollover, start the top of the log with
critical system information (eg, software versions).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
The set_printer_ready() can be called from a background thread on a
shutdown event, so don't try to lookup the printer components in that
case. Simplify build_handlers() so that it no longer tests for
components being available - test for component availability in the
command handlers.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Always call the regular .parse() method for each message type during
dump() - add a new .format_params() method for dumping a verbose
representation of the parsed message. This allows the new
format_params() to also be used with data already parsed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
No need to recommend users disable "SD card support" in octoprint -
instead, just ignore the M21 command.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>