Skip to content

Commit 5a5d57a

Browse files
committed
Updates for Sunton ESP32 2432S028 (Cheap Yellow Display) new CP firmware
1 parent ae42aa6 commit 5a5d57a

File tree

10 files changed

+62
-109
lines changed

10 files changed

+62
-109
lines changed

PyDOS.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def PyDOS():
6767
global envVars
6868
if "envVars" not in globals().keys():
6969
envVars = {}
70-
_VER = "1.33"
70+
_VER = "1.34"
7171
prmpVals = ['>','(',')','&','|','\x1b','\b','<','=',' ',_VER,'\n','$','']
7272

7373
print("Starting Py-DOS...")

cpython/CheapYellowDisplay/lib/pydos_bcfg.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

cpython/CheapYellowDisplay/lib/pydos_ui.py

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import board
2+
Pydos_pins = {
3+
'sndPin' : (board.SPEAKER,"SPEAKER"),
4+
'SCL' : (board.SCL,"SCL"),
5+
'SDA' : (board.SDA,"SDA"),
6+
'SCK' : [(board.SD_SCK,"SD_SCK")],
7+
'MISO' : [(board.SD_MISO,"SD_MISO")],
8+
'MOSI' : [(board.SD_MOSI,"SD_MOSI")],
9+
'CS' : [(board.SD_CS,"SD_CS")],
10+
'LED_RED' : (board.LED_RED,"LED_RED"),
11+
'LED_GREEN' : (board.LED_GREEN,"LED_GREEN"),
12+
'LED_BLUE' : (board.LED_BLUE,"LED_BLUE")
13+
}

cpython/cardputer/lib/m5stackcardputerkbd.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -173,24 +173,3 @@ def check_keyboard(self):
173173

174174
return new_char_buffer
175175

176-
# Exmple Usage:
177-
#
178-
#cardputer = Cardputer()
179-
180-
#while True:
181-
# print(cardputer.check_keyboard(),end="")
182-
183-
#s = None
184-
#l = None
185-
#o = None
186-
#while True:
187-
# ol = l
188-
# os = s
189-
# oo = o
190-
# a = cardputer.check_keyboard()
191-
# s = cardputer.shift
192-
# l = cardputer.shift_lock
193-
# o = cardputer.opt
194-
# if a != "" or s != os or l != ol or o != oo:
195-
# print(("opt" if o else " "),("lock" if l else " "),("shift" if s else " "),a)
196-

lib/pydos_bcfg.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@
8282
Pydos_pins['i2s_BitClock'] = (board.SPEAKER_SCK,"board.SPEAKER_SCK")
8383
Pydos_pins['i2s_WordSelect'] = (board.SPEAKER_WS,"board.SPEAKER_WS")
8484
Pydos_pins['i2s_Data'] = (board.SPEAKER_DOUT,"board.SPEAKER_DOUT")
85+
if 'LED_RED' in dir(board):
86+
Pydos_pins['LED_RED'] = (board.LED_RED,"LED_RED")
87+
if 'LED_GREEN' in dir(board):
88+
Pydos_pins['LED_GREEN'] = (board.LED_GREEN,"LED_GREEN")
89+
if 'LED_BLUE' in dir(board):
90+
Pydos_pins['LED_BLUE'] = (board.LED_BLUE,"LED_BLUE")
8591
if 'NEOPIXEL' in dir(board):
8692
Pydos_pins['neoPixel'] = (board.NEOPIXEL,"NEOPIXEL")
8793
if 'NEOPIXEL_POWER' in dir(board):

lib/pydos_ui.py

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
import uselect
88
elif implementation.name.upper() == "CIRCUITPYTHON":
99
from supervisor import runtime
10+
import board
11+
sizeFrmDisp = False
12+
if 'DISPLAY' in dir(board):
13+
try:
14+
import displayio
15+
import terminalio
16+
sizeFrmDisp = True
17+
except:
18+
pass
1019

1120
class PyDOS_UI:
1221

@@ -35,30 +44,34 @@ def read_keyboard(self,num):
3544
return stdin.read(num)
3645

3746
def get_screensize(self):
38-
print("Screen set to 24 rows, 80 col. Press any key to continue...",end="")
39-
stdout.write('\x1b[2K')
40-
stdout.write('\x1b[999;999H\x1b[6n')
41-
pos = ''
42-
char = ''
43-
try:
44-
char = stdin.read(1) ## expect ESC[yyy;xxxR
45-
except:
46-
return(24,80)
47-
if char != '\x1b':
48-
return(24,80)
47+
if sizeFrmDisp:
48+
height = round(board.DISPLAY.height/(terminalio.FONT.bitmap.height*displayio.CIRCUITPYTHON_TERMINAL.scale))-1
49+
width = round(board.DISPLAY.width/((terminalio.FONT.bitmap.width/95)*displayio.CIRCUITPYTHON_TERMINAL.scale))-2
50+
else:
51+
print("Screen set to 24 rows, 80 col. Press any key to continue...",end="")
52+
stdout.write('\x1b[2K')
53+
stdout.write('\x1b[999;999H\x1b[6n')
54+
pos = ''
55+
char = ''
56+
try:
57+
char = stdin.read(1) ## expect ESC[yyy;xxxR
58+
except:
59+
return(24,80)
60+
if char != '\x1b':
61+
return(24,80)
4962

50-
while char != 'R':
51-
pos += char
52-
char = stdin.read(1)
53-
print()
63+
while char != 'R':
64+
pos += char
65+
char = stdin.read(1)
66+
print()
5467

55-
width = int(pos.lstrip("\n\x1b[").split(';')[1],10)
56-
height = int(pos.lstrip("\n\x1b[").split(';')[0],10)
68+
width = int(pos.lstrip("\n\x1b[").split(';')[1],10)
69+
height = int(pos.lstrip("\n\x1b[").split(';')[0],10)
5770

58-
if width < 1:
59-
width = 80
60-
if height < 1:
61-
height = 24
71+
if width < 1:
72+
width = 80
73+
if height < 1:
74+
height = 24
6275

6376
return(height,width)
6477

lib/pydos_wifi.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,11 @@ def close(self):
289289
self._esp32_reset.deinit()
290290
self._spi.deinit()
291291
else:
292-
self._https._free_sockets()
292+
# Temporary until CP 8.x no longer supported
293+
try:
294+
self._https._free_sockets()
295+
except:
296+
pass
293297
self._https = None
294298
self._socket = None
295299
#self.response.close() Takes too long, effectivly hangs....

runvm.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ def pFmt(dPath,trailSlh=True):
112112
t.write(" print('****ERROR**** running '+'"+tmpDir+newdir+"')\n")
113113
t.write("os.chdir('/')\n")
114114
t.write("os.remove('/"+startupfile+".py')\n")
115-
t.write("os.rename('/"+startupfile+"._PyD','/"+startupfile+".py')\n")
115+
if startupfile+'._PyD' in os.listdir('/'):
116+
t.write("os.rename('/"+startupfile+"._PyD','/"+startupfile+".py')\n")
116117
t.write('print("\\n\\nIf PyDOS doesn'+"'"+'t start, press Ctrl-D at the >>> REPL prompt")\n')
117118
t.write('print("===========================================================\\n\\n")\n')
118119
if sys.implementation.name.upper() == "CIRCUITPYTHON":

setup.bat

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,21 +93,8 @@ set _ans2 = A
9393
goto skip_touchmsg
9494

9595
:not_cardputer
96-
if not "%_boardID%" == "adafruit_huzzah32_breakout" goto not_huzzah_bo
97-
set/p _cyd = Is this board a Cheap Yellow Display board (Y/N)?:
98-
if %_cyd% == N goto not_huzzah_bo
99-
if %_cyd% == n goto not_huzzah_bo
100-
if %_cyd% == Y goto copy_cyd
101-
if %_cyd% == y goto copy_cyd
102-
echo Invalid Selection (Y or N)
103-
goto not_cardputer
104-
:copy_cyd
105-
copy/y /cpython/CheapYellowDisplay/lib/*.py /lib/
106-
copy/y /cpython/kbdFeatherWing/lib/adafruit_ili9341.* /lib/
107-
goto tablet
108-
109-
:not_huzzah_bo
11096
if "%_boardID%" == "makerfabs_tft7" goto makerfabs_tablet
97+
if "%_boardID%" == "sunton_esp32_2432S028" goto tablet
11198
if "%_boardID%" == "espressif_esp32s3_devkitc_1_n8r8_hacktablet" goto tablet
11299
goto not_tablet
113100

0 commit comments

Comments
 (0)