Skip to content

Commit

Permalink
power on warning
Browse files Browse the repository at this point in the history
  • Loading branch information
ejkaplan committed Mar 14, 2024
1 parent fc15aa3 commit 7c5772d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions elkplot/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,8 @@ def pen_up(self):
def pen_down(self):
"""Lower the pen"""
return self._command("SP", 0, self.pen_down_delay, self.pen_lift_pin)

def powered_on(self):
stepper, motor = (int(elem) for elem in self._command("QC").split(","))
self._readline()
return stepper > 200 and motor > 200
5 changes: 4 additions & 1 deletion elkplot/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,13 @@ def draw(
f"Drawing has bounds ({min_x}, {min_y}) to ({max_x}, {max_y}), which extends outside the plottable bounds (0, 0) to ({width}, {height})"
)
if not elkplot.device.axidraw_available():
raise AxidrawNotFoundError()
raise AxidrawNotFoundError("Unable to communicate with device. Is the USB cable plugged in?")
device = elkplot.Device() if device is None else device
if not device.powered_on():
raise AxidrawNotFoundError("Motors do not have power. Is the AxiDraw plugged in and turned on?")
device.zero_position()
device.enable_motors()
device.pen_up()
for layer, label in zip(layers, layer_labels):
input(f"Press enter when you're ready to draw {label}")
for _ in range(retrace):
Expand Down

0 comments on commit 7c5772d

Please sign in to comment.