关闭 saul530 打开了这个问题 2017 年 10 月 22 日 · 1条评论 关闭 Stream.py 删除 c_line#296 saul530 打开了这个问题 2017 年 10 月 22 日 · 1条评论 注释 扫罗530 评论了 2017 年 10 月 22 日 在树莓派上将 stream.py 代码用作单独的线程时,我遇到了以下代码的问题。 while sum(c_line) >= RX_BUFFER_SIZE-1 | s.inWaiting() : out_temp = s.readline().strip() # Wait for grbl response if out_temp.find('ok') < 0 and out_temp.find('error') < 0 : print " MSG: \""+out_temp+"\"" # Debug response else : if out_temp.find('error') >= 0 : error_count += 1 g_count += 1 # Iterate g-code counter if verbose: print " REC<"+str(g_count)+": \""+out_temp+"\"" del c_line[0] # Delete the block character count corresponding to the last 'ok' 我不是 100% 确定发生了什么,但我怀疑有时程序会因为 s.inWaiting() 进入 while 循环并且会崩溃,因为它在那里的时间比 c_line 中的条目长。 不确定这是否是正确的解决方法,但在确保有删除机会之前有一个条目后,我没有遇到任何问题。 while sum(c_line) >= RX_BUFFER_SIZE-1 | s.inWaiting() : out_temp = s.readline().strip() # Wait for grbl response if out_temp.find('ok') < 0 and out_temp.find('error') < 0 : print " MSG: \""+out_temp+"\"" # Debug response else : if(c_line): if out_temp.find('error') >= 0 : error_count += 1 g_count += 1 # Iterate g-code counter if verbose: print " REC<"+str(g_count)+": \""+out_temp+"\"" del c_line[0] # Delete the block character count corresponding to the last 'ok' saul530 更改了标题 Stream.py del c_line 问题 Stream.py 删除 c_line 2017 年 10 月 22 日 贡献者 香奈儿 评论了 2017 年 10 月 23 日 @saul530:我经常使用流式脚本进行测试甚至工作。在 RPis、Mac 和其他 Linux PC 上。我从未遇到过流式脚本的性能或可靠性问题。我怀疑你的问题与试图改变它的工作方式和在线程中使用有关。我在这里帮不了你,因为我无意让流媒体脚本更复杂。它有意设计得简单,因此它删除了用于测试的变量。 chamnit已完成 关闭 2017 年 10 月 23 日 喜欢 (0) G28.1和G30.1参数传递时应返回错误 #378 G59.1 – G59.3 WCS 似乎不起作用 #379 v1.3.8-EDGE 重启后键盘快捷键消失 #427 关闭 无法在 gsender 1.2.0 中打开 .gcode 文件 #367 RaspberryPi 运行 gsender 时出现问题 #89 向 fluidnc 发送 $$ 会导致 gsender 崩溃 #473 v1.3.8-EDGE 重启后键盘快捷键消失 #427 关闭无法在 gsender 1.2.0 中打开 .gcode 文件 #367RaspberryPi 运行 gsender 时出现问题 #89向 fluidnc 发送 $$ 会导致 gsender 崩溃 #473功能请求:抑制发送到机器的 gcode 中的 gcode 注释。 #444 关闭通过网络连接进行连接 #171操纵杆运动的剩余问题 #204 关闭新版本认为我的机器一直处于锁定状态 #474 关闭
在树莓派上将 stream.py 代码用作单独的线程时,我遇到了以下代码的问题。
我不是 100% 确定发生了什么,但我怀疑有时程序会因为 s.inWaiting() 进入 while 循环并且会崩溃,因为它在那里的时间比 c_line 中的条目长。
不确定这是否是正确的解决方法,但在确保有删除机会之前有一个条目后,我没有遇到任何问题。