vlachoudis / bCNC

GRBL CNC command sender, autoleveler and g-code editor
GNU General Public License v2.0
1.54k stars 528 forks source link

high cpu (resolved ?) #1765

Open metropolicon opened 1 year ago

metropolicon commented 1 year ago

Hello all.... On my RPi 4 , Run gcode , even in Pause, one of cpu CORE up to 95% usage...... On my Windows PC, task manager show Very high cpu usage for bCNC...

Exploring bCNC code, with only two added lines in Sender.py, the problem seem to be solved..... CPU USAGE now : 20%

def serialIO(self):

self.sio_wait   = False    # wait for commands to complete (status change to Idle)
self.sio_status = False    # waiting for status <...> report
cline  = []    # length of pipeline commands
sline  = []      # pipeline commands
tosend = None      # next string to send
tr = tg = time.time()    # last time a ? or $G was send to grbl

while self.thread:
  t = time.time()
  if self.running:                                              #-------added this line
    time.sleep(0.05)                                          #-------added this line
  # refresh machine position?
  if t-tr > SERIAL_POLL:

am i simple lucky men ?

bgbsww commented 1 year ago

While that does solve the issue, it may have a side effect of limiting performance if you are trying to send more than 20 ( 1 / 0.05 ) Gcode lines per second, which might not be common, but isn't impossible to imagine depending on your machine and your project. The value might want to be made tunable to handle this case.