Commit f3c8295f authored by Mateus Goto's avatar Mateus Goto

[Fixed] Reset on init and close to avoid errors

parent 55e4ca5e
from abc import abstractmethod from abc import abstractmethod
import socket import socket
import time
from UtilitiesRei.refineOutput import refineOutput from UtilitiesRei.refineOutput import refineOutput
...@@ -24,6 +25,7 @@ class NHR9400(): ...@@ -24,6 +25,7 @@ class NHR9400():
self.__s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) self.__s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
self.__s.connect((client, 5025)) self.__s.connect((client, 5025))
self.__s.send("*RST".encode())
self.__s.send("SYST:RWL\n".encode()) #Command to activate remote control and locking the touchscreen self.__s.send("SYST:RWL\n".encode()) #Command to activate remote control and locking the touchscreen
self.__s.send("*IDN?\n".encode()) self.__s.send("*IDN?\n".encode())
msg = self.__s.recv(1024) msg = self.__s.recv(1024)
...@@ -120,11 +122,10 @@ class NHR9400(): ...@@ -120,11 +122,10 @@ class NHR9400():
def close(self): def close(self):
self.systWatchdogService()
self.__s.send("SOUR:OUTP:ON 0\n".encode()) self.__s.send("SOUR:OUTP:ON 0\n".encode())
self.__s.send("ABOR\n".encode()) self.__s.send("ABOR\n".encode())
self.__s.send("SYST:LOC\n".encode()) self.__s.send("SYST:LOC\n".encode())
print(self.checkErrors())
self.__s.close() self.__s.close()
# Controle do relé de saída do hardware (LIGAR OU DESLIGAR) # Controle do relé de saída do hardware (LIGAR OU DESLIGAR)
# 0 OFF - Instrumento desabilitado # 0 OFF - Instrumento desabilitado
...@@ -155,12 +156,14 @@ class NHR9400(): ...@@ -155,12 +156,14 @@ class NHR9400():
def systWatchdogRobust(self, bool): def systWatchdogRobust(self, bool):
if bool != 0 or bool != 1: return -1 if bool != 0 or bool != 1: return -1
self.__s.send(("SYST:WATC:ROB " + str(bool) +"\n").encode()) self.__s.send(("SYST:WATC:ROB " + str(bool) +"\n").encode())
value = self.__s.recv(1024) self.__s.send(("*RST\n").encode())
return self.receiveString(value) self.__s.send("SYST:RWL\n".encode())
#Command resets watchdog timer #Command resets watchdog timer
def systWatchdogService(self): def systWatchdogService(self):
self.__s.send(("SYST:WATC:SERV\n").encode()) self.__s.send(("SYST:WATC:SERV\n").encode())
self.__s.send(("*RST\n").encode())
self.__s.send("SYST:RWL\n".encode())
################################# Digital Subsystem ############################ ################################# Digital Subsystem ############################
......
...@@ -20,7 +20,7 @@ def main(): ...@@ -20,7 +20,7 @@ def main():
for elem in nhr10: for elem in nhr10:
print("nhr10 watch dog interval: ", elem.systWatchdogInterval(5)) print("nhr10 watch dog interval: ", elem.systWatchdogInterval(0))
print("nhr10 ip: ",elem.getIp()) print("nhr10 ip: ",elem.getIp())
print("nhr10 max current: ", elem.instrumentCapCurrent()) print("nhr10 max current: ", elem.instrumentCapCurrent())
print("nhr10 current range: ", elem.instrumentCapCurrentRange()) print("nhr10 current range: ", elem.instrumentCapCurrentRange())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment