Beispiel #1
0
 def isotasupported(self):
     try:
         p1 = esp32.Partition(esp32.Partition.RUNNING).get_next_update()
         return p1
     except:
         pass
     return False
Beispiel #2
0
 def getrunningpart(self):
     try:
         p1 = esp32.Partition(esp32.Partition.RUNNING)
         return p1.info()
     except:
         pass
     return None
Beispiel #3
0
 def getbootpart(self):
     try:
         p1 = esp32.Partition(esp32.Partition.BOOT)
         return p1.info()
     except:
         return self.getrunningpart()
     return None
Beispiel #4
0
 def initota(self):
     try:
         self.part = esp32.Partition(
             esp32.Partition.RUNNING).get_next_update()
     except:
         self.part = None
     if self.part is not None and self.part:
         self.success = True
     else:
         self.success = False
Beispiel #5
0
# Configure the RGB LED
pixel = NeoPixel(Pin(tinys2.RGB_DATA), 1)  # Just one RGB LED

# Turn on the power to the DotStar
tinys2.set_pixel_power(True)

# Say hello
print("\nHello from TinyS2!")
print("------------------\n")

# Show available memory
print("Memory Info - gc.mem_free()")
print("---------------------------")
print("{} Bytes\n".format(gc.mem_free()))

p = esp32.Partition('vfs')
flash_size = p.ioctl(4, 0) * p.ioctl(5, 0)

# Show flash size
print("Flash - esp32.Partition('vfs')")
print("------------------------------")
print("Size: {} Bytes\n".format(flash_size))

# Show VBAT and VBUS sense
print("VBAT Voltage {}V\n".format(tinys2.get_battery_voltage()))
print("VBUS Sense - 5V present? {}\n".format(
    "Yes" if tinys2.get_vbus_present() else "No"))

# Create a colour wheel index int
color_index = 0
Beispiel #6
0
# print hello-world
log.warning("\n\n")
_uname = os.uname()
log.warning("MicroPython %s (%s)", _uname.release, _uname.version)
log.warning(_uname.machine)
_u = str(board.mqtt.get("user", "esp32"))
log.warning("%s %s starting at %s\n", _u, str(board.location),
            time.localtime())
del _u
del _uname

# log some info
if sys.platform == 'esp32':
    import esp32
    log.warning("Boot partition: %s",
                esp32.Partition(esp32.Partition.RUNNING).info()[4])
_sf = "SAFE MODE boot "
if not "_safestate" in globals():  # this only happens in CI
    _safestate = "Test mode"
    safemode = True
elif _safestate == 2:
    _safestate = "Normal mode boot"
elif _safestate == 1:
    _safestate = _sf + "(hard reset)"
elif _safestate == 3:
    _safestate = _sf + "(normal mode failed)"
elif _safestate == 4:  # pybd
    _safestate = _sf + "(WDT)"
else:
    _safestate = _sf + "(no magic)"
log.warning(_safestate)
Beispiel #7
0
# print hello-world
log.warning("\n\n")
_uname = os.uname()
log.warning("MicroPython %s (%s)", _uname.release, _uname.version)
log.warning(_uname.machine)
_u = str(board.mqtt.get("user", "esp32"))
log.warning("%s %s starting at %s\n", _u, str(board.location), time.localtime())
del _u
del _uname

# log some info and check any heap constraints given in the config
if sys.platform == "esp32":
    import esp32

    log.warning("Boot partition: %s", esp32.Partition(esp32.Partition.RUNNING).info()[4])

    # heap constraints, see docs https://github.com/tve/micropython/blob/esp32-set-heapsize/docs/esp32/quickref.rst#controlling-the-python-heap-size
    # FIXME: if machine.reset() gets called we end up in safeboot mode, which is not ideal
    # probably the whole thing needs to be moved out of main and be done later when the
    # watchdog can be used to reboot into the same mode
    min_idf_heap = getattr(board, "min_idf_heap", None)
    max_mp_heap = getattr(board, "max_mp_heap", None)
    if min_idf_heap or max_mp_heap:
        try:
            from esp32 import NVS, idf_heap_info
            nvs = NVS("micropython")
            reset=False
            # minimum IDF heap size
            if min_idf_heap:
                try: mih = nvs.get_i32("min_idf_heap")