Skip to content

Commit 2d5fec8

Browse files
committed
- fixes fill artifact during recording caused by None values
- Orbiter roast time on export excludes cooling
1 parent 01873c0 commit 2d5fec8

5 files changed

Lines changed: 34 additions & 19 deletions

File tree

src/artisanlib/canvas.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4833,10 +4833,10 @@ def sample_processing(self, local_flagstart:bool, temp1_readings:list[float], te
48334833
# update extra lines
48344834
if local_flagstart:
48354835
if self.aw.extraCurveVisibility1[i] and len(self.extratemp1lines) > xtra_dev_lines1 and self.extratemp1lines[xtra_dev_lines1] is not None:
4836-
self.extratemp1lines[xtra_dev_lines1].set_data(sample_extractimex1[i], numpy.array(sample_extractemp1[i]))
4836+
self.extratemp1lines[xtra_dev_lines1].set_data(numpy.array(sample_extractimex1[i]), numpy.array(sample_extractemp1[i]))
48374837
xtra_dev_lines1 = xtra_dev_lines1 + 1
48384838
if self.aw.extraCurveVisibility2[i] and len(self.extratemp2lines) > xtra_dev_lines2 and self.extratemp2lines[xtra_dev_lines2] is not None:
4839-
self.extratemp2lines[xtra_dev_lines2].set_data(sample_extractimex2[i], numpy.array(sample_extractemp2[i]))
4839+
self.extratemp2lines[xtra_dev_lines2].set_data(numpy.array(sample_extractimex2[i]), numpy.array(sample_extractemp2[i]))
48404840
xtra_dev_lines2 = xtra_dev_lines2 + 1
48414841
#ERROR FOUND
48424842
else:
@@ -5696,7 +5696,15 @@ def updategraphics(self) -> None:
56965696
try:
56975697
fill1 = self.extrafill1lines[xtra_dev_lines1]
56985698
if fill1 is not None:
5699-
fill1.set_verts([self.vertices_between(line1.get_xdata(), line1.get_ydata(), 0)])
5699+
l1x = line1.get_xdata()
5700+
l1y = line1.get_ydata()
5701+
assert isinstance(l1x, numpy.ndarray)
5702+
assert isinstance(l1y, numpy.ndarray)
5703+
fill1.set_verts([self.vertices_between(
5704+
# we need to filter out None values from the (temp) data to avoid collapses of the fill
5705+
l1x[l1y != None], # noqa: E711 # pylint: disable=singleton-comparison
5706+
l1y[l1y != None], # noqa: E711 # pylint: disable=singleton-comparison
5707+
0)])
57005708
self.ax.draw_artist(fill1)
57015709
except Exception as e: # pylint: disable=broad-except
57025710
_log.exception(e)
@@ -5710,7 +5718,15 @@ def updategraphics(self) -> None:
57105718
try:
57115719
fill2 = self.extrafill2lines[xtra_dev_lines2]
57125720
if fill2 is not None:
5713-
fill2.set_verts([self.vertices_between(line2.get_xdata(), line2.get_ydata(), 0)])
5721+
l2x = line2.get_xdata()
5722+
l2y = line2.get_ydata()
5723+
assert isinstance(l2x, numpy.ndarray)
5724+
assert isinstance(l2y, numpy.ndarray)
5725+
fill2.set_verts([self.vertices_between(
5726+
# we need to filter out None values from the (temp) data to avoid collapses of the fill
5727+
l2x[l2y != None], # noqa: E711 # pylint: disable=singleton-comparison
5728+
l2y[l2y != None], # noqa: E711 # pylint: disable=singleton-comparison
5729+
0)])
57145730
self.ax.draw_artist(fill2)
57155731
except Exception as e: # pylint: disable=broad-except
57165732
_log.exception(e)
@@ -6563,7 +6579,6 @@ def last_registered_foreground_event(event_type:int) -> int|None:
65636579
next_event_temp:float|None = None
65646580
current_temp:float|None = None
65656581

6566-
# for ramp by BT only after TP
65676582
if (last_event_temp2 is not None and (self.replayType == 1 or (self.replayType == 3 and value_decreasing)) and len(self.temp2)>1 and self.temp2[-1] != -1 and
65686583
self.temp2[-2] != -1 and self.temp2[-1] >= self.temp2[-2] and
65696584
len(self.temp2B) > bge):
@@ -11188,7 +11203,7 @@ def redraw(self, recomputeAllDeltas:bool = True, re_smooth_foreground:bool = Tru
1118811203
sketch_params=None))
1118911204
else:
1119011205
self.extrafill1lines.append(None)
11191-
self.extratemp1lines.append(self.ax.plot(self.extratimex[i],visible_extratemp1,transform=trans,color=self.extradevicecolor1[i],
11206+
self.extratemp1lines.append(self.ax.plot(numpy.array(self.extratimex[i]),visible_extratemp1,transform=trans,color=self.extradevicecolor1[i],
1119211207
sketch_params=None,
1119311208
path_effects=self.line_path_effects(self.glow, self.patheffects, self.aw.light_background_p, self.extralinewidths1[i],self.extradevicecolor1[i]),
1119411209
markersize=self.extramarkersizes1[i],
@@ -11244,7 +11259,7 @@ def redraw(self, recomputeAllDeltas:bool = True, re_smooth_foreground:bool = Tru
1124411259
sketch_params=None))
1124511260
else:
1124611261
self.extrafill2lines.append(None)
11247-
self.extratemp2lines.append(self.ax.plot(self.extratimex[i],visible_extratemp2,transform=trans,color=self.extradevicecolor2[i],
11262+
self.extratemp2lines.append(self.ax.plot(numpy.array(self.extratimex[i]),visible_extratemp2,transform=trans,color=self.extradevicecolor2[i],
1124811263
sketch_params=None,
1124911264
path_effects=self.line_path_effects(self.glow, self.patheffects, self.aw.light_background_p, self.extralinewidths2[i],self.extradevicecolor2[i]),
1125011265
markersize=self.extramarkersizes2[i],

src/artisanlib/orbiter.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ async def read_msg(self, stream: asyncio.StreamReader|IteratorReader) -> None:
203203
dashboard_state = data[3:5]
204204
dashboard_state_low = dashboard_state[0]
205205
#
206+
# self.isRoaster_Cooling = self.test_bit(dashboard_state_low, 3)
206207
self.isRoaster_Roasting = self.test_bit(dashboard_state_low, 2)
207208
# if self.isRoaster_Roasting:
208209
# _log.debug("isRoaster_Roasting")
@@ -565,7 +566,8 @@ def saveOrbiter(filename:str, outfile:IO[bytes], profile:ProfileData) -> bool:
565566
FCs:bool = False
566567
SCs:bool = False
567568
DROP:bool = False
568-
CHARGE_idx = (timeindex[0] if timeindex[0]>=0 else 0)
569+
CHARGE_idx = max(0, (timeindex[0] if timeindex[0]>=0 else 0))
570+
DROP_idx = max(0, (timeindex[6] if timeindex[6]>0 else len(timex) - 1))
569571
for idx,tx in enumerate(timex):
570572
if not (DROP or (timeindex[0] > -1 and tx < timex[timeindex[0]])): # ignore all readings before CHARGE and after DROP
571573
if len(specialevents)>0 and idx >= specialevents[0]:
@@ -623,7 +625,7 @@ def saveOrbiter(filename:str, outfile:IO[bytes], profile:ProfileData) -> bool:
623625
title_length:int = 30
624626
title_bytes = to_ascii(title).encode('utf-8')[:title_length].ljust(title_length, b'\00')
625627
preheat_temperature = int(round(temp2[CHARGE_idx] if len(temp2)>CHARGE_idx else 0))
626-
total_time_seconds:int = int(round((timex[-1] if len(timex)>0 else 0) - (timex[CHARGE_idx] if len(timex)>CHARGE_idx else 0)))
628+
total_time_seconds:int = (int(round(timex[DROP_idx] - timex[CHARGE_idx])) if len(timex)>DROP_idx and len(timex)>CHARGE_idx and DROP_idx>CHARGE_idx else 0)
627629
header = b'\xff\xff'
628630
# header
629631
header_data = b'\x00\x00' + \

src/requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ types-qrcode>=8.2.0.20260408
1616
lxml-stubs>=0.5.1
1717
mypy==1.20.0
1818
pyright==1.1.408
19-
ruff>=0.15.9
19+
ruff>=0.15.10
2020
pylint==4.0.5
2121
pre-commit>=4.5.1
2222
pytest>=9.0.3

src/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
setuptools==82.0.1
3030
wheel==0.46.3
3131
pyserial==3.5
32-
pymodbus==3.12.0
32+
pymodbus==3.13.0
3333
python-snap7==2.1.0
3434
Phidget22==1.25.20260408
3535
Unidecode==1.4.0
@@ -99,8 +99,8 @@ SecretStorage==3.5.0; platform_system=='Linux'
9999
########
100100
### Windows specific packages
101101
###
102-
build==1.4.0; platform_system=='Windows'
102+
build==1.4.3; platform_system=='Windows'
103103
pywin32==311; platform_system=='Windows'
104-
pyinstaller-versionfile==3.0.1; platform_system=='Windows'
104+
pyinstaller-versionfile==3.1.0; platform_system=='Windows'
105105
#libusb-package==1.0.26.3; platform_system=='Windows' # temp removed for Py 3.14, monkey patched into .appveyor.yml until a Py3.14 wheel is available on pypi
106106
tzdata==2026.1; platform_system=='Windows' # to prevent pyinstaller WARNING: Hidden import "tzdata" not found!

wiki/HowToRunFromSource.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# How to run Artisan from source
22

33
____
4-
**Important: Artisan is licensed under [The GNU General Public License](https://www.gnu.org/licenses/gpl-3.0.html). Copies of Artisan and derivative works are subject to this license. Be sure to review the license to understand your legal obligations and please respect them.**
4+
**Important: Artisan is licensed under [The GNU General Public License](https://www.gnu.org/licenses/gpl-3.0.html). Copies of Artisan and derivative works are subject to this license. Be sure to review the license to understand your legal obligations and please respect them.**
55
____
66

77
### Introduction
88

9-
Artisan provides install packages for all supported platforms on [GitHub](https://github.com/artisan-roaster-scope/artisan/releases). However, some users may desire to run Artisan directly from the source code. This document explains how to do so on macOS, Linux and Windows.
9+
Artisan provides install packages for all supported platforms on [GitHub](https://github.com/artisan-roaster-scope/artisan/releases). However, some users may desire to run Artisan directly from the source code. This document explains how to do so on macOS, Linux and Windows.
1010

1111
While this document is presumed free of errors as of January 2024, there is no guarantee that it is correct as you read it. If you find an error or discrepancy please start a [new general discussion](https://github.com/artisan-roaster-scope/artisan/discussions/new?category=general) on GitHub.
1212

@@ -15,7 +15,7 @@ While this document is presumed free of errors as of January 2024, there is no g
1515

1616
1. Install git from [scm-git.com](https://git-scm.com/downloads)
1717

18-
2. Install Python 3.11 from [python.org](https://www.python.org/)
18+
2. Install Python 3.12 from [python.org](https://www.python.org/)
1919

2020
>*Note for Windows: Python may be installed from the Microsoft Store or by direct download from the link above. When installed from the Microsoft Store it is normally started using `python3` as shown below. When Python is installed by direct download it is normally started with the command `python`. Also note, the Windows command prompt is '>' where the macOS/Linux prompt is '#' as shown below.*
2121
@@ -71,7 +71,7 @@ While this document is presumed free of errors as of January 2024, there is no g
7171
7272
[comment]: # (When restoring change the nu,ber below to '7')
7373
74-
6. Start Artisan from the artisan/src directory.
74+
6. Start Artisan from the artisan/src directory.
7575
7676
```
7777
# python3 artisan.py
@@ -136,5 +136,3 @@ Coverage (types, tests)
136136
# coverage run -m pytest
137137
# coverage-badge -o coverage.svg
138138
```
139-
140-

0 commit comments

Comments
 (0)