If this call returns false then the flash has been corrupted. Note that it seems as though the WiFi needs to be enabled to generate entropy for the random numbers, otherwise pseudo-random numbers are used.ĮSP.checkFlashCRC() calculates the CRC of the program memory (not including any filesystems) and compares it to the one embedded in the image. An alternate version is also available that fills an array of arbitrary length. Returns an unsigned 32-bit integer with the random number. This is useful for accurate timing of very short actions like bit banging.ĮSP.random() should be used to generate true random numbers on the ESP.
#GET WIRE LIBRARY FREE#
NOTE: Maximum malloc() -able block will be smaller due to memory manager overheads.ĮSP.getChipId() returns the ESP8266 chip ID as a 32-bit integer.ĮSP.getCoreVersion() returns a String containing the core version.ĮSP.getSdkVersion() returns the SDK version as a char.ĮSP.getCpuFreqMHz() returns the CPU frequency in MHz as an unsigned 8-bit integer.ĮSP.getSketchSize() returns the size of the current sketch as an unsigned 32-bit integer.ĮSP.getFreeSketchSpace() returns the free sketch space as an unsigned 32-bit integer.ĮSP.getSketchMD5() returns a lowercase String containing the MD5 of the current sketch.ĮSP.getFlashChipId() returns the flash chip ID as a 32-bit integer.ĮSP.getFlashChipSize() returns the flash chip size, in bytes, as seen by the SDK (may be less than actual size).ĮSP.getFlashChipRealSize() returns the real chip size, in bytes, based on the flash chip ID.ĮSP.getFlashChipSpeed(void) returns the flash chip frequency, in Hz.ĮSP.getCycleCount() returns the cpu instruction cycle count since start as an unsigned 32-bit. Data stored in the first 32 blocks will be lost after performing an OTA update, because they are used by the Core internals.ĮSP.getResetReason() returns a String containing the last reset reason in human readable format.ĮSP.getFreeHeap() returns the free heap size.ĮSP.getHeapFragmentation() returns the fragmentation metric (0% is clean, more than ~50% is not harmless)ĮSP.getMaxFreeBlockSize() returns the largest contiguous free RAM block in the heap, useful for checking heap fragmentation.
The stored data can be retained between deep sleep cycles, but might be lost after power cycling the chip. offset is measured in blocks of 4 bytes and can range from 0 to 127 blocks (total size of RTC memory is 512 bytes). If you implement deep sleep with WAKE_RF_DISABLED and require WiFi functionality on wake up, you will need to implement an additional WAKE_RF_DEFAULT before WiFi functionality is available.ĮSP.deepSleepInstant(microseconds, mode) works similarly to ESP.deepSleep but sleeps instantly without waiting for WiFi to shutdown.ĮSP.rtcUserMemoryWrite(offset, &data, sizeof(data)) and ESP.rtcUserMemoryRead(offset, &data, sizeof(data)) allow data to be stored in and retrieved from the RTC user memory of the chip respectively. (GPIO16 needs to be tied to RST to wake from deepSleep.) The chip can sleep for at most ESP.deepSleepMax() microseconds.
mode is one of WAKE_RF_DEFAULT, WAKE_RFCAL, WAKE_NO_RFCAL, WAKE_RF_DISABLED. Some ESP-specific APIs related to deep sleep, RTC and flash memories are available in the ESP object.ĮSP.deepSleep(microseconds, mode) will put the chip into deep sleep.