mirror of https://github.com/Desuuuu/klipper.git
mcu: Remove support for DummyMCU class
It's easier to test with the file output mechanism and the DummyMCU code has grown stale. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
6ab269ceb7
commit
7ef8c0442a
|
@ -79,10 +79,6 @@ class Printer:
|
|||
self.build_config()
|
||||
self.stats_timer = self.reactor.register_timer(
|
||||
self.stats, self.reactor.NOW)
|
||||
def connect_debug(self, debugoutput):
|
||||
self.mcu = mcu.DummyMCU(debugoutput)
|
||||
self.mcu.connect()
|
||||
self.build_config()
|
||||
def connect_file(self, output, dictionary):
|
||||
self.mcu = mcu.MCU(self, ConfigWrapper(self, 'mcu'))
|
||||
self.mcu.connect_file(output, dictionary)
|
||||
|
|
|
@ -458,90 +458,3 @@ class MCU:
|
|||
mcu_time = print_time + self._print_start_time
|
||||
clock = int(mcu_time * self._mcu_freq)
|
||||
self.ffi_lib.steppersync_flush(self._steppersync, clock)
|
||||
|
||||
|
||||
######################################################################
|
||||
# MCU Unit testing
|
||||
######################################################################
|
||||
|
||||
class Dummy_MCU_stepper:
|
||||
def __init__(self, mcu, stepid):
|
||||
self._mcu = mcu
|
||||
self._stepid = stepid
|
||||
self._sdir = None
|
||||
def queue_step(self, interval, count, add, clock):
|
||||
dirstr = countstr = addstr = ""
|
||||
if self._sdir is not None:
|
||||
dirstr = "D%d" % (self._sdir+1,)
|
||||
self._sdir = None
|
||||
if count != 1:
|
||||
countstr = "C%d" % (count,)
|
||||
if add:
|
||||
addstr = "A%d" % (add,)
|
||||
self._mcu.outfile.write("G5S%d%s%s%sT%d\n" % (
|
||||
self._stepid, dirstr, countstr, addstr, interval))
|
||||
def set_next_step_dir(self, dir):
|
||||
self._sdir = dir
|
||||
def reset_step_clock(self, clock):
|
||||
self._mcu.outfile.write("G6S%dT%d\n" % (self._stepid, clock))
|
||||
def print_to_mcu_time(self, print_time):
|
||||
return self._mcu.print_to_mcu_time(print_time)
|
||||
|
||||
class Dummy_MCU_obj:
|
||||
def __init__(self, mcu):
|
||||
self._mcu = mcu
|
||||
def home(self, clock, rest_ticks):
|
||||
pass
|
||||
def is_homing(self):
|
||||
return False
|
||||
def home_finalize(self):
|
||||
pass
|
||||
def set_pwm(self, mcu_time, value):
|
||||
pass
|
||||
def set_minmax(self, sample_time, sample_count, minval=None, maxval=None):
|
||||
pass
|
||||
def query_analog_in(self, report_time):
|
||||
pass
|
||||
def set_adc_callback(self, cb):
|
||||
pass
|
||||
def print_to_mcu_time(self, print_time):
|
||||
return self._mcu.print_to_mcu_time(print_time)
|
||||
|
||||
class DummyMCU:
|
||||
def __init__(self, outfile):
|
||||
self.outfile = outfile
|
||||
self._stepid = -1
|
||||
self._print_start_time = 0.
|
||||
self._mcu_freq = 16000000.
|
||||
logging.debug('Translated by klippy')
|
||||
def connect(self):
|
||||
pass
|
||||
def disconnect(self):
|
||||
pass
|
||||
def stats(self, eventtime):
|
||||
return ""
|
||||
def force_shutdown(self):
|
||||
pass
|
||||
def build_config(self):
|
||||
pass
|
||||
def create_stepper(self, step_pin, dir_pin, min_stop_interval, max_error):
|
||||
self._stepid += 1
|
||||
return Dummy_MCU_stepper(self, self._stepid)
|
||||
def create_endstop(self, pin, stepper):
|
||||
return Dummy_MCU_obj(self)
|
||||
def create_digital_out(self, pin, max_duration=2.):
|
||||
return None
|
||||
def create_pwm(self, pin, hard_cycle_ticks, max_duration=2.):
|
||||
return Dummy_MCU_obj(self)
|
||||
def create_adc(self, pin):
|
||||
return Dummy_MCU_obj(self)
|
||||
def set_print_start_time(self, eventtime):
|
||||
pass
|
||||
def get_print_buffer_time(self, eventtime, last_move_end):
|
||||
return 0.250
|
||||
def print_to_mcu_time(self, print_time):
|
||||
return print_time + self._print_start_time
|
||||
def get_mcu_freq(self):
|
||||
return self._mcu_freq
|
||||
def flush_moves(self, print_time):
|
||||
pass
|
||||
|
|
Loading…
Reference in New Issue