Show
Ignore:
Timestamp:
02/15/10 17:14:19 (7 months ago)
Author:
fma
Message:

Added shutdown() method

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/papywizard/hardware/gigaPanBotHardware.py

    r2286 r2298  
    189189            except IOError: 
    190190                Logger().exception("GigaPanBotHardware.__sendCmd") 
    191                 Logger().warning("GigaPanBotHardware.__sendCmd(): %s axis %d can't sent command %s. Retrying..." % (NAME, self._axis, repr(cmd))) 
     191                Logger().warning("GigaPanBotHardware.__sendCmd(): axis %d can't sent command %s. Retrying..." % (self._axis, repr(cmd))) 
    192192            else: 
    193193                break 
    194194        else: 
    195             raise HardwareError("%s axis %d can't send command %s" % (NAME, self._axis, repr(cmd))) 
     195            raise HardwareError("Axis %d can't send command %s" % (self._axis, repr(cmd))) 
    196196        #Logger().debug("GigaPanBotHardware.__sendCmd(): axis %d ans=%s" % (self._axis, repr(answer))) 
    197197 
     
    199199 
    200200    def init(self): 
    201         """ Init the GigaPanBot hardware. 
    202  
    203         Done only once per axis. 
    204         """ 
    205201        self._driver.acquireBus() 
    206202        try: 
     
    217213            self.__encoderFullCircle = self.__decodeAxisValue(value) 
    218214            Logger().debug("GigaPanBotHardware.init(): full circle count=%s" % hex(self.__encoderFullCircle)) 
     215 
     216            # Tell the controller we are connected 
     217            self.__sendCmd("F", "1") 
     218 
     219        finally: 
     220            self._driver.releaseBus() 
     221 
     222    def shutdown(self): 
     223        self._driver.acquireBus() 
     224        try: 
     225 
     226            # Tell the controller we are disconnected 
     227            self.__sendCmd("F", "0") 
    219228 
    220229        finally: