- throw exception if command is not accepted
git-svn-id: http://moon:8086/svn/projects/HendiControl@367 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
+16
-16
@@ -113,10 +113,11 @@ class HendiCtrl():
|
|||||||
def cmd(self, req):
|
def cmd(self, req):
|
||||||
self.__write(req)
|
self.__write(req)
|
||||||
rsp = self.__read()
|
rsp = self.__read()
|
||||||
if "OK" in rsp[0]:
|
if "OK" not in rsp[0]:
|
||||||
return rsp[1]
|
raise Exception("Command not accepted")
|
||||||
return None
|
|
||||||
|
return rsp[1]
|
||||||
|
|
||||||
def getCapabilties(self):
|
def getCapabilties(self):
|
||||||
return self.caps
|
return self.caps
|
||||||
|
|
||||||
@@ -187,6 +188,7 @@ if __name__ == '__main__':
|
|||||||
hendi.getSoftwareIdentifier()
|
hendi.getSoftwareIdentifier()
|
||||||
hendi.getSoftwareVersion()
|
hendi.getSoftwareVersion()
|
||||||
|
|
||||||
|
print ("Test converters")
|
||||||
for pwr in range(500, 3600, 100):
|
for pwr in range(500, 3600, 100):
|
||||||
print("pwr", pwr)
|
print("pwr", pwr)
|
||||||
digits = hendi.toDigits(pwr)
|
digits = hendi.toDigits(pwr)
|
||||||
@@ -194,19 +196,17 @@ if __name__ == '__main__':
|
|||||||
power = hendi.toWatts(digits)
|
power = hendi.toWatts(digits)
|
||||||
print("power", power)
|
print("power", power)
|
||||||
|
|
||||||
try:
|
print ("Test Hendi")
|
||||||
hendi.remoteEnable(True)
|
hendi.remoteEnable(True)
|
||||||
hendi.setSwitch(1)
|
hendi.setSwitch(1)
|
||||||
time.sleep(10.0)
|
time.sleep(10.0)
|
||||||
for pwr in range(500, 3600, 100):
|
for pwr in range(500, 3600, 100):
|
||||||
hendi.setPowerWatts(pwr)
|
hendi.setPowerWatts(pwr)
|
||||||
pw = hendi.getPowerWatts()
|
pw = hendi.getPowerWatts()
|
||||||
print("power_w", pw)
|
print("power_w", pw)
|
||||||
time.sleep(1.0)
|
time.sleep(1.0)
|
||||||
|
|
||||||
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
hendi.setSwitch(0)
|
hendi.setSwitch(0)
|
||||||
hendi.remoteEnable(False)
|
hendi.remoteEnable(False)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user