Skip to content

Commit 135f03a

Browse files
committed
Updating CLUE plotter
Updating the CLUE plotter with CP8 for upcoming PyLeap project. -Adding PlotSource to plot_source import (otherwise error is thrown when changing params with A button) -Changing some font spacing in plotter.py so that nothing is cut off
1 parent 95eb142 commit 135f03a

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

CLUE_Sensor_Plotter/code.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@
4242
import gc
4343
import board
4444

45+
from adafruit_clue import clue
46+
4547
from plotter import Plotter
48+
# pylint: disable=unused-import
4649
from plot_source import (
50+
PlotSource,
4751
TemperaturePlotSource,
4852
PressurePlotSource,
4953
HumidityPlotSource,
@@ -56,7 +60,6 @@
5660
MagnetometerPlotSource,
5761
PinPlotSource,
5862
)
59-
from adafruit_clue import clue
6063

6164
debug = 1
6265

@@ -243,6 +246,7 @@ def popup_text(plttr, text, duration=1.0):
243246
(8, "Range lock\n" + ("off" if range_lock else "on")),
244247
],
245248
)
249+
# pylint: disable=no-else-break
246250
if opt == 0: # change plot source
247251
current_source_idx = (current_source_idx + 1) % len(sources)
248252
break # to leave inner while and select the new source

CLUE_Sensor_Plotter/plotter.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,13 @@ def _make_empty_graph(self, tg_and_plot=None):
382382
color=self._y_lab_color,
383383
)
384384
self._displayio_title.x = self._screen_width - self._plot_width
385-
self._displayio_title.y = font_h // 2
385+
self._displayio_title.y = font_h // 1
386386

387387
self._displayio_y_axis_lab = Label(
388388
self._font, text=self._y_axis_lab, line_spacing=1, color=self._y_lab_color
389389
)
390390
self._displayio_y_axis_lab.x = 0 # 0 works here because text is ""
391-
self._displayio_y_axis_lab.y = font_h // 2
391+
self._displayio_y_axis_lab.y = font_h // 1
392392

393393
plot_y_labels = []
394394
# y increases top to bottom of screen
@@ -798,8 +798,8 @@ def info(self, value):
798798
self._displayio_graph.pop()
799799

800800
if value is not None and value != "":
801-
font_scale = 3
802-
line_spacing = 1.25
801+
font_scale = 2
802+
line_spacing = 1
803803

804804
font_w, font_h = self._font.get_bounding_box()
805805
text_lines = value.split("\n")
@@ -824,7 +824,7 @@ def info(self, value):
824824
self._displayio_info.x = (
825825
self._screen_width - font_scale * font_w * max_word_chars
826826
) // 2
827-
self._displayio_info.y = self._screen_height // 2
827+
self._displayio_info.y = self._screen_height // 3
828828
self._displayio_graph.append(self._displayio_info)
829829

830830
else:

0 commit comments

Comments
 (0)