Skip to content

Commit ab7fa0e

Browse files
committed
fix word wrap helper, allow use without a URL (no internet usage), touchscreen pins
1 parent b819091 commit ab7fa0e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

adafruit_pyportal.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def __init__(self, *, url=None, json_path=None, regexp_path=None,
189189
esp32_cs = DigitalInOut(board.ESP_CS)
190190
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
191191

192-
if not self._uselocal:
192+
if url and not self._uselocal:
193193
self._esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready,
194194
esp32_reset, esp32_gpio0)
195195
#self._esp._debug = 1
@@ -229,7 +229,7 @@ def __init__(self, *, url=None, json_path=None, regexp_path=None,
229229

230230
if self._debug:
231231
print("Init display")
232-
self.splash = displayio.Group(max_size=5)
232+
self.splash = displayio.Group(max_size=15)
233233
board.DISPLAY.show(self.splash)
234234

235235
if self._debug:
@@ -305,10 +305,8 @@ def __init__(self, *, url=None, json_path=None, regexp_path=None,
305305
if self._debug:
306306
print("Init touchscreen")
307307
# pylint: disable=no-member
308-
self.touchscreen = adafruit_touchscreen.Touchscreen(microcontroller.pin.PB01,
309-
microcontroller.pin.PB08,
310-
microcontroller.pin.PA06,
311-
microcontroller.pin.PB00,
308+
self.touchscreen = adafruit_touchscreen.Touchscreen(board.TOUCH_XL, board.TOUCH_XR,
309+
board.TOUCH_YD, board.TOUCH_YU,
312310
calibration=((5200, 59000),
313311
(5800, 57000)),
314312
size=(320, 240))
@@ -805,7 +803,9 @@ def wrap_nicely(string, max_chars):
805803
the_line = ""
806804
for w in words:
807805
if len(the_line+' '+w) <= max_chars:
808-
the_line += ' '+w
806+
if the_lines:
807+
the_line += ' '
808+
the_line += w
809809
else:
810810
the_lines.append(the_line)
811811
the_line = ''+w

0 commit comments

Comments
 (0)