diff --git a/Sming/Arch/Esp8266/Components/esp8266/Tools/patch-phy-bin.py b/Sming/Arch/Esp8266/Components/esp8266/Tools/patch-phy-bin.py new file mode 100644 index 0000000000..8f38ce38aa --- /dev/null +++ b/Sming/Arch/Esp8266/Components/esp8266/Tools/patch-phy-bin.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +######################################################## +# +# Simple PHY binary patcher +# Author: Slavey Karadzhov +# +######################################################## +import os +import sys + +def usage(): + print("Usage: \n\t%s [offset]" % sys.argv[0]) + +if __name__ == "__main__": + if len(sys.argv) not in list(range(2,4)): + usage() + sys.exit(1) + + offset = 107 + if len(sys.argv) > 2: + offset = int(sys.argv[2]) + + with os.fdopen(os.open(sys.argv[1], os.O_RDWR | os.O_CREAT), 'rb+') as f: + f.seek(offset) + f.write(bytearray(b'\xff')); diff --git a/Sming/Arch/Esp8266/Components/esp8266/component.mk b/Sming/Arch/Esp8266/Components/esp8266/component.mk index 789d7aa24f..3b9e3a672f 100644 --- a/Sming/Arch/Esp8266/Components/esp8266/component.mk +++ b/Sming/Arch/Esp8266/Components/esp8266/component.mk @@ -5,8 +5,9 @@ SDK_BASE ?= $(COMPONENT_PATH)/ESP8266_NONOS_SDK SDK_BASE := $(call FixPath,$(SDK_BASE)) FLASH_INIT_DATA = $(SDK_BASE)/bin/esp_init_data_default.bin +FLASH_INIT_DATA_VCC = $(SDK_BASE)/bin/esp_init_data_vdd_default.bin -CUSTOM_TARGETS += $(FLASH_INIT_DATA) +CUSTOM_TARGETS += $(FLASH_INIT_DATA) $(FLASH_INIT_DATA_VCC) # => 'Internal' SDK - for SDK Version 3+ as submodule in Sming repository # SDK_BASE just needs to point into our repo as it's overridden with the correct submodule path @@ -24,6 +25,12 @@ else SDK_INTERNAL := 0 endif +PHY_TOOL := $(COMPONENT_PATH)/Tools/patch-phy-bin.py + +$(FLASH_INIT_DATA_VCC): $(FLASH_INIT_DATA) + $(Q) cp $< $@ + $(Q) $(PYTHON) $(PHY_TOOL) $@ + DEBUG_VARS += SDK_LIBDIR SDK_INCDIR SDK_LIBDIR := $(SDK_BASE)/lib SDK_INCDIR := $(SDK_BASE)/include diff --git a/docs/source/information/index.rst b/docs/source/information/index.rst index dbda9c0df4..58620c197e 100644 --- a/docs/source/information/index.rst +++ b/docs/source/information/index.rst @@ -15,4 +15,4 @@ Information debugging rboot-ota command-handler - hot-tips + tips-n-tricks diff --git a/docs/source/information/hot-tips.rst b/docs/source/information/tips-n-tricks.rst similarity index 81% rename from docs/source/information/hot-tips.rst rename to docs/source/information/tips-n-tricks.rst index b12c49be1d..a987befe1d 100644 --- a/docs/source/information/hot-tips.rst +++ b/docs/source/information/tips-n-tricks.rst @@ -1,8 +1,30 @@ -Hot Tips! -========= +Tips and Tricks +=============== .. highlight:: c++ +Reading VCC on ESP8266 +---------------------- +If you are running on a battery operated device then function `system_get_vdd33()` from +the official ESP8266 NONOS SDK can help you read the power voltage. +For the latter to work properly you should make a small change in your application `component.mk` +file and add `vdd` to the `HWCONFIG_OPTS` configuration variable. + +If you cannot see such a variable in your `component.mk` file then append the following line to it:: + + HWCONFIG := vdd + +You can have multiple options selected. They should be separated by comma. +For example the command below will add 4MB flash, spiffs and vdd support:: + + HWCONFIG := 4m,spiffs,vdd + +You can check the final hardware configuration using the command below:: + + make hwconfig + +If a custom hardware configuration is needed then read :component:`Storage`. + Minimising Memory Usage ----------------------- @@ -37,7 +59,7 @@ version:: See :component:`FlashString` for further details. Webpages Performance -==================== +-------------------- HTML markup can get quite large and the bigger the file the slower the page loads. One way to deal with that is to remove the white space, this