CrealityOfficial / Ender-3S1

This Source code for Creality Ender-3S1 Series,MCU and Screen
GNU General Public License v3.0
126 stars 52 forks source link

Printer not moving after homing with G28 serial command #63

Open ComteTocou opened 3 weeks ago

ComteTocou commented 3 weeks ago

Hello ! I am having an issue with trying to control my Ender 3 S1 Pro via Python in a Raspberry Pi (connected via micro-usb). My code is the following:

import serial ser = serial.Serial('/dev/ttyUSB0', baudrate=115200) ser.write(str.encode("G28\r\n")) ser.write(str.encode("G1 X110 Y80 Z30\r\n"))

It homes the printer, but every other G-code step that I may add afterwards is not executed, and I do not understand why. Even when I remove the line homing the printer with the G28 command, my printer does not respond to any other command. I am forced to shutdown my Raspberry and and restart the printer to have the commands working again. And every G28 command that I may then use freezes all other commands, and my printer only responds to another homing.

Sorry if things aren't clear and if I didn't provide enough information just ask me and I'll do my best.

Thanks in advance.

Pethical commented 3 weeks ago

Hi, Try this and check the printer response:

import serial
import time

ser = serial.Serial('/dev/ttyUSB0', baudrate=115200)

def send_gcode(command):
    ser.write(str.encode(command + "\r\n"))
    ser.flush()
    response = ser.readline()
    print(response.decode('utf-8')) 

send_gcode("G28")
send_gcode("G1 X110 Y80 Z30")
ser.close()
ComteTocou commented 3 weeks ago

Thanks.

I have tried it, and I get this error while the printer homes:

Error:!! STOP called because of BLTouch error - restart with M999

Note that I don't have a nozzle attached as I replaced it with a camera, so this may be the problem.

EDIT: I also sometimes get this error : Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting) but the printer still homes.

EDIT2: I restarted my printer and used the comman send_gcode("G28 X Y") with your code. It seems to be that without the Nozzle I don't have the Z-axis-limit, so I figured that I would not use Z homing.