예제 #1
0
 def set_global_parameter(self, request, reply):
     self.__logger.debug("set_global_parameter")
     if (request.commandType == self.GPs.controlHost):
         reply.value = self.__host_address = request.value
     elif (request.commandType == self.GPs.controlModule):
         reply.value = self.__module_address = request.value
     elif (request.commandType == self.GPs.loggingEnabled):
         PyTrinamicMicro.set_logging_enabled(not (request.value == 0))
         reply.value = 1 if PyTrinamicMicro.logging_enabled else 0
     else:
         if (request.commandType in self.gp):
             reply.value = self.gp[request.commandType] = request.value
         else:
             reply.status = TMCL_Status.WRONG_TYPE
     return reply
예제 #2
0
Therefore, do not use stdout-writing functions (print, ...) here or turn them off while using VCP.

Created on 06.10.2020

@author: LK
'''

# Imports
from PyTrinamicMicro.platforms.motionpy1.connections.usb_vcp_tmcl_interface import usb_vcp_tmcl_interface
from PyTrinamicMicro.platforms.motionpy1.tmcl_slave_dummy import tmcl_slave_dummy
from PyTrinamicMicro import PyTrinamicMicro
import struct
import logging

# Prepare Logger
PyTrinamicMicro.set_logging_console_enabled(False)
logger = logging.getLogger(__name__)
logger.info("TMCL Slave on USB_VCP interface")

# Main program
lin = None
logger.info("Initializing interface ...")
con = usb_vcp_tmcl_interface()
slave = tmcl_slave_dummy()
logger.info("Interface initialized.")

while(not(slave.status.stop)):
    # Handle connection
    if(con.request_available()):
        logger.debug("Request available.")
        request = con.receive_request()
예제 #3
0
 def test(identifier):
     return PyTrinamicMicro.test(MotionPy, identifier)
예제 #4
0
 def script(identifier):
     return PyTrinamicMicro.script(MotionPy, identifier)