diff --git a/POCloud_Driver/vfdipp.py b/POCloud_Driver/vfdipp.py index 717b89a..cfa90f7 100644 --- a/POCloud_Driver/vfdipp.py +++ b/POCloud_Driver/vfdipp.py @@ -117,6 +117,9 @@ class start(threading.Thread, deviceBase): print self.channels self.setupChannels() time.sleep(30) + def write_vfdconfig(self): + print("Writing config to drive") + return u800.writeMicroTag(addr, 'VFD_Write', 1) def vfdipp_sync(self, name, value): self.sendtodb("connected", "true", 0) @@ -140,7 +143,10 @@ class start(threading.Thread, deviceBase): def vfdipp_vfdnameplatefla(self, name, value): print('trying to set cfg_NameplateFLA to {0}'.format(value)) - return u800.writeMicroTag(addr, 'cfg_NameplateFLA', float(value)) + if u800.writeMicroTag(addr, 'cfg_NameplateFLA', float(value)): + return self.write_vfdconfig() + else: + return False def vfdipp_dhpressurestartup(self, name, value): print('trying to set DH_Pressure_Startup to {0}'.format(value)) @@ -152,7 +158,10 @@ class start(threading.Thread, deviceBase): def vfdipp_vfdmotorpoles(self, name, value): print('trying to set cfg_MotorPoles to {0}'.format(value)) - return u800.writeMicroTag(addr, 'cfg_MotorPoles', int(value)) + if u800.writeMicroTag(addr, 'cfg_MotorPoles', int(value)): + return self.write_vfdconfig() + else: + return False def vfdipp_tubingpressurealarmdelay(self, name, value): print('trying to set TubingPressure_Alarm_Delay to {0}'.format(value)) @@ -168,7 +177,10 @@ class start(threading.Thread, deviceBase): def vfdipp_vfdmaxfreq(self, name, value): print('trying to set cfg_MaxFreq to {0}'.format(value)) - return u800.writeMicroTag(addr, 'cfg_MaxFreq', float(value)) + if u800.writeMicroTag(addr, 'cfg_MaxFreq', float(value)): + return self.write_vfdconfig() + else: + return False def vfdipp_tubingpressurelosp(self, name, value): print('trying to set TubingPressure_Lo_SP to {0}'.format(value)) @@ -180,7 +192,10 @@ class start(threading.Thread, deviceBase): def vfdipp_vfdnameplateolcurrent(self, name, value): print('trying to set cfg_NameplateOLCurrent to {0}'.format(value)) - return u800.writeMicroTag(addr, 'cfg_NameplateOLCurrent', float(value)) + if u800.writeMicroTag(addr, 'cfg_NameplateOLCurrent', float(value)): + return self.write_vfdconfig() + else: + return False def vfdipp_offmode(self, name, value): print('trying to set Off_Mode to {0}'.format(value)) @@ -208,7 +223,10 @@ class start(threading.Thread, deviceBase): def vfdipp_vfdnameplaterpm(self, name, value): print('trying to set cfg_NameplateRPM to {0}'.format(value)) - return u800.writeMicroTag(addr, 'cfg_NameplateRPM', float(value)) + if u800.writeMicroTag(addr, 'cfg_NameplateRPM', float(value)): + return self.write_vfdconfig() + else: + return False def vfdipp_vfdspeedref(self, name, value): print('trying to set VFD_SpeedRef to {0}'.format(value)) @@ -236,7 +254,10 @@ class start(threading.Thread, deviceBase): def vfdipp_vfdnameplatevolts(self, name, value): print('trying to set cfg_NameplateVolts to {0}'.format(value)) - return u800.writeMicroTag(addr, 'cfg_NameplateVolts', float(value)) + if u800.writeMicroTag(addr, 'cfg_NameplateVolts', float(value)): + return self.write_vfdconfig() + else: + return False def vfdipp_downholetoolenabled(self, name, value): print('trying to set Downhole_Tool_Enabled to {0}'.format(value)) @@ -244,7 +265,10 @@ class start(threading.Thread, deviceBase): def vfdipp_vfdnameplatehz(self, name, value): print('trying to set cfg_NameplateHz to {0}'.format(value)) - return u800.writeMicroTag(addr, 'cfg_NameplateHz', float(value)) + if u800.writeMicroTag(addr, 'cfg_NameplateHz', float(value)): + return self.write_vfdconfig() + else: + return False def vfdipp_tubingpressuretransducerenabled(self, name, value): print('trying to set TubingPressure_Transducer_Enabled to {0}'.format(value)) @@ -256,11 +280,17 @@ class start(threading.Thread, deviceBase): def vfdipp_vfdnameplatehp(self, name, value): print('trying to set cfg_NameplateHP to {0}'.format(value)) - return u800.writeMicroTag(addr, 'cfg_NameplateHP', float(value)) + if u800.writeMicroTag(addr, 'cfg_NameplateHP', float(value)): + return self.write_vfdconfig() + else: + return False def vfdipp_vfdminfreq(self, name, value): print('trying to set cfg_MinFreq to {0}'.format(value)) - return u800.writeMicroTag(addr, 'cfg_MinFreq', float(value)) + if u800.writeMicroTag(addr, 'cfg_MinFreq', float(value)): + return self.write_vfdconfig() + else: + return False def vfdipp_startcommand(self, name, value): print('trying to set Start_Command to 1')