public void home_start( double print_time, double sample_time, int sample_count, double rest_time, bool triggered = true) { var clock = _mcu.print_time_to_clock(print_time); var rest_ticks = (int)(rest_time * _mcu.get_adjusted_freq()); _homing = true; _min_query_time = _mcu.monotonic(); _next_query_print_time = print_time + RETRY_QUERY; _home_cmd.send(new object[] { _oid, clock, _mcu.seconds_to_clock(sample_time), sample_count, rest_ticks, triggered ^ _invert }, reqclock: (ulong)clock); foreach (var s in _steppers) { s.note_homing_start((ulong)clock); } }
public void set_digital(double print_time, bool value) { var clock = _mcu.print_time_to_clock(print_time); _set_cmd.send(new object[] { _oid, clock, !!value ^ _invert }, (ulong)_last_clock, (ulong)clock); _last_clock = clock; }
public void handle_identify(Dictionary <string, object> parameters) { if (is_done || parameters.Get <int>("offset") != identify_data.Length) { return; } byte[] msgdata = parameters.Get <byte[]>("data"); if (msgdata == null || msgdata.Length < 40) { if (msgdata != null) { identify_data.Write(msgdata); } is_done = true; logging.Info("finish load identify_data " + identify_data.Length); return; } identify_data.Write(msgdata); identify_cmd.send(new object[] { (int)identify_data.Length, 40 }); }
public bool _check_busy(double eventtime, double home_end_time = 0.0) { // Check if need to send an end_stop_query command var last_sent_time = _last_state.Get("#sent_time", -1.0); if (last_sent_time >= _min_query_time || _mcu.is_fileoutput()) { if (!_homing) { return(false); } if (!(bool)_last_state.Get("homing", false)) { foreach (var s in _steppers) { s.note_homing_end(did_trigger: true); } _homing = false; return(false); } var last_sent_print_time = _mcu.estimated_print_time(last_sent_time); if (last_sent_print_time > home_end_time) { // Timeout - disable endstop checking foreach (var s in _steppers) { s.note_homing_end(); } _homing = false; _home_cmd.send(new object[] { _oid, 0, 0, 0, 0, 0 }); throw new TimeoutEndstopException("Timeout during endstop homing"); } } if (_mcu.is_shutdown()) { throw new McuException("MCU is shutdown"); } var est_print_time = _mcu.estimated_print_time(eventtime); if (est_print_time >= _next_query_print_time) { _next_query_print_time = est_print_time + RETRY_QUERY; _query_cmd.send(new object[] { _oid }); } return(true); }