def show_fw(): """检查固件是否正确,仅ESP8266,ESP32等""" try: import esp print(esp.check_fw()) except: return
def show_fw(): """检查固件是否正确,仅ESP板""" try: import esp print(esp.check_fw()) except: print('仅ESP8266支持esp.check_fw()')
def start(): print("starting") fwok = esp.check_fw() print("fw ok: "+ str(fwok)) ledpin = machine.Pin(0, machine.Pin.OUT) def led_on(): ledpin.value(0) def led_off(): ledpin.value(1) def blink(cycles = 2): for i in range(cycles): led_on() sleep(0.3) led_off() if i != cycles - 1: sleep(0.3) print("blinking 10") blink(10) print("blinking 10") blink(10) print("done")
def main(): ROM = uctypes.bytearray_at(0x40200000, 16) fid = esp.flash_id() print("FlashROM:") print("Flash ID: %x (Vendor: %x Device: %x)" % (fid, fid & 0xFF, fid & 0xFF00 | fid >> 16)) print("Flash bootloader data:") SZ_MAP = {0: "512KB", 1: "256KB", 2: "1MB", 3: "2MB", 4: "4MB"} FREQ_MAP = {0: "40MHZ", 1: "26MHZ", 2: "20MHz", 0xF: "80MHz"} print("Byte @2: %02x" % ROM[2]) print("Byte @3: %02x (Flash size: %s Flash freq: %s)" % (ROM[3], SZ_MAP.get(ROM[3] >> 4, "?"), FREQ_MAP.get(ROM[3] & 0xF))) print("Firmware checksum:") print(esp.check_fw()) print("\nNetworking:") print("STA ifconfig:", network.WLAN(network.STA_IF).ifconfig()) print("AP ifconfig:", network.WLAN(network.AP_IF).ifconfig()) print("Free WiFi driver buffers of type:") for i, comm in enumerate(("1,2 TX", "4 Mngmt TX(len: 0x41-0x100)", "5 Mngmt TX (len: 0-0x40)", "7", "8 RX")): print("%d: %d (%s)" % (i, esp.esf_free_bufs(i), comm)) print("lwIP PCBs:") lwip.print_pcbs()
def main(): ROM = uctypes.bytearray_at(0x40200000, 16) fid = esp.flash_id() print("FlashROM:") print("Flash ID: %x (Vendor: %x Device: %x)" % (fid, fid & 0xff, fid & 0xff00 | fid >> 16)) print("Flash bootloader data:") SZ_MAP = {0: "512KB", 1: "256KB", 2: "1MB", 3: "2MB", 4: "4MB"} FREQ_MAP = {0: "40MHZ", 1: "26MHZ", 2: "20MHz", 0xf: "80MHz"} print("Byte @2: %02x" % ROM[2]) print("Byte @3: %02x (Flash size: %s Flash freq: %s)" % (ROM[3], SZ_MAP.get(ROM[3] >> 4, "?"), FREQ_MAP.get(ROM[3] & 0xf))) print("Firmware checksum:") print(esp.check_fw()) print("\nNetworking:") print("STA ifconfig:", network.WLAN(network.STA_IF).ifconfig()) print("AP ifconfig:", network.WLAN(network.AP_IF).ifconfig()) print("Free WiFi driver buffers of type:") for i in range(5): print("%d: %d" % (i, esp.esf_free_bufs(i))) print("lwIP PCBs:") lwip.print_pcbs()
# Chip: ESP32-WROOM-32 (ESP32-D0WDQ6) # Microprocessor: Dual-Core Xtensa® 32-bit LX6 # Clock: 80MHz to 240Mhz # Crystal: 40MHz # SPÍ flash: 4 MB # Operating voltage: 3.0V-3.6V # Operating current: 80mA # Purpose: Check the firmware integrity from a MicroPython REPL prompt # Notes: If the last output value is True, the firmware is OK. Otherwise, it’s corrupted and need # to be reflashed correctly. import esp esp.check_fw()
# This file is executed on every boot (including wake-boot from deepsleep) from esp import check_fw, flash_size from uos import statvfs print("\n\nmicro python 8266. FRIGO") check_fw() print('\nflash size in Mbytes: ', flash_size()/(1024.0*1024.0)) #esp.osdebug(None) # display flash size #import port_diag # do not include for 512k port # free file system i= statvfs('/') fs = i[1]*i[2]/(1024.0*1024.0) free= i[0]*i[4]/(1024.0*1024.0) per = (float(free)/float(fs)) print('file system size %0.1f, free %0.1f, used in percent %0.1f' %(fs, free, per)) #uos.dupterm(None, 1) # disable REPL on UART(0) # start webrepl after wifi. will be on 192.168.1.4:8266 (connect to wemos ssid) # and on local IP on home router as well #WebREPL daemon started on ws://192.168.4.1:8266 #WebREPL daemon started on ws://192.168.1.5:8266 #Started webrepl in #ormal mode