示例#1
0
        public unsafe void note_homing_end(bool did_trigger = false)
        {
            var ret = _stepqueue.set_homing(0) > 0;

            //var ret = this._ffi_lib.stepcompress_set_homing(this._stepqueue, 0);
            if (ret)
            {
                throw new McuException("Internal error in stepcompress");
            }
            ret = _stepqueue.reset(0) > 0;
            //ret = this._ffi_lib.stepcompress_reset(this._stepqueue, 0);
            if (ret)
            {
                throw new McuException("Internal error in stepcompress");
            }
            uint *data = stackalloc uint[] { (uint)this._reset_cmd_id, (uint)this._oid, 0 };

            ret = _stepqueue.queue_msg(new ReadOnlySpan <uint>(data, 3)) > 0;
            //ret = this._ffi_lib.stepcompress_queue_msg(this._stepqueue, data, 3);
            if (ret)
            {
                throw new McuException("Internal error in stepcompress");
            }
            if (!did_trigger || this._mcu.is_fileoutput())
            {
                return;
            }
            var parameters   = this._get_position_cmd.send_with_response(new object[] { this._oid }, response: "stepper_position", response_oid: this._oid);
            var mcu_pos_dist = parameters.Get <int>("pos") * this._step_dist;

            if (this._invert_dir)
            {
                mcu_pos_dist = -mcu_pos_dist;
            }
            _stepper_kinematics.itersolve_set_commanded_pos(mcu_pos_dist - this._mcu_position_offset);
            //this._ffi_lib.itersolve_set_commanded_pos(this._stepper_kinematics, mcu_pos_dist - this._mcu_position_offset);
        }