Beispiel #1
0
 public IdleTimeout(ConfigWrapper config)
 {
     this.printer  = config.get_printer();
     this.reactor  = this.printer.get_reactor();
     this.gcode    = this.printer.lookup_object <GCodeParser>("gcode");
     this.toolhead = null;
     this.printer.register_event_handler("klippy:ready", handle_ready);
     this.state        = "Idle";
     this.idle_timeout = config.getfloat("timeout", 600.0, above: 0.0);
     this.idle_gcode   = config.get("gcode", DEFAULT_IDLE_GCODE).Split("\n");
 }
Beispiel #2
0
        public Mcu(ConfigWrapper config, ClockSync clocksync)
        {
            this._printer   = config.get_printer();
            this._clocksync = clocksync;
            this._reactor   = _printer.get_reactor();
            this._name      = config.get_name();
            if (this._name.StartsWith("mcu "))
            {
                this._name = this._name.Substring(4);
            }
            this._printer.register_event_handler("klippy:connect", this._connect);
            this._printer.register_event_handler("klippy:shutdown", this._shutdown);
            this._printer.register_event_handler("klippy:disconnect", this._disconnect);
            // Serial port
            this._serialport = config.get("serial", "/dev/ttyS0");
            var baud = 0;

            if (!(this._serialport.StartsWith("/dev/rpmsg_") || this._serialport.StartsWith("/tmp/klipper_host_")))
            {
                baud = (int)config.getint("baud", 250000, minval: 2400);
            }
            this._serial = new SerialReader(this._reactor, this._serialport, baud);
            // Restarts
            this._restart_method = RestartMethod.Command;
            if (baud != 0)
            {
                this._restart_method = config.getEnum <RestartMethod>("restart_method", RestartMethod.None);
            }
            this._reset_cmd          = null;
            this._emergency_stop_cmd = null;
            this._is_shutdown        = false;
            this._shutdown_msg       = "";
            // Config building
            this._printer.lookup_object <PrinterPins>("pins").register_chip(this._name, this);
            this._oid_count        = 0;
            this._config_callbacks = new List <Action>();
            this._init_cmds        = new List <string>();
            this._config_cmds      = new List <string>();
            this._pin_map          = config.get("pin_map", null);
            this._custom           = config.get("custom", "");
            this._mcu_freq         = 0.0;
            // Move command queuing
            this._max_stepper_error = config.getfloat("max_stepper_error", 2.5E-05, minval: 0.0);
            this._move_count        = 0;
            this._stepqueues        = new List <stepcompress>();
            this._steppersync       = null;
            // Stats
            this._stats_sumsq_base = 0.0;
            this._mcu_tick_avg     = 0.0;
            this._mcu_tick_stddev  = 0.0;
            this._mcu_tick_awake   = 0.0;
        }