- 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):
|
||||
self.__write(req)
|
||||
rsp = self.__read()
|
||||
if "OK" in rsp[0]:
|
||||
return rsp[1]
|
||||
return None
|
||||
|
||||
if "OK" not in rsp[0]:
|
||||
raise Exception("Command not accepted")
|
||||
|
||||
return rsp[1]
|
||||
|
||||
def getCapabilties(self):
|
||||
return self.caps
|
||||
|
||||
@@ -187,6 +188,7 @@ if __name__ == '__main__':
|
||||
hendi.getSoftwareIdentifier()
|
||||
hendi.getSoftwareVersion()
|
||||
|
||||
print ("Test converters")
|
||||
for pwr in range(500, 3600, 100):
|
||||
print("pwr", pwr)
|
||||
digits = hendi.toDigits(pwr)
|
||||
@@ -194,19 +196,17 @@ if __name__ == '__main__':
|
||||
power = hendi.toWatts(digits)
|
||||
print("power", power)
|
||||
|
||||
try:
|
||||
hendi.remoteEnable(True)
|
||||
hendi.setSwitch(1)
|
||||
time.sleep(10.0)
|
||||
for pwr in range(500, 3600, 100):
|
||||
hendi.setPowerWatts(pwr)
|
||||
pw = hendi.getPowerWatts()
|
||||
print("power_w", pw)
|
||||
time.sleep(1.0)
|
||||
print ("Test Hendi")
|
||||
hendi.remoteEnable(True)
|
||||
hendi.setSwitch(1)
|
||||
time.sleep(10.0)
|
||||
for pwr in range(500, 3600, 100):
|
||||
hendi.setPowerWatts(pwr)
|
||||
pw = hendi.getPowerWatts()
|
||||
print("power_w", pw)
|
||||
time.sleep(1.0)
|
||||
|
||||
|
||||
except:
|
||||
pass
|
||||
|
||||
hendi.setSwitch(0)
|
||||
hendi.remoteEnable(False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user