import os
import sys
import mip
import machine
class RAMBlockDev:
def __init__(self, block_size, num_blocks):
self.block_size = block_size
self.data = bytearray(block_size * num_blocks)
def readblocks(self, block_num, buf):
for i in range(len(buf)):
buf[i] = self.data[block_num * self.block_size + i]
def writeblocks(self, block_num, buf):
for i in range(len(buf)):
self.data[block_num * self.block_size + i] = buf[i]
def ioctl(self, op, arg):
if op == 4: # get number of blocks
return len(self.data) // self.block_size
if op == 5: # get block size
return self.block_size
class clsMain:
def __init__(self, debug=False):
self.debug = debug
def main(self):
print("Hello, ESP32!")
#mip.install("https://github.com/karlsoderby/upython-chat-gpt/blob/main/lib/ssd1306.py")
self.littleFSaanmaken()
def littleFSaanmaken(self):
import os
os.umount('/')
os.VfsLfs2.mkfs(bdev)
os.mount(bdev, '/')
print("littleFSaanmaken gedaan")
if __name__ == '__main__':
print("App start")
main1 = clsMain()
main1.DEBUGMODE = False
result1 = main1.main()
print("App einde")