Skip to content

Commit a433c46

Browse files
committed
- disable Kaleido machine state DROP synchronization for the first 7min into the roast and enable undo of the DROP action (Issue #1808)
- disables playback of DROP event, only active after CHARGE, for the first 7min into the roast
1 parent 072e436 commit a433c46

39 files changed

+42446
-42437
lines changed

src/artisanlib/canvas.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -4779,10 +4779,10 @@ def sample_processing(self, local_flagstart:bool, temp1_readings:List[float], te
47794779
except Exception as e: # pylint: disable=broad-except
47804780
_log.exception(e)
47814781
# autodetect DROP event
4782-
# only if 8min into roast and BT>160C/320F
4783-
if self.autoDropIdx == 0 and self.autoDropFlag and self.autoDROPenabled and self.timeindex[0] > -1 and not self.timeindex[6] and \
4782+
# only if 7min into roast and BT>160C/320F
4783+
if self.autoDropIdx == 0 and self.autoDropFlag and self.autoDROPenabled and self.timeindex[0] > -1 and self.timeindex[6] == 0 and \
47844784
length_of_qmc_timex >= 5 and ((self.mode == 'C' and sample_temp2[-1] > 160) or (self.mode == 'F' and sample_temp2[-1] > 320)) and\
4785-
((sample_timex[-1] - sample_timex[self.timeindex[0]]) > 420):
4785+
((sample_timex[-1] - sample_timex[self.timeindex[0]]) > 7*60):
47864786
b = self.aw.BTbreak(length_of_qmc_timex - 1,event='DROP') # call BTbreak with last index
47874787
if b > 0:
47884788
# we found a BT break at the current index minus b
@@ -5881,14 +5881,17 @@ def processAlarm(self,number:int, beep:bool, action:int, string:str) -> None:
58815881
_, _, exc_tb = sys.exc_info()
58825882
self.adderror((QApplication.translate('Error Message','Exception:') + ' processAlarm() {0}').format(str(ex)),getattr(exc_tb, 'tb_lineno', '?'))
58835883

5884-
# called only after CHARGE
5884+
# called only after CHARGE with at least 7min into the roast
58855885
def playbackdrop(self) -> None:
58865886
try:
58875887
#needed when using device NONE
5888-
if (self.autoDropIdx == 0 and self.timex and self.timeindexB[6] and not self.timeindex[6] and
5888+
if (self.timeindex[0] > -1 and self.autoDropIdx == 0 and self.timex and self.timeindexB[6]>0 and self.timeindex[6] == 0 and
5889+
(self.timex[-1] - self.timex[self.timeindex[0]]) > 7*60 and
58895890
((self.replayType == 0 and self.timeB[self.timeindexB[6]] - self.timeclock.elapsed()/1000. <= 0) or # by time
5890-
(self.replayType == 1 and self.TPalarmtimeindex and self.ctemp2[-1] is not None and self.stemp2B[self.timeindexB[6]] - self.ctemp2[-1] <= 0) or # by BT
5891-
(self.replayType == 2 and self.TPalarmtimeindex and self.ctemp1[-1] is not None and self.stemp1B[self.timeindexB[6]] - self.ctemp1[-1] <= 0))): # by ET
5891+
(self.replayType == 1 and len(self.ctemp2)>0 and len(self.stemp2B)>self.timeindexB[6] and # pylint: disable=chained-comparison
5892+
self.TPalarmtimeindex and self.ctemp2[-1] is not None and self.stemp2B[self.timeindexB[6]] - self.ctemp2[-1] <= 0) or # by BT
5893+
(self.replayType == 2 and len(self.ctemp1)>0 and len(self.stemp1B)>self.timeindexB[6] and # pylint: disable=chained-comparison
5894+
self.TPalarmtimeindex and self.ctemp1[-1] is not None and self.stemp1B[self.timeindexB[6]] - self.ctemp1[-1] <= 0))): # by ET
58925895
self.autoDropIdx = len(self.timex) - 2
58935896
self.markDropSignal.emit(False)
58945897
except Exception as ex: # pylint: disable=broad-except
@@ -14703,7 +14706,7 @@ def markDrop(self, noaction:bool = False) -> None:
1470314706
# we check if this is the first DROP mark on this roast
1470414707
firstDROP = self.timeindex[6] == 0 # on UNDO DROP we do not send the record to plus
1470514708
if self.aw.buttonDROP.isFlat() and self.timeindex[6] > 0:
14706-
self.autoDropIdx = -1 # disable autoCharge to allow manual re-CHARGE
14709+
self.autoDropIdx = -1 # disable autoDROP to allow manual re-DROP
1470714710
# undo wrongly set FCs
1470814711
# deactivate autoDROP
1470914712
self.autoDROPenabled = False

src/artisanlib/comm.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1794,7 +1794,11 @@ def Kaleido_BTET(self) -> Tuple[float,float,float]:
17941794
self.aw.qmc.markSCsSignal.emit(True) # SCs
17951795
elif event_flag == 7 and self.aw.qmc.timeindex[5] == 0:
17961796
self.aw.qmc.markSCeSignal.emit(True) # SCe
1797-
elif event_flag == 8 and self.aw.qmc.timeindex[6] == 0:
1797+
elif (event_flag == 8 and self.aw.qmc.timeindex[6] == 0 and
1798+
self.aw.qmc.timeindex[0] > -1 and self.aw.qmc.autoDropIdx == 0 and
1799+
(self.aw.qmc.timex[-1] - self.aw.qmc.timex[self.aw.qmc.timeindex[0]]) > 7*60):
1800+
# only after 7min into the roast and if CHARGE is marked
1801+
self.aw.qmc.autoDropIdx = len(self.aw.qmc.timex) - 2
17981802
self.aw.qmc.markDropSignal.emit(True) # DROP
17991803
elif event_flag == 9 and self.aw.qmc.timeindex[7] == 0:
18001804
self.aw.qmc.markCoolSignal.emit(True) # COOL

src/requirements-dev.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ types-docutils>=0.21.0.20241128
1313
lxml-stubs>=0.5.1
1414
mypy==1.15.0
1515
pyright==1.1.398
16-
ruff>=0.11.3
16+
ruff>=0.11.4
1717
pylint==3.3.6
1818
pre-commit>=4.2.0
1919
pytest>=8.3.5
20-
pytest-cov==6.0.0
20+
pytest-cov==6.1.1
2121
#pytest-qt==4.4.0
2222
#pytest-xvfb==3.0.0
2323
#PyVirtualDisplay==3.0
2424
#pytest-asyncio==0.23.3
2525
#pytest-bdd==6.1.1
2626
#pytest-benchmark==4.0.0
2727
#pytest-mock==3.11.1
28-
hypothesis>=6.130.8
28+
hypothesis>=6.130.9
2929
coverage>=7.8.0
3030
coverage-badge==1.1.2
3131
codespell==2.4.1

0 commit comments

Comments
 (0)