Skip to content

Commit

Permalink
revert Arc comm
Browse files Browse the repository at this point in the history
  • Loading branch information
MAKOMO committed Feb 18, 2022
1 parent 2e21e3e commit 8f84077
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 21 deletions.
31 changes: 18 additions & 13 deletions src/artisanlib/comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1296,16 +1296,18 @@ def ARDUINOTC4_78(self): # PID SV / internal temp

def ARC_BTET(self):
tx = self.aw.qmc.timeclock.elapsedMilli()
# t2,t1 = self.ARDUINOTC4temperature("3400") # t1 = chan4 (ET/Drum); t2 = chan3 (BT)
t2,t1 = self.ARDUINOTC4temperature("3412") # t1 = chan4 (ET/Drum); t2 = chan3 (BT); t3 = chan1 (MET/Exhaust); t4 = chan2 (IT)
t2,t1 = self.ARDUINOTC4temperature("3400") # t1 = chan4 (ET/Drum); t2 = chan3 (BT)
# if the machine would return 4 channel (see comment in ARC_BTET above, one could fetch data with two requests (still a CHAN is needed before every READ!)
# t2,t1 = self.ARDUINOTC4temperature("3412") # t1 = chan4 (ET/Drum); t2 = chan3 (BT); t3 = chan1 (MET/Exhaust); t4 = chan2 (IT)
return tx,t1,t2 # tx, ET, BT

def ARC_METIT(self):
tx = self.aw.qmc.timeclock.elapsedMilli()
# self.SP = self.aw.ser.SP # we link to the serial port object of the main device
# t1,t2 = self.ARDUINOTC4temperature("1200") # t1 = chan1 (MET/Exhaust); t2 = chan2 (IT)
t1 = self.aw.qmc.extraArduinoT1
t2 = self.aw.qmc.extraArduinoT2
self.SP = self.aw.ser.SP # we link to the serial port object of the main device
t1,t2 = self.ARDUINOTC4temperature("1200") # t1 = chan1 (MET/Exhaust); t2 = chan2 (IT)
# if the machine would return 4 channel (see comment in ARC_BTET above, one could fetch data with two requests (still a CHAN is needed before every READ!)
# t1 = self.aw.qmc.extraArduinoT1
# t2 = self.aw.qmc.extraArduinoT2
return tx,t2,t1 # tx, Extra2 (IT), Extra1 (MET)

def HB_BTET(self):
Expand Down Expand Up @@ -5563,7 +5565,7 @@ def ARDUINOTC4temperature(self,chan=None):
self.ArduinoIsInitialized = 0
if self.SP.isOpen():
#INITIALIZE (ONLY ONCE)
if not self.ArduinoIsInitialized:# or chan is not None:
if not self.ArduinoIsInitialized or chan is not None:
self.SP.reset_input_buffer()
self.SP.reset_output_buffer()
#build initialization command
Expand Down Expand Up @@ -5603,9 +5605,6 @@ def ARDUINOTC4temperature(self,chan=None):
settings = str(self.comport) + "," + str(self.baudrate) + "," + str(self.bytesize)+ "," + str(self.parity) + "," + str(self.stopbits) + "," + str(self.timeout)
self.aw.addserial("ArduinoTC4: " + settings + " || Tx = " + str(command) + " || Rx = " + str(result))

# _log.debug("command: %s",command)
# _log.debug("result: %s",result)

if result.startswith("#") and chan is None:
#OK. NOW SET UNITS
self.SP.reset_input_buffer()
Expand Down Expand Up @@ -5638,8 +5637,10 @@ def ARDUINOTC4temperature(self,chan=None):
libtime.sleep(.1)
rl = self.SP.readline().decode('utf-8', 'ignore')[:-2]
res = rl.rsplit(',')

# _log.debug("command: %s",command)
# _log.debug("res: %s",res)

#response: list ["t0","t1","t2"] with t0 = internal temp; t1 = ET; t2 = BT on "CHAN;1200"
#response: list ["t0","t1","t2","t3","t4"] with t0 = internal temp; t1 = ET; t2 = BT, t3 = chan3, t4 = chan4 on "CHAN;1234" if ArduinoTC4_34 is configured
# after PID_ON: + [,"Heater", "Fan", "SV"]
Expand Down Expand Up @@ -5730,16 +5731,20 @@ def ARDUINOTC4temperature(self,chan=None):
self.aw.qmc.extraArduinoT3 = float(res[0])
elif (28 in self.aw.qmc.extradevices and 32 in self.aw.qmc.extradevices) and self.aw.ser.arduinoATChannel == "T6":
self.aw.qmc.extraArduinoT4 = float(res[0])
if chan is not None and len(res) == 4:
if res[3] == "F" and self.aw.qmc.mode != "F":
if chan is not None:
if ((len(res)==4 and res[3] == "F") or (len(res)==6 and res[5] == "F")) and self.aw.qmc.mode != "F":
# data is given in F, we convert it back to C
t1 = fromFtoC(t1)
t2 = fromFtoC(t2)
self.aw.qmc.extraArduinoT1 = fromFtoC(self.aw.qmc.extraArduinoT1)
self.aw.qmc.extraArduinoT2 = fromFtoC(self.aw.qmc.extraArduinoT2)
self.aw.qmc.extraArduinoT6 = fromFtoC(self.aw.qmc.extraArduinoT6)
elif res[3] != "F" and self.aw.qmc.mode == "F":
elif ((len(res)==4 and res[3] != "F") or (len(res)==6 and res[5] != "F")) and self.aw.qmc.mode == "F":
# data is given in C, we convert it back to F
t1 = fromCtoF(t1)
t2 = fromCtoF(t2)
self.aw.qmc.extraArduinoT1 = fromCtoF(self.aw.qmc.extraArduinoT1)
self.aw.qmc.extraArduinoT2 = fromCtoF(self.aw.qmc.extraArduinoT2)
self.aw.qmc.extraArduinoT6 = fromCtoF(self.aw.qmc.extraArduinoT6)
return t1, t2
except Exception as e: # pylint: disable=broad-except
Expand Down
2 changes: 1 addition & 1 deletion src/includes/Machines/Arc/800_RTD.aset
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extradevicecolor2=#2086bb, black
extradevices=127, 128
extramathexpression1=,
extramathexpression2=,
extraname1=MET, AT
extraname1=Exhaust, AT
extraname2=Inlet, Extra 2

[SerialPort]
Expand Down
2 changes: 1 addition & 1 deletion src/includes/Machines/Arc/S_RTD.aset
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extradevicecolor2=#2086bb, black
extradevices=127, 128
extramathexpression1=,
extramathexpression2=,
extraname1=MET, AT
extraname1=Exhaust, AT
extraname2=Inlet, Extra 2

[SerialPort]
Expand Down
13 changes: 7 additions & 6 deletions src/includes/Machines/HB/Model_S.aset
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
[General]
AmbientTempSource=5
Delay=4000
Delay=2000
Oversampling=false
dropDuplicates=true
dropDuplicatesLimit=0.1
roastertype_setup=HB Model S
ETfunction=

[Device]
id=115
id=126

[ExtraComm]
extrabaudrate=9600, 9600
extrabaudrate= 115200, 115200
extrabytesize=8, 8
extracomport=COM1, COM1
extraparity=E, E
extrastopbits=1, 1
extratimeout=0.5, 0.5
extratimeout=0.4, 0.4

[ExtraDev]
extraCurveVisibility1=true, false, true, true, true, true, true, true, true, true
Expand All @@ -28,10 +29,10 @@ extraLCDvisibility1=true, true, false, false, false, false, false, false, false,
extraLCDvisibility2=true, false, false, false, false, false, false, false, false, false
extradevicecolor1=#49b160, black
extradevicecolor2=#2086bb, black
extradevices=116, 117
extradevices=127, 128
extramathexpression1=,
extramathexpression2=,
extraname1=Drum, AT
extraname1=Exhaust, AT
extraname2=Inlet, Extra 2

[SerialPort]
Expand Down
1 change: 1 addition & 0 deletions src/includes/Machines/HB/Standard.aset
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Oversampling=false
dropDuplicates=true
dropDuplicatesLimit=0.1
roastertype_setup=HB Standard
ETfunction=

[Device]
id=115
Expand Down

0 comments on commit 8f84077

Please sign in to comment.