| 1 |
# -*- coding: ascii -*- |
| 2 |
# $Id: bCNC.py,v 1.6 2014/10/15 15:04:48 bnv Exp bnv $ |
| 3 |
# |
| 4 |
# Author: Vasilis Vlachoudis |
| 5 |
# Email: [email protected] |
| 6 |
# Date: 17-Jun-2015 |
| 7 |
|
| 8 |
from __future__scip-python python python-stdlib 3.11 __future__/__init__: import absolute_importscip-python python python-stdlib 3.11 __future__/absolute_import.absolute_import. |
| 9 |
from __future__scip-python python python-stdlib 3.11 __future__/__init__: import print_functionscip-python python python-stdlib 3.11 __future__/print_function.print_function. |
| 10 |
__author__scip-python python bCNC 0.9.14.318 `bCNC.Sender`/__author__. = "Vasilis Vlachoudis" |
| 11 |
__email__scip-python python bCNC 0.9.14.318 `bCNC.Sender`/__email__. = "[email protected]" |
| 12 |
|
| 13 |
import osscip-python python python-stdlib 3.11 os/__init__: |
| 14 |
import rescip-python python python-stdlib 3.11 re/__init__: |
| 15 |
import sysscip-python python python-stdlib 3.11 sys/__init__: |
| 16 |
import globscip-python python python-stdlib 3.11 glob/__init__: |
| 17 |
import tracebackscip-python python python-stdlib 3.11 traceback/__init__: |
| 18 |
import rexx |
| 19 |
import timescip-python python python-stdlib 3.11 time/__init__: |
| 20 |
import threadingscip-python python python-stdlib 3.11 threading/__init__: |
| 21 |
import webbrowserscip-python python python-stdlib 3.11 webbrowser/__init__: |
| 22 |
|
| 23 |
from datetimescip-python python python-stdlib 3.11 datetime/__init__: import datetimescip-python python python-stdlib 3.11 datetime/datetime# |
| 24 |
|
| 25 |
try: |
| 26 |
import serial |
| 27 |
except ImportErrorscip-python python python-stdlib 3.11 builtins/ImportError#: |
| 28 |
serial = None |
| 29 |
try: |
| 30 |
from Queuescip-python python bCNC 0.9.14.318 Queue/__init__: import * |
| 31 |
except ImportErrorscip-python python python-stdlib 3.11 builtins/ImportError#: |
| 32 |
from queuescip-python python python-stdlib 3.11 queue/__init__: import * |
| 33 |
try: |
| 34 |
import tkMessageBox |
| 35 |
except ImportErrorscip-python python python-stdlib 3.11 builtins/ImportError#: |
| 36 |
import tkinter.messageboxscip-python python python-stdlib 3.11 `tkinter.messagebox`/__init__: as tkMessageBox |
| 37 |
|
| 38 |
from CNCscip-python python bCNC 0.9.14.318 CNC/__init__: import WAITscip-python python bCNC 0.9.14.318 `bCNC.CNC`/WAIT., MSGscip-python python bCNC 0.9.14.318 `bCNC.CNC`/MSG., UPDATEscip-python python bCNC 0.9.14.318 `bCNC.CNC`/UPDATE., WCSscip-python python bCNC 0.9.14.318 `bCNC.CNC`/WCS., CNCscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#, GCodescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode# |
| 39 |
import Utilsscip-python python bCNC 0.9.14.318 Utils/__init__: |
| 40 |
import Pendantscip-python python bCNC 0.9.14.318 Pendant/__init__: |
| 41 |
from _GenericGRBLscip-python python bCNC 0.9.14.318 _GenericGRBL/__init__: import ERROR_CODES |
| 42 |
|
| 43 |
WIKIscip-python python bCNC 0.9.14.318 `bCNC.Sender`/WIKI. = "https://github.com/vlachoudis/bCNC/wiki" |
| 44 |
|
| 45 |
SERIAL_POLLscip-python python bCNC 0.9.14.318 `bCNC.Sender`/SERIAL_POLL. = 0.125 # s |
| 46 |
SERIAL_TIMEOUTscip-python python bCNC 0.9.14.318 `bCNC.Sender`/SERIAL_TIMEOUT. = 0.10 # s |
| 47 |
G_POLLscip-python python bCNC 0.9.14.318 `bCNC.Sender`/G_POLL. = 10 # s |
| 48 |
RX_BUFFER_SIZEscip-python python bCNC 0.9.14.318 `bCNC.Sender`/RX_BUFFER_SIZE. = 128 |
| 49 |
|
| 50 |
GPATscip-python python bCNC 0.9.14.318 `bCNC.Sender`/GPAT. = rescip-python python python-stdlib 3.11 re/__init__:.compilescip-python python python-stdlib 3.11 re/compile().(r"[A-Za-z]\s*[-+]?\d+.*") |
| 51 |
FEEDPATscip-python python bCNC 0.9.14.318 `bCNC.Sender`/FEEDPAT. = rescip-python python python-stdlib 3.11 re/__init__:.compilescip-python python python-stdlib 3.11 re/compile().(r"^(.*)[fF](\d+\.?\d+)(.*)$") |
| 52 |
|
| 53 |
CONNECTEDscip-python python bCNC 0.9.14.318 `bCNC.Sender`/CONNECTED. = "Connected" |
| 54 |
NOT_CONNECTEDscip-python python bCNC 0.9.14.318 `bCNC.Sender`/NOT_CONNECTED. = "Not connected" |
| 55 |
|
| 56 |
STATECOLORDEFscip-python python bCNC 0.9.14.318 `bCNC.Sender`/STATECOLORDEF. = "LightYellow" #Default color for unknown types? |
| 57 |
STATECOLORscip-python python bCNC 0.9.14.318 `bCNC.Sender`/STATECOLOR. = { |
| 58 |
"Idle" : "Yellow", |
| 59 |
"Run" : "LightGreen", |
| 60 |
"Alarm" : "Red", |
| 61 |
"Jog" : "Green", |
| 62 |
"Home" : "Green", |
| 63 |
"Check" : "Magenta2", |
| 64 |
"Sleep" : "LightBlue", |
| 65 |
"Hold" : "Orange", |
| 66 |
"Hold:0" : "Orange", |
| 67 |
"Hold:1" : "OrangeRed", |
| 68 |
"Queue" : "OrangeRed", |
| 69 |
"Door" : "Red", |
| 70 |
"Door:0" : "OrangeRed", |
| 71 |
"Door:1" : "Red", |
| 72 |
"Door:2" : "Red", |
| 73 |
"Door:3" : "OrangeRed", |
| 74 |
CONNECTEDscip-python python bCNC 0.9.14.318 `bCNC.Sender`/CONNECTED. : "Yellow", |
| 75 |
NOT_CONNECTEDscip-python python bCNC 0.9.14.318 `bCNC.Sender`/NOT_CONNECTED. : "OrangeRed" |
| 76 |
} |
| 77 |
|
| 78 |
|
| 79 |
#============================================================================== |
| 80 |
# bCNC Sender class |
| 81 |
#============================================================================== |
| 82 |
class Senderscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#: |
| 83 |
# Messages types for log Queue |
| 84 |
MSG_BUFFERscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#MSG_BUFFER. = 0 # write to buffer one command |
| 85 |
MSG_SENDscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#MSG_SEND. = 1 # send message |
| 86 |
MSG_RECEIVEscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#MSG_RECEIVE. = 2 # receive message from controller |
| 87 |
MSG_OKscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#MSG_OK. = 3 # ok response from controller, move top most command to terminal |
| 88 |
MSG_ERRORscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#MSG_ERROR. = 4 # error message or exception |
| 89 |
MSG_RUNENDscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#MSG_RUNEND. = 5 # run ended |
| 90 |
MSG_CLEARscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#MSG_CLEAR. = 6 # clear buffer |
| 91 |
|
| 92 |
def __init__scip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self)): |
| 93 |
# Global variables |
| 94 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self).historyscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#history. = [] |
| 95 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self)._historyPosscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_historyPos. = None |
| 96 |
|
| 97 |
#self.mcontrol = None |
| 98 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self).controllersscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllers. = {} |
| 99 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self).controllerLoadscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerLoad().() |
| 100 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self).controllerSetscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerSet().("GRBL1") |
| 101 |
|
| 102 |
CNCscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#.loadConfigscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#loadConfig().(Utilsscip-python python bCNC 0.9.14.318 Utils/__init__:.configscip-python python bCNC 0.9.14.318 `bCNC.Utils`/config.) |
| 103 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode. = GCodescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#() |
| 104 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self).cncscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#cnc. = selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..cncscip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#cnc. |
| 105 |
|
| 106 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self).logscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#log. = Queuescip-python python python-stdlib 3.11 queue/__init__:() # Log queue returned from GRBL |
| 107 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self).queuescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#queue. = Queuescip-python python python-stdlib 3.11 queue/__init__:() # Command queue to be send to GRBL |
| 108 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self).pendantscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#pendant. = Queuescip-python python python-stdlib 3.11 queue/__init__:() # Command queue to be executed from Pendant |
| 109 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self).serialscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial. = None |
| 110 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self).threadscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#thread. = None |
| 111 |
|
| 112 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self)._posUpdatescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_posUpdate. = False # Update position |
| 113 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self)._probeUpdatescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_probeUpdate.= False # Update probe |
| 114 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self)._gUpdatescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_gUpdate. = False # Update $G |
| 115 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self)._updatescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_update. = None # Generic update |
| 116 |
|
| 117 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self).runningscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#running. = False |
| 118 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self).runningPrevscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#runningPrev. = None |
| 119 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self).cleanAfterscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#cleanAfter. = False |
| 120 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self)._runLinesscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_runLines. = 0 |
| 121 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self)._quitscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_quit. = 0 # Quit counter to exit program |
| 122 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self)._stopscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_stop. = False # Raise to stop current run |
| 123 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self)._pausescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_pause. = False # machine is on Hold |
| 124 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self)._alarmscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_alarm. = True # Display alarm message if true |
| 125 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self)._msgscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_msg. = None |
| 126 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self)._sumclinescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_sumcline. = 0 |
| 127 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self)._lastFeedscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_lastFeed. = 0 |
| 128 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self)._newFeedscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_newFeed. = 0 |
| 129 |
|
| 130 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self)._onStartscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_onStart. = "" |
| 131 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#__init__().(self)._onStopscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_onStop. = "" |
| 132 |
|
| 133 |
|
| 134 |
#---------------------------------------------------------------------- |
| 135 |
def controllerLoadscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerLoad().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerLoad().(self)): |
| 136 |
# Find plugins in the controllers directory and load them |
| 137 |
for f in globscip-python python python-stdlib 3.11 glob/__init__:.globscip-python python python-stdlib 3.11 glob/glob().("%s/controllers/*.py"%(Utilsscip-python python bCNC 0.9.14.318 Utils/__init__:.prgpathscip-python python bCNC 0.9.14.318 `bCNC.Utils`/prgpath.)): |
| 138 |
name,ext = osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..splitextscip-python python python-stdlib 3.11 ntpath/join().(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..basenamescip-python python python-stdlib 3.11 ntpath/join().(f)) |
| 139 |
if name[0] == '_': continue |
| 140 |
#print("Loaded motion controller plugin: %s"%(name)) |
| 141 |
try: |
| •142 |
package = __import__(name, globals(), locals(), [], 0) |
| 143 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerLoad().(self).controllersscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllers.[name] = package.Controller(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerLoad().(self)) |
| 144 |
except (ImportErrorscip-python python python-stdlib 3.11 builtins/ImportError#, AttributeErrorscip-python python python-stdlib 3.11 builtins/AttributeError#): |
| 145 |
typ, val, tb = sysscip-python python python-stdlib 3.11 sys/__init__:.exc_infoscip-python python python-stdlib 3.11 sys/exc_info().() |
| 146 |
tracebackscip-python python python-stdlib 3.11 traceback/__init__:.print_exceptionscip-python python python-stdlib 3.11 traceback/print_exception().(typ, val, tb) |
| 147 |
|
| 148 |
#---------------------------------------------------------------------- |
| 149 |
def controllerListscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerList().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerList().(self)): |
| 150 |
#print("ctrlist") |
| 151 |
#self.controllers["GRBL1"].test() |
| 152 |
#if len(self.controllers.keys()) < 1: self.controllerLoad() |
| 153 |
return sortedscip-python python python-stdlib 3.11 builtins/sorted().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerList().(self).controllersscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllers..keysscip-python python python-stdlib 3.11 builtins/dict#keys().()) |
| 154 |
|
| 155 |
#---------------------------------------------------------------------- |
| 156 |
def controllerSetscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerSet().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerSet().(self), ctlscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerSet().(ctl)): |
| 157 |
#print("Activating motion controller plugin: %s"%(ctl)) |
| 158 |
if ctlscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerSet().(ctl) in selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerSet().(self).controllersscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllers..keysscip-python python python-stdlib 3.11 builtins/dict#keys().(): |
| 159 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerSet().(self).controllerscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controller. = ctlscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerSet().(ctl) |
| 160 |
CNCscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#.varsscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#vars.["controller"] = ctlscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerSet().(ctl) |
| 161 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerSet().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol. = selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerSet().(self).controllersscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllers.[ctlscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerSet().(ctl)] |
| 162 |
#self.mcontrol.test() |
| 163 |
|
| 164 |
|
| 165 |
#---------------------------------------------------------------------- |
| 166 |
def quitscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#quit().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#quit().(self), eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#quit().(event)=None): |
| 167 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#quit().(self).saveConfigscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#saveConfig().() |
| 168 |
Pendantscip-python python bCNC 0.9.14.318 Pendant/__init__:.stopscip-python python bCNC 0.9.14.318 `bCNC.Pendant`/stop().() |
| 169 |
|
| 170 |
#---------------------------------------------------------------------- |
| 171 |
def loadConfigscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadConfig().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadConfig().(self)): |
| 172 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadConfig().(self).controllerSetscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerSet().(Utilsscip-python python bCNC 0.9.14.318 Utils/__init__:.getStrscip-python python bCNC 0.9.14.318 `bCNC.Utils`/getStr().("Connection", "controller")) |
| 173 |
Pendantscip-python python bCNC 0.9.14.318 Pendant/__init__:.portscip-python python bCNC 0.9.14.318 `bCNC.Pendant`/port. = Utilsscip-python python bCNC 0.9.14.318 Utils/__init__:.getIntscip-python python bCNC 0.9.14.318 `bCNC.Utils`/getInt().("Connection","pendantport",Pendantscip-python python bCNC 0.9.14.318 Pendant/__init__:.portscip-python python bCNC 0.9.14.318 `bCNC.Pendant`/port.) |
| 174 |
GCodescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#.LOOP_MERGEscip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#LOOP_MERGE. = Utilsscip-python python bCNC 0.9.14.318 Utils/__init__:.getBoolscip-python python bCNC 0.9.14.318 `bCNC.Utils`/getBool().("File","dxfloopmerge") |
| 175 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadConfig().(self).loadHistoryscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadHistory().() |
| 176 |
|
| 177 |
#---------------------------------------------------------------------- |
| 178 |
def saveConfigscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#saveConfig().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#saveConfig().(self)): |
| 179 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#saveConfig().(self).saveHistoryscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#saveHistory().() |
| 180 |
|
| 181 |
#---------------------------------------------------------------------- |
| 182 |
def loadHistoryscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadHistory().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadHistory().(self)): |
| 183 |
try: |
| 184 |
f = openscip-python python python-stdlib 3.11 builtins/open().(Utilsscip-python python bCNC 0.9.14.318 Utils/__init__:.hisFilescip-python python bCNC 0.9.14.318 `bCNC.Utils`/hisFile.,"r") |
| 185 |
except: |
| 186 |
return |
| 187 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadHistory().(self).historyscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#history. = [x.stripscip-python python python-stdlib 3.11 builtins/str#strip().() for x in f] |
| 188 |
f.closescip-python python python-stdlib 3.11 io/IOBase#close().() |
| 189 |
|
| 190 |
#---------------------------------------------------------------------- |
| 191 |
def saveHistoryscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#saveHistory().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#saveHistory().(self)): |
| 192 |
try: |
| 193 |
f = openscip-python python python-stdlib 3.11 builtins/open().(Utilsscip-python python bCNC 0.9.14.318 Utils/__init__:.hisFilescip-python python bCNC 0.9.14.318 `bCNC.Utils`/hisFile.,"w") |
| 194 |
except: |
| 195 |
return |
| 196 |
f.writescip-python python python-stdlib 3.11 io/TextIOBase#write().("\n".joinscip-python python python-stdlib 3.11 builtins/str#join().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#saveHistory().(self).historyscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#history.)) |
| 197 |
f.closescip-python python python-stdlib 3.11 io/IOBase#close().() |
| 198 |
|
| 199 |
#---------------------------------------------------------------------- |
| 200 |
# Evaluate a line for possible expressions |
| 201 |
# can return a python exception, needs to be catched |
| 202 |
#---------------------------------------------------------------------- |
| 203 |
def evaluatescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#evaluate().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#evaluate().(self), linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#evaluate().(line)): |
| 204 |
return selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#evaluate().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..evaluatescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#evaluate().(CNCscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#.compileLinescip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#compileLine().(linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#evaluate().(line),True), selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#evaluate().(self)) |
| 205 |
|
| 206 |
#---------------------------------------------------------------------- |
| 207 |
# Execute a line as gcode if pattern matches |
| 208 |
# @return True on success |
| 209 |
# False otherwise |
| 210 |
#---------------------------------------------------------------------- |
| 211 |
def executeGcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeGcode().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeGcode().(self), linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeGcode().(line)): |
| 212 |
if isinstance(linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeGcode().(line), tuplescip-python python python-stdlib 3.11 builtins/tuple#) or \ |
| 213 |
linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeGcode().(line)[0] in ("$","!","~","?","(","@") or GPATscip-python python bCNC 0.9.14.318 `bCNC.Sender`/GPAT..matchscip-python python python-stdlib 3.11 re/Pattern#match().(linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeGcode().(line)): |
| 214 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeGcode().(self).sendGCodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendGCode().(linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeGcode().(line)) |
| 215 |
return True |
| 216 |
return False |
| 217 |
|
| 218 |
#---------------------------------------------------------------------- |
| 219 |
# Execute a single command |
| 220 |
#---------------------------------------------------------------------- |
| 221 |
def executeCommandscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self), linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(line)): |
| 222 |
#print |
| 223 |
#print "<<<",line |
| 224 |
#try: |
| 225 |
# line = self.gcode.evaluate(CNC.compileLine(line,True)) |
| 226 |
#except: |
| 227 |
# return "Evaluation error", sys.exc_info()[1] |
| 228 |
#print ">>>",line |
| 229 |
|
| 230 |
if linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(line) is None: return |
| 231 |
|
| 232 |
oline = linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(line).strip() |
| 233 |
linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(line) = oline.replace(","," ").split() |
| 234 |
cmd = linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(line)[0].upper() |
| 235 |
|
| 236 |
# ABS*OLUTE: Set absolute coordinates |
| 237 |
if rexx.abbrev("ABSOLUTE",cmd,3): |
| 238 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self).sendGCodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendGCode().("G90") |
| 239 |
|
| 240 |
# HELP: open browser to display help |
| 241 |
elif cmd == "HELP": |
| 242 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self).helpscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#help().() |
| 243 |
|
| 244 |
# HOME: perform a homing cycle |
| 245 |
elif cmd == "HOME": |
| 246 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self).homescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#home().() |
| 247 |
|
| 248 |
# LO*AD [filename]: load filename containing g-code |
| 249 |
elif rexx.abbrev("LOAD",cmd,2): |
| 250 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self).loadscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(line)[1]) |
| 251 |
|
| 252 |
# OPEN: open serial connection to grbl |
| 253 |
# CLOSE: close serial connection to grbl |
| 254 |
elif cmd in ("OPEN","CLOSE"): |
| 255 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self).openClose() |
| 256 |
|
| 257 |
# QU*IT: quit program |
| 258 |
# EX*IT: exit program |
| 259 |
elif rexx.abbrev("QUIT",cmd,2) or rexx.abbrev("EXIT",cmd,2): |
| 260 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self).quitscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#quit().() |
| 261 |
|
| 262 |
# PAUSE: pause cycle |
| 263 |
elif cmd == "PAUSE": |
| 264 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self).pausescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#pause().() |
| 265 |
|
| 266 |
# RESUME: resume |
| 267 |
elif cmd == "RESUME": |
| 268 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self).resumescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#resume().() |
| 269 |
|
| 270 |
# FEEDHOLD: feedhold |
| 271 |
elif cmd == "FEEDHOLD": |
| 272 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self).feedHoldscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#feedHold().() |
| 273 |
|
| 274 |
# REL*ATIVE: switch to relative coordinates |
| 275 |
elif rexx.abbrev("RELATIVE",cmd,3): |
| 276 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self).sendGCodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendGCode().("G91") |
| 277 |
|
| 278 |
# RESET: perform a soft reset to grbl |
| 279 |
elif cmd == "RESET": |
| 280 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self).softResetscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#softReset().() |
| 281 |
|
| 282 |
# RUN: run g-code |
| 283 |
elif cmd == "RUN": |
| 284 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self).run() |
| 285 |
|
| 286 |
# SAFE [z]: safe z to move |
| 287 |
elif cmd=="SAFE": |
| 288 |
try: CNCscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#.varsscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#vars.["safe"] = floatscip-python python python-stdlib 3.11 builtins/float#(linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(line)[1]) |
| 289 |
except: pass |
| 290 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self).statusbar["text"] = "Safe Z= %g"%(CNCscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#.varsscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#vars.["safe"]) |
| 291 |
|
| 292 |
# SA*VE [filename]: save to filename or to default name |
| 293 |
elif rexx.abbrev("SAVE",cmd,2): |
| 294 |
if len(linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(line))>1: |
| 295 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self).savescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(line)[1]) |
| 296 |
else: |
| 297 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self).saveAllscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#saveAll().() |
| 298 |
|
| 299 |
# SENDHEX: send a hex-char in grbl |
| 300 |
elif cmd == "SENDHEX": |
| 301 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self).sendHexscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendHex().(linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(line)[1]) |
| 302 |
|
| 303 |
# SET [x [y [z]]]: set x,y,z coordinates to current workspace |
| 304 |
elif cmd == "SET": |
| 305 |
try: x = floatscip-python python python-stdlib 3.11 builtins/float#(linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(line)[1]) |
| 306 |
except: x = None |
| 307 |
try: y = floatscip-python python python-stdlib 3.11 builtins/float#(linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(line)[2]) |
| 308 |
except: y = None |
| 309 |
try: z = floatscip-python python python-stdlib 3.11 builtins/float#(linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(line)[3]) |
| 310 |
except: z = None |
| 311 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self)._wcsSetscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_wcsSet().(x,y,z) |
| 312 |
|
| 313 |
elif cmd == "SET0": |
| 314 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self)._wcsSetscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_wcsSet().(0.,0.,0.) |
| 315 |
|
| 316 |
elif cmd == "SETX": |
| 317 |
try: x = floatscip-python python python-stdlib 3.11 builtins/float#(linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(line)[1]) |
| 318 |
except: x = "" |
| 319 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self)._wcsSetscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_wcsSet().(x,None,None) |
| 320 |
|
| 321 |
elif cmd == "SETY": |
| 322 |
try: y = floatscip-python python python-stdlib 3.11 builtins/float#(linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(line)[1]) |
| 323 |
except: y = "" |
| 324 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self)._wcsSetscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_wcsSet().(None,y,None) |
| 325 |
|
| 326 |
elif cmd == "SETZ": |
| 327 |
try: z = floatscip-python python python-stdlib 3.11 builtins/float#(linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(line)[1]) |
| 328 |
except: z = "" |
| 329 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self)._wcsSetscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_wcsSet().(None,None,z) |
| 330 |
|
| 331 |
# STOP: stop current run |
| 332 |
elif cmd == "STOP": |
| 333 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self).stopRunscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#stopRun().() |
| 334 |
|
| 335 |
# UNL*OCK: unlock grbl |
| 336 |
elif rexx.abbrev("UNLOCK",cmd,3): |
| 337 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self).unlockscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#unlock().() |
| 338 |
|
| 339 |
# Send commands to SMOOTHIE |
| 340 |
elif selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..executeCommand(oline, linescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#executeCommand().(line), cmd): |
| 341 |
pass |
| 342 |
|
| 343 |
else: |
| 344 |
return _("unknown command"),_("Invalid command %s")%(oline) |
| 345 |
|
| 346 |
#---------------------------------------------------------------------- |
| 347 |
def helpscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#help().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#help().(self), eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#help().(event)=None): |
| 348 |
webbrowserscip-python python python-stdlib 3.11 webbrowser/__init__:.openscip-python python python-stdlib 3.11 webbrowser/open().(WIKIscip-python python bCNC 0.9.14.318 `bCNC.Sender`/WIKI.,newscip-python python python-stdlib 3.11 webbrowser/open().(new)=2) |
| 349 |
|
| 350 |
#---------------------------------------------------------------------- |
| 351 |
def loadRecentscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadRecent().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadRecent().(self), recentscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadRecent().(recent)): |
| 352 |
filename = Utilsscip-python python bCNC 0.9.14.318 Utils/__init__:.getRecentscip-python python bCNC 0.9.14.318 `bCNC.Utils`/getRecent().(recentscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadRecent().(recent)) |
| 353 |
if filename is None: return |
| 354 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadRecent().(self).loadscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(filename) |
| 355 |
|
| 356 |
#---------------------------------------------------------------------- |
| 357 |
def _loadRecent0scip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent0().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent0().(self),eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent0().(event)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent0().(self).loadRecentscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadRecent().(0) |
| 358 |
|
| 359 |
# ---------------------------------------------------------------------- |
| 360 |
def _loadRecent1scip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent1().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent1().(self),eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent1().(event)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent1().(self).loadRecentscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadRecent().(1) |
| 361 |
|
| 362 |
# ---------------------------------------------------------------------- |
| 363 |
def _loadRecent2scip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent2().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent2().(self),eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent2().(event)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent2().(self).loadRecentscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadRecent().(2) |
| 364 |
|
| 365 |
# ---------------------------------------------------------------------- |
| 366 |
def _loadRecent3scip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent3().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent3().(self),eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent3().(event)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent3().(self).loadRecentscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadRecent().(3) |
| 367 |
|
| 368 |
# ---------------------------------------------------------------------- |
| 369 |
def _loadRecent4scip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent4().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent4().(self),eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent4().(event)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent4().(self).loadRecentscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadRecent().(4) |
| 370 |
|
| 371 |
# ---------------------------------------------------------------------- |
| 372 |
def _loadRecent5scip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent5().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent5().(self),eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent5().(event)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent5().(self).loadRecentscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadRecent().(5) |
| 373 |
|
| 374 |
# ---------------------------------------------------------------------- |
| 375 |
def _loadRecent6scip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent6().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent6().(self),eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent6().(event)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent6().(self).loadRecentscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadRecent().(6) |
| 376 |
|
| 377 |
# ---------------------------------------------------------------------- |
| 378 |
def _loadRecent7scip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent7().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent7().(self),eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent7().(event)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent7().(self).loadRecentscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadRecent().(7) |
| 379 |
|
| 380 |
# ---------------------------------------------------------------------- |
| 381 |
def _loadRecent8scip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent8().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent8().(self),eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent8().(event)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent8().(self).loadRecentscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadRecent().(8) |
| 382 |
|
| 383 |
# ---------------------------------------------------------------------- |
| 384 |
def _loadRecent9scip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent9().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent9().(self),eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent9().(event)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_loadRecent9().(self).loadRecentscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#loadRecent().(9) |
| 385 |
|
| 386 |
#---------------------------------------------------------------------- |
| 387 |
def _saveConfigFilescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_saveConfigFile().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_saveConfigFile().(self), filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_saveConfigFile().(filename)=None): |
| 388 |
if filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_saveConfigFile().(filename) is None: |
| 389 |
filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_saveConfigFile().(filename) = selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_saveConfigFile().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..filenamescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#filename. |
| 390 |
Utilsscip-python python bCNC 0.9.14.318 Utils/__init__:.setUtfscip-python python bCNC 0.9.14.318 `bCNC.Utils`/setUtf().("File", "dir", osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..dirnamescip-python python python-stdlib 3.11 ntpath/join().(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..abspathscip-python python python-stdlib 3.11 ntpath/join().(filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_saveConfigFile().(filename)))) |
| 391 |
Utilsscip-python python bCNC 0.9.14.318 Utils/__init__:.setUtfscip-python python bCNC 0.9.14.318 `bCNC.Utils`/setUtf().("File", "file", osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..basenamescip-python python python-stdlib 3.11 ntpath/join().(filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_saveConfigFile().(filename))) |
| 392 |
Utilsscip-python python bCNC 0.9.14.318 Utils/__init__:.setUtfscip-python python bCNC 0.9.14.318 `bCNC.Utils`/setUtf().("File", "probe", osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..basenamescip-python python python-stdlib 3.11 ntpath/join().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_saveConfigFile().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..probescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#probe..filenamescip-python python bCNC 0.9.14.318 `bCNC.CNC`/Probe#filename.)) |
| 393 |
|
| 394 |
#---------------------------------------------------------------------- |
| 395 |
# Load a file into editor |
| 396 |
#---------------------------------------------------------------------- |
| 397 |
def loadscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(self), filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(filename)): |
| 398 |
fn,ext = osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..splitextscip-python python python-stdlib 3.11 ntpath/join().(filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(filename)) |
| 399 |
ext = ext.lower() |
| 400 |
if ext==".probe": |
| 401 |
if filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(filename) is not None: |
| 402 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..probescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#probe..filenamescip-python python bCNC 0.9.14.318 `bCNC.CNC`/Probe#filename. = filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(filename) |
| 403 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(self)._saveConfigFilescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_saveConfigFile().() |
| 404 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..probescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#probe..loadscip-python python bCNC 0.9.14.318 `bCNC.CNC`/Probe#load().(filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(filename)) |
| 405 |
elif ext == ".orient": |
| 406 |
# save orientation file |
| 407 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..orientscip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#orient..loadscip-python python bCNC 0.9.14.318 `bCNC.CNC`/Orient#load().(filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(filename)) |
| 408 |
elif ext == ".stl" or ext == ".ply": |
| 409 |
# FIXME: implements solid import??? |
| 410 |
try : |
| 411 |
import tkMessageBox |
| 412 |
tkMessageBox.showinfo("Open 3D Mesh", "Importing of 3D mesh files in .STL and .PLY format is supported by SliceMesh plugin.\nYou can find it in CAM->SliceMesh.") |
| 413 |
except Exceptionscip-python python python-stdlib 3.11 builtins/Exception# as e : |
| 414 |
import tkinterscip-python python python-stdlib 3.11 tkinter/__init__: |
| 415 |
import tkinter.messageboxscip-python python python-stdlib 3.11 `tkinter.messagebox`/__init__: |
| 416 |
tkinter.messageboxscip-python python python-stdlib 3.11 tkinter/__init__:.showinfo("Open 3D Mesh", "Importing of 3D mesh files in .STL and .PLY format is supported by SliceMesh plugin.\nYou can find it in CAM->SliceMesh.") |
| 417 |
elif ext==".dxf": |
| 418 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..initscip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#init().() |
| 419 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..importDXFscip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#importDXF().(filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(filename)) |
| 420 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(self)._saveConfigFilescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_saveConfigFile().(filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(filename)) |
| 421 |
elif ext==".svg": |
| 422 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..initscip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#init().() |
| 423 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..importSVGscip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#importSVG().(filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(filename)) |
| 424 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(self)._saveConfigFilescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_saveConfigFile().(filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(filename)) |
| 425 |
else: |
| 426 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..loadscip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#load().(filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(filename)) |
| 427 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(self)._saveConfigFilescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_saveConfigFile().() |
| 428 |
Utilsscip-python python bCNC 0.9.14.318 Utils/__init__:.addRecentscip-python python bCNC 0.9.14.318 `bCNC.Utils`/addRecent().(filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#load().(filename)) |
| 429 |
|
| 430 |
#---------------------------------------------------------------------- |
| 431 |
def savescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(self), filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(filename)): |
| 432 |
fn,ext = osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..splitextscip-python python python-stdlib 3.11 ntpath/join().(filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(filename)) |
| 433 |
ext = ext.lower() |
| 434 |
if ext == ".probe" or ext == ".xyz": |
| 435 |
# save probe |
| 436 |
if not selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..probescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#probe..isEmptyscip-python python bCNC 0.9.14.318 `bCNC.CNC`/Probe#isEmpty().(): |
| 437 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..probescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#probe..savescip-python python bCNC 0.9.14.318 `bCNC.CNC`/Probe#save().(filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(filename)) |
| 438 |
if filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(filename) is not None: |
| 439 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(self)._saveConfigFilescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_saveConfigFile().() |
| 440 |
elif ext == ".orient": |
| 441 |
# save orientation file |
| 442 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..orientscip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#orient..savescip-python python bCNC 0.9.14.318 `bCNC.CNC`/Orient#save().(filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(filename)) |
| 443 |
elif ext == ".stl": |
| 444 |
#save probe as STL |
| 445 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..probescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#probe..saveAsSTLscip-python python bCNC 0.9.14.318 `bCNC.CNC`/Probe#saveAsSTL().(filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(filename)) |
| 446 |
elif ext == ".dxf": |
| 447 |
return selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..saveDXFscip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#saveDXF().(filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(filename)) |
| 448 |
elif ext == ".svg": |
| 449 |
return selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..saveSVGscip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#saveSVG().(filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(filename)) |
| 450 |
elif ext == ".txt": |
| 451 |
#save gcode as txt (only enabled blocks and no bCNC metadata) |
| 452 |
return selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..saveTXTscip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#saveTXT().(filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(filename)) |
| 453 |
else: |
| 454 |
if filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(filename) is not None: |
| 455 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..filenamescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#filename. = filenamescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(filename) |
| 456 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(self)._saveConfigFilescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_saveConfigFile().() |
| 457 |
Utilsscip-python python bCNC 0.9.14.318 Utils/__init__:.addRecentscip-python python bCNC 0.9.14.318 `bCNC.Utils`/addRecent().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..filenamescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#filename.) |
| 458 |
return selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..savescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#save().() |
| 459 |
|
| 460 |
#---------------------------------------------------------------------- |
| 461 |
def saveAllscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#saveAll().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#saveAll().(self), eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#saveAll().(event)=None): |
| 462 |
if selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#saveAll().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..filenamescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#filename.: |
| 463 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#saveAll().(self).savescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#saveAll().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..filenamescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#filename.) |
| 464 |
if selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#saveAll().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..probescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#probe..filenamescip-python python bCNC 0.9.14.318 `bCNC.CNC`/Probe#filename.: |
| 465 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#saveAll().(self).savescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#save().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#saveAll().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..probescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#probe..filenamescip-python python bCNC 0.9.14.318 `bCNC.CNC`/Probe#filename.) |
| 466 |
return "break" |
| 467 |
|
| 468 |
#---------------------------------------------------------------------- |
| 469 |
# Serial write |
| 470 |
#---------------------------------------------------------------------- |
| 471 |
def serial_writescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial_write().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial_write().(self), datascip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial_write().(data)): |
| 472 |
# print('W %s : %s'%(type(data),data)) |
| 473 |
|
| 474 |
#if sys.version_info[0] == 2: |
| 475 |
# ret = self.serial.write(str(data)) |
| 476 |
if isinstance(datascip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial_write().(data), bytesscip-python python python-stdlib 3.11 builtins/bytes#): |
| 477 |
ret = selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial_write().(self).serialscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial..write(datascip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial_write().(data)) |
| 478 |
else: |
| 479 |
ret = selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial_write().(self).serialscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial..write(datascip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial_write().(data).encode()) |
| 480 |
return ret |
| 481 |
|
| 482 |
#---------------------------------------------------------------------- |
| 483 |
# Open serial port |
| 484 |
#---------------------------------------------------------------------- |
| 485 |
def openscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#open().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#open().(self), devicescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#open().(device), baudratescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#open().(baudrate)): |
| 486 |
#self.serial = serial.Serial( |
| 487 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#open().(self).serialscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial. = serial.serial_for_url( |
| 488 |
devicescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#open().(device).replace('\\', '\\\\'), #Escape for windows |
| 489 |
baudratescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#open().(baudrate), |
| 490 |
bytesize=serial.EIGHTBITS, |
| 491 |
parity=serial.PARITY_NONE, |
| 492 |
stopbits=serial.STOPBITS_ONE, |
| 493 |
timeout=SERIAL_TIMEOUTscip-python python bCNC 0.9.14.318 `bCNC.Sender`/SERIAL_TIMEOUT., |
| 494 |
xonxoff=False, |
| 495 |
rtscts=False) |
| 496 |
# Toggle DTR to reset Arduino |
| 497 |
try: |
| 498 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#open().(self).serialscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial..setDTR(0) |
| 499 |
except IOErrorscip-python python python-stdlib 3.11 builtins/IOError#: |
| 500 |
pass |
| 501 |
timescip-python python python-stdlib 3.11 time/__init__:.sleepscip-python python python-stdlib 3.11 time/sleep().(1) |
| 502 |
CNCscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#.varsscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#vars.["state"] = CONNECTEDscip-python python bCNC 0.9.14.318 `bCNC.Sender`/CONNECTED. |
| 503 |
CNCscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#.varsscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#vars.["color"] = STATECOLORscip-python python bCNC 0.9.14.318 `bCNC.Sender`/STATECOLOR.[CNCscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#.varsscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#vars.["state"]] |
| 504 |
#self.state.config(text=CNC.vars["state"], |
| 505 |
# background=CNC.vars["color"]) |
| 506 |
# toss any data already received, see |
| 507 |
# http://pyserial.sourceforge.net/pyserial_api.html#serial.Serial.flushInput |
| 508 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#open().(self).serialscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial..flushInput() |
| 509 |
try: |
| 510 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#open().(self).serialscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial..setDTR(1) |
| 511 |
except IOErrorscip-python python python-stdlib 3.11 builtins/IOError#: |
| 512 |
pass |
| 513 |
timescip-python python python-stdlib 3.11 time/__init__:.sleepscip-python python python-stdlib 3.11 time/sleep().(1) |
| 514 |
# self.serial_write(b"\n\n") # serial_write should be handling this |
| 515 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#open().(self).serial_writescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial_write().("\n\n") |
| 516 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#open().(self)._gcountscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_gcount. = 0 |
| 517 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#open().(self)._alarmscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_alarm. = True |
| 518 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#open().(self).threadscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#thread. = threadingscip-python python python-stdlib 3.11 threading/__init__:.Threadscip-python python python-stdlib 3.11 threading/Thread#(targetscip-python python python-stdlib 3.11 threading/Thread#__init__().(target)=selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#open().(self).serialIOscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().) |
| 519 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#open().(self).threadscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#thread..startscip-python python python-stdlib 3.11 threading/Thread#start().() |
| 520 |
return True |
| 521 |
|
| 522 |
#---------------------------------------------------------------------- |
| 523 |
# Close serial port |
| 524 |
#---------------------------------------------------------------------- |
| 525 |
def closescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#close().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#close().(self)): |
| 526 |
if selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#close().(self).serialscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial. is None: return |
| 527 |
try: |
| 528 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#close().(self).stopRunscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#stopRun().() |
| 529 |
except: |
| 530 |
pass |
| 531 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#close().(self)._runLinesscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_runLines. = 0 |
| 532 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#close().(self).threadscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#thread. = None |
| 533 |
timescip-python python python-stdlib 3.11 time/__init__:.sleepscip-python python python-stdlib 3.11 time/sleep().(1) |
| 534 |
try: |
| 535 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#close().(self).serialscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial..closescip-python python python-stdlib 3.11 io/IOBase#close().() |
| 536 |
except: |
| 537 |
pass |
| 538 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#close().(self).serialscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial. = None |
| 539 |
CNCscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#.varsscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#vars.["state"] = NOT_CONNECTEDscip-python python bCNC 0.9.14.318 `bCNC.Sender`/NOT_CONNECTED. |
| 540 |
CNCscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#.varsscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#vars.["color"] = STATECOLORscip-python python bCNC 0.9.14.318 `bCNC.Sender`/STATECOLOR.[CNCscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#.varsscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#vars.["state"]] |
| 541 |
|
| 542 |
#---------------------------------------------------------------------- |
| 543 |
# Send to controller a gcode or command |
| 544 |
# WARNING: it has to be a single line! |
| 545 |
#---------------------------------------------------------------------- |
| 546 |
def sendGCodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendGCode().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendGCode().(self), cmdscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendGCode().(cmd)): |
| 547 |
if selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendGCode().(self).serialscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial. and not selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendGCode().(self).runningscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#running.: |
| 548 |
if isinstance(cmdscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendGCode().(cmd),tuplescip-python python python-stdlib 3.11 builtins/tuple#): |
| 549 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendGCode().(self).queuescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#queue..putscip-python python python-stdlib 3.11 queue/Queue#put().(cmdscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendGCode().(cmd)) |
| 550 |
else: |
| 551 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendGCode().(self).queuescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#queue..putscip-python python python-stdlib 3.11 queue/Queue#put().(cmdscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendGCode().(cmd)+"\n") |
| 552 |
|
| 553 |
#---------------------------------------------------------------------- |
| 554 |
def sendHexscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendHex().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendHex().(self), hexcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendHex().(hexcode)): |
| 555 |
if selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendHex().(self).serialscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial. is None: return |
| 556 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendHex().(self).serial_writescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial_write().(chr(intscip-python python python-stdlib 3.11 builtins/int#(hexcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendHex().(hexcode),16))) |
| 557 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendHex().(self).serialscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial..flushscip-python python python-stdlib 3.11 io/IOBase#flush().() |
| 558 |
|
| 559 |
#---------------------------------------------------------------------- |
| 560 |
# FIXME: legacy wrappers. try to call mcontrol directly instead: |
| 561 |
#---------------------------------------------------------------------- |
| 562 |
def hardResetscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#hardReset().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#hardReset().(self)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#hardReset().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..hardReset() |
| 563 |
def softResetscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#softReset().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#softReset().(self), clearAlarmscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#softReset().(clearAlarm)=True): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#softReset().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..softReset(clearAlarmscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#softReset().(clearAlarm)) |
| 564 |
def unlockscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#unlock().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#unlock().(self), clearAlarmscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#unlock().(clearAlarm)=True): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#unlock().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..unlock(clearAlarmscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#unlock().(clearAlarm)) |
| 565 |
def homescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#home().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#home().(self), eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#home().(event)=None): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#home().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..home(eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#home().(event)) |
| 566 |
def viewSettingsscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#viewSettings().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#viewSettings().(self)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#viewSettings().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..viewSettings() |
| 567 |
def viewParametersscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#viewParameters().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#viewParameters().(self)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#viewParameters().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..viewParameters() |
| 568 |
def viewStatescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#viewState().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#viewState().(self)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#viewState().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..viewState() |
| 569 |
def viewBuildscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#viewBuild().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#viewBuild().(self)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#viewBuild().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..viewBuild() |
| 570 |
def viewStartupscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#viewStartup().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#viewStartup().(self)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#viewStartup().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..viewStartup() |
| 571 |
def checkGcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#checkGcode().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#checkGcode().(self)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#checkGcode().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..checkGcode() |
| 572 |
def grblHelpscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#grblHelp().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#grblHelp().(self)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#grblHelp().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..grblHelp() |
| 573 |
def grblRestoreSettingsscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#grblRestoreSettings().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#grblRestoreSettings().(self)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#grblRestoreSettings().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..grblRestoreSettings() |
| 574 |
def grblRestoreWCSscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#grblRestoreWCS().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#grblRestoreWCS().(self)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#grblRestoreWCS().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..grblRestoreWCS() |
| 575 |
def grblRestoreAllscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#grblRestoreAll().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#grblRestoreAll().(self)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#grblRestoreAll().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..grblRestoreAll() |
| 576 |
def gotoscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#goto().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#goto().(self), xscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#goto().(x)=None, yscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#goto().(y)=None, zscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#goto().(z)=None): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#goto().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..goto(xscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#goto().(x),yscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#goto().(y),zscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#goto().(z)) |
| 577 |
def _wcsSetscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_wcsSet().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_wcsSet().(self), xscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_wcsSet().(x), yscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_wcsSet().(y), zscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_wcsSet().(z)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_wcsSet().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol.._wcsSet(xscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_wcsSet().(x),yscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_wcsSet().(y),zscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_wcsSet().(z)) # FIXME Duplicate with ControlPage |
| 578 |
def feedHoldscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#feedHold().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#feedHold().(self), eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#feedHold().(event)=None): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#feedHold().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..feedHold(eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#feedHold().(event)) |
| 579 |
def resumescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#resume().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#resume().(self), eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#resume().(event)=None): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#resume().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..resume(eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#resume().(event)) |
| 580 |
def pausescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#pause().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#pause().(self), eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#pause().(event)=None): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#pause().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..pause(eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#pause().(event)) |
| 581 |
def purgeControllerscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#purgeController().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#purgeController().(self)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#purgeController().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..purgeController() |
| 582 |
def g28Commandscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#g28Command().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#g28Command().(self)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#g28Command().(self).sendGCodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendGCode().("G28.1") #FIXME: ??? |
| 583 |
def g30Commandscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#g30Command().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#g30Command().(self)): selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#g30Command().(self).sendGCodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sendGCode().("G30.1") #FIXME: ??? |
| 584 |
|
| 585 |
#---------------------------------------------------------------------- |
| 586 |
def emptyQueuescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#emptyQueue().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#emptyQueue().(self)): |
| 587 |
while selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#emptyQueue().(self).queuescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#queue..qsizescip-python python python-stdlib 3.11 queue/Queue#qsize().()>0: |
| 588 |
try: |
| 589 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#emptyQueue().(self).queuescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#queue..get_nowaitscip-python python python-stdlib 3.11 queue/Queue#get_nowait().() |
| 590 |
except Emptyscip-python python python-stdlib 3.11 queue/__init__:: |
| 591 |
break |
| 592 |
|
| 593 |
#---------------------------------------------------------------------- |
| 594 |
def stopProbescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#stopProbe().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#stopProbe().(self)): |
| 595 |
if selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#stopProbe().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..probescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#probe..startscip-python python bCNC 0.9.14.318 `bCNC.CNC`/Probe#start.: |
| 596 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#stopProbe().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..probescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#probe..clearscip-python python bCNC 0.9.14.318 `bCNC.CNC`/Probe#clear().() |
| 597 |
|
| 598 |
#---------------------------------------------------------------------- |
| 599 |
def getBufferFillscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#getBufferFill().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#getBufferFill().(self)): |
| 600 |
return selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#getBufferFill().(self)._sumclinescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_sumcline. * 100. / RX_BUFFER_SIZEscip-python python bCNC 0.9.14.318 `bCNC.Sender`/RX_BUFFER_SIZE. |
| 601 |
|
| 602 |
#---------------------------------------------------------------------- |
| 603 |
def initRunscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#initRun().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#initRun().(self)): |
| 604 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#initRun().(self)._quitscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_quit. = 0 |
| 605 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#initRun().(self)._pausescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_pause. = False |
| 606 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#initRun().(self)._pathsscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_paths. = None |
| 607 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#initRun().(self).runningscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#running. = True |
| 608 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#initRun().(self).disable() |
| 609 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#initRun().(self).emptyQueuescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#emptyQueue().() |
| 610 |
timescip-python python python-stdlib 3.11 time/__init__:.sleepscip-python python python-stdlib 3.11 time/sleep().(1) |
| 611 |
|
| 612 |
#---------------------------------------------------------------------- |
| 613 |
# Called when run is finished |
| 614 |
#---------------------------------------------------------------------- |
| 615 |
def runEndedscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#runEnded().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#runEnded().(self)): |
| 616 |
if selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#runEnded().(self).runningscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#running.: |
| 617 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#runEnded().(self).logscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#log..putscip-python python python-stdlib 3.11 queue/Queue#put().((Senderscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#.MSG_RUNENDscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#MSG_RUNEND.,_("Run ended"))) |
| 618 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#runEnded().(self).logscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#log..putscip-python python python-stdlib 3.11 queue/Queue#put().((Senderscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#.MSG_RUNENDscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#MSG_RUNEND., strscip-python python python-stdlib 3.11 builtins/str#(datetimescip-python python python-stdlib 3.11 datetime/datetime#.nowscip-python python python-stdlib 3.11 datetime/datetime#now().()))) |
| 619 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#runEnded().(self).logscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#log..putscip-python python python-stdlib 3.11 queue/Queue#put().((Senderscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#.MSG_RUNENDscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#MSG_RUNEND., strscip-python python python-stdlib 3.11 builtins/str#(CNCscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#.varsscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#vars.["msg"]))) |
| 620 |
if selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#runEnded().(self)._onStopscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_onStop.: |
| 621 |
try: |
| 622 |
osscip-python python python-stdlib 3.11 os/__init__:.systemscip-python python python-stdlib 3.11 os/system().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#runEnded().(self)._onStopscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_onStop.) |
| 623 |
except: |
| 624 |
pass |
| 625 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#runEnded().(self)._runLinesscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_runLines. = 0 |
| 626 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#runEnded().(self)._quitscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_quit. = 0 |
| 627 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#runEnded().(self)._msgscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_msg. = None |
| 628 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#runEnded().(self)._pausescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_pause. = False |
| 629 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#runEnded().(self).runningscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#running. = False |
| 630 |
CNCscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#.varsscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#vars.["running"] = False |
| 631 |
|
| 632 |
|
| 633 |
#---------------------------------------------------------------------- |
| 634 |
# Stop the current run |
| 635 |
#---------------------------------------------------------------------- |
| 636 |
def stopRunscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#stopRun().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#stopRun().(self), eventscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#stopRun().(event)=None): |
| 637 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#stopRun().(self).feedHoldscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#feedHold().() |
| 638 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#stopRun().(self)._stopscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_stop. = True |
| 639 |
# if we are in the process of submitting do not do anything |
| 640 |
if selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#stopRun().(self)._runLinesscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_runLines. != sysscip-python python python-stdlib 3.11 sys/__init__:.maxsizescip-python python python-stdlib 3.11 sys/maxsize.maxsize.: |
| 641 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#stopRun().(self).purgeControllerscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#purgeController().() |
| 642 |
|
| 643 |
#---------------------------------------------------------------------- |
| 644 |
# This should be called everytime that milling of g-code file is finished |
| 645 |
# So we can purge the controller for the next job |
| 646 |
# See https://github.com/vlachoudis/bCNC/issues/1035 |
| 647 |
#---------------------------------------------------------------------- |
| 648 |
def jobDonescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#jobDone().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#jobDone().(self)): |
| 649 |
printscip-python python python-stdlib 3.11 builtins/print().("Job done. Purging the controller. (Running: %s)"%(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#jobDone().(self).runningscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#running.)) |
| 650 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#jobDone().(self).purgeControllerscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#purgeController().() |
| 651 |
|
| 652 |
#---------------------------------------------------------------------- |
| 653 |
# This is called everytime that motion controller changes the state |
| 654 |
# YOU SHOULD PASS ONLY REAL HW STATE TO THIS, NOT BCNC STATE |
| 655 |
# Right now the primary idea of this is to detect when job stopped running |
| 656 |
#---------------------------------------------------------------------- |
| 657 |
def controllerStateChangescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerStateChange().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerStateChange().(self), statescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerStateChange().(state)): |
| 658 |
printscip-python python python-stdlib 3.11 builtins/print().("Controller state changed to: %s (Running: %s)"%(statescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerStateChange().(state), selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerStateChange().(self).runningscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#running.)) |
| 659 |
if statescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerStateChange().(state) in ("Idle"): |
| 660 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerStateChange().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..viewParameters() |
| 661 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerStateChange().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..viewState() |
| 662 |
|
| 663 |
if selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerStateChange().(self).cleanAfterscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#cleanAfter. == True and selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerStateChange().(self).runningscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#running. == False and statescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerStateChange().(state) in ("Idle"): |
| 664 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerStateChange().(self).cleanAfterscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#cleanAfter. = False |
| 665 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#controllerStateChange().(self).jobDonescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#jobDone().() |
| 666 |
|
| 667 |
#---------------------------------------------------------------------- |
| 668 |
# thread performing I/O on serial line |
| 669 |
#---------------------------------------------------------------------- |
| 670 |
def serialIOscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)): |
| 671 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).sio_waitscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sio_wait. = False # wait for commands to complete (status change to Idle) |
| 672 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).sio_statusscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sio_status. = False # waiting for status <...> report |
| 673 |
cline = [] # length of pipeline commands |
| 674 |
sline = [] # pipeline commands |
| 675 |
tosend = None # next string to send |
| 676 |
tr = tg = timescip-python python python-stdlib 3.11 time/__init__:.timescip-python python python-stdlib 3.11 time/time().() # last time a ? or $G was send to grbl |
| 677 |
|
| 678 |
while selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).threadscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#thread.: |
| 679 |
t = timescip-python python python-stdlib 3.11 time/__init__:.timescip-python python python-stdlib 3.11 time/time().() |
| 680 |
# refresh machine position? |
| 681 |
if t-tr > SERIAL_POLLscip-python python bCNC 0.9.14.318 `bCNC.Sender`/SERIAL_POLL.: |
| 682 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..viewStatusReport() |
| 683 |
tr = t |
| 684 |
|
| 685 |
#If Override change, attach feed |
| 686 |
if CNCscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#.varsscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#vars.["_OvChanged"]: |
| 687 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..overrideSet() |
| 688 |
|
| 689 |
# Fetch new command to send if... |
| 690 |
if tosend is None and not selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).sio_waitscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sio_wait. and not selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)._pausescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_pause. and selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).queuescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#queue..qsizescip-python python python-stdlib 3.11 queue/Queue#qsize().()>0: |
| 691 |
try: |
| 692 |
tosend = selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).queuescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#queue..get_nowaitscip-python python python-stdlib 3.11 queue/Queue#get_nowait().() |
| 693 |
#print "+++",repr(tosend) |
| 694 |
if isinstance(tosend, tuplescip-python python python-stdlib 3.11 builtins/tuple#): |
| 695 |
#print "gcount tuple=",self._gcount |
| 696 |
# wait to empty the grbl buffer and status is Idle |
| 697 |
if tosend[0] == WAITscip-python python bCNC 0.9.14.318 `bCNC.CNC`/WAIT.: |
| 698 |
# Don't count WAIT until we are idle! |
| 699 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).sio_waitscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#sio_wait. = True |
| 700 |
#print "+++ WAIT ON" |
| 701 |
#print "gcount=",self._gcount, self._runLines |
| 702 |
elif tosend[0] == MSGscip-python python bCNC 0.9.14.318 `bCNC.CNC`/MSG.: |
| 703 |
# Count executed commands as well |
| 704 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)._gcountscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_gcount. += 1 |
| 705 |
if tosend[1] is not None: |
| 706 |
# show our message on machine status |
| 707 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)._msgscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_msg. = tosend[1] |
| 708 |
elif tosend[0] == UPDATEscip-python python bCNC 0.9.14.318 `bCNC.CNC`/UPDATE.: |
| 709 |
# Count executed commands as well |
| 710 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)._gcountscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_gcount. += 1 |
| 711 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)._updatescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_update. = tosend[1] |
| 712 |
else: |
| 713 |
# Count executed commands as well |
| 714 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)._gcountscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_gcount. += 1 |
| 715 |
tosend = None |
| 716 |
|
| 717 |
elif not isinstance(tosend,strscip-python python python-stdlib 3.11 builtins/str#): |
| 718 |
try: |
| 719 |
tosend = selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).gcodescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#gcode..evaluatescip-python python bCNC 0.9.14.318 `bCNC.CNC`/GCode#evaluate().(tosend, selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)) |
| 720 |
# if isinstance(tosend, list): |
| 721 |
# cline.append(len(tosend[0])) |
| 722 |
# sline.append(tosend[0]) |
| 723 |
if isinstance(tosend,strscip-python python python-stdlib 3.11 builtins/str#): |
| 724 |
tosend += "\n" |
| 725 |
else: |
| 726 |
# Count executed commands as well |
| 727 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)._gcountscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_gcount. += 1 |
| 728 |
#print "gcount str=",self._gcount |
| 729 |
#print "+++ eval=",repr(tosend),type(tosend) |
| 730 |
except: |
| 731 |
for s in strscip-python python python-stdlib 3.11 builtins/str#(sysscip-python python python-stdlib 3.11 sys/__init__:.exc_infoscip-python python python-stdlib 3.11 sys/exc_info().()[1]).splitlinesscip-python python python-stdlib 3.11 builtins/str#splitlines().(): |
| 732 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).logscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#log..putscip-python python python-stdlib 3.11 queue/Queue#put().((Senderscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#.MSG_ERRORscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#MSG_ERROR.,s)) |
| 733 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)._gcountscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_gcount. += 1 |
| 734 |
tosend = None |
| 735 |
except Emptyscip-python python python-stdlib 3.11 queue/__init__:: |
| 736 |
break |
| 737 |
|
| 738 |
if tosend is not None: |
| 739 |
# All modification in tosend should be |
| 740 |
# done before adding it to cline |
| 741 |
|
| 742 |
# Keep track of last feed |
| 743 |
pat = FEEDPATscip-python python bCNC 0.9.14.318 `bCNC.Sender`/FEEDPAT..matchscip-python python python-stdlib 3.11 re/Pattern#match().(tosend) |
| 744 |
if pat is not None: |
| 745 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)._lastFeedscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_lastFeed. = pat.groupscip-python python python-stdlib 3.11 re/Match#group().(2) |
| 746 |
|
| 747 |
# Modify sent g-code to reflect overrided feed for controllers without override support |
| 748 |
if not selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..has_override: |
| 749 |
if CNCscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#.varsscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#vars.["_OvChanged"]: |
| 750 |
CNCscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#.varsscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#vars.["_OvChanged"] = False |
| 751 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)._newFeedscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_newFeed. = floatscip-python python python-stdlib 3.11 builtins/float#(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)._lastFeedscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_lastFeed.)*CNCscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#.varsscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#vars.["_OvFeed"]/100.0 |
| 752 |
if pat is None and selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)._newFeedscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_newFeed.!=0 \ |
| 753 |
and not tosend.startswithscip-python python python-stdlib 3.11 builtins/str#startswith().("$"): |
| 754 |
tosend = "f%g%s" % (selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)._newFeedscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_newFeed., tosend) |
| 755 |
|
| 756 |
# Apply override Feed |
| 757 |
if CNCscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#.varsscip-python python bCNC 0.9.14.318 `bCNC.CNC`/CNC#vars.["_OvFeed"] != 100 and selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)._newFeedscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_newFeed. != 0: |
| 758 |
pat = FEEDPATscip-python python bCNC 0.9.14.318 `bCNC.Sender`/FEEDPAT..matchscip-python python python-stdlib 3.11 re/Pattern#match().(tosend) |
| 759 |
if pat is not None: |
| 760 |
try: |
| 761 |
tosend = "%sf%g%s\n" % \ |
| 762 |
(pat.groupscip-python python python-stdlib 3.11 re/Match#group().(1), |
| 763 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)._newFeedscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_newFeed., |
| 764 |
pat.groupscip-python python python-stdlib 3.11 re/Match#group().(3)) |
| 765 |
except: |
| 766 |
pass |
| 767 |
|
| 768 |
# Bookkeeping of the buffers |
| 769 |
sline.appendscip-python python python-stdlib 3.11 builtins/list#append().(tosend) |
| 770 |
cline.appendscip-python python python-stdlib 3.11 builtins/list#append().(len(tosend)) |
| 771 |
|
| 772 |
# Anything to receive? |
| 773 |
if selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).serialscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial..inWaiting() or tosend is None: |
| 774 |
try: |
| 775 |
line = strscip-python python python-stdlib 3.11 builtins/str#(selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).serialscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial..readlinescip-python python python-stdlib 3.11 io/IOBase#readline().().decodescip-python python python-stdlib 3.11 builtins/bytes#decode().()).stripscip-python python python-stdlib 3.11 builtins/str#strip().() |
| 776 |
except: |
| 777 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).logscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#log..putscip-python python python-stdlib 3.11 queue/Queue#put().((Senderscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#.MSG_RECEIVEscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#MSG_RECEIVE., strscip-python python python-stdlib 3.11 builtins/str#(sysscip-python python python-stdlib 3.11 sys/__init__:.exc_infoscip-python python python-stdlib 3.11 sys/exc_info().()[1]))) |
| 778 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).emptyQueuescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#emptyQueue().() |
| 779 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).closescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#close().() |
| 780 |
return |
| 781 |
|
| 782 |
#print "<R<",repr(line) |
| 783 |
#print "*-* stack=",sline,"sum=",sum(cline),"wait=",wait,"pause=",self._pause |
| 784 |
if not line: |
| 785 |
pass |
| 786 |
elif selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..parseLine(line, cline, sline): |
| 787 |
pass |
| 788 |
else: |
| 789 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).logscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#log..putscip-python python python-stdlib 3.11 queue/Queue#put().((Senderscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#.MSG_RECEIVEscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#MSG_RECEIVE., line)) |
| 790 |
|
| 791 |
# Received external message to stop |
| 792 |
if selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)._stopscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_stop.: |
| 793 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).emptyQueuescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#emptyQueue().() |
| 794 |
tosend = None |
| 795 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).logscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#log..putscip-python python python-stdlib 3.11 queue/Queue#put().((Senderscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#.MSG_CLEARscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#MSG_CLEAR., "")) |
| 796 |
# WARNING if runLines==maxint then it means we are |
| 797 |
# still preparing/sending lines from from bCNC.run(), |
| 798 |
# so don't stop |
| 799 |
if selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)._runLinesscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_runLines. != sysscip-python python python-stdlib 3.11 sys/__init__:.maxsizescip-python python python-stdlib 3.11 sys/maxsize.maxsize.: |
| 800 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)._stopscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_stop. = False |
| 801 |
|
| 802 |
#print "tosend='%s'"%(repr(tosend)),"stack=",sline, |
| 803 |
# "sum=",sum(cline),"wait=",wait,"pause=",self._pause |
| 804 |
if tosend is not None and sumscip-python python python-stdlib 3.11 builtins/sum().(cline) < RX_BUFFER_SIZEscip-python python bCNC 0.9.14.318 `bCNC.Sender`/RX_BUFFER_SIZE.: |
| 805 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self)._sumclinescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#_sumcline. = sumscip-python python python-stdlib 3.11 builtins/sum().(cline) |
| 806 |
# if isinstance(tosend, list): |
| 807 |
# self.serial_write(str(tosend.pop(0))) |
| 808 |
# if not tosend: tosend = None |
| 809 |
|
| 810 |
#print ">S>",repr(tosend),"stack=",sline,"sum=",sum(cline) |
| 811 |
if selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..gcode_case > 0: tosend = tosend.upperscip-python python python-stdlib 3.11 builtins/str#upper().() |
| 812 |
if selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).mcontrolscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#mcontrol..gcode_case < 0: tosend = tosend.lowerscip-python python python-stdlib 3.11 builtins/str#lower().() |
| 813 |
|
| 814 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).serial_writescip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serial_write().(tosend) |
| 815 |
|
| 816 |
#self.serial_write(tosend) |
| 817 |
#self.serial.flush() |
| 818 |
selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).logscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#log..putscip-python python python-stdlib 3.11 queue/Queue#put().((Senderscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#.MSG_BUFFERscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#MSG_BUFFER.,tosend)) |
| 819 |
|
| 820 |
tosend = None |
| 821 |
if not selfscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#serialIO().(self).runningscip-python python bCNC 0.9.14.318 `bCNC.Sender`/Sender#running. and t-tg > G_POLLscip-python python bCNC 0.9.14.318 `bCNC.Sender`/G_POLL.: |
| 822 |
tosend = b"$G\n" #FIXME: move to controller specific class |
| 823 |
sline.appendscip-python python python-stdlib 3.11 builtins/list#append().(tosend) |
| 824 |
cline.appendscip-python python python-stdlib 3.11 builtins/list#append().(len(tosend)) |
| 825 |
tg = t |