Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77af9c1cba | ||
|
|
1b2414337f | ||
|
|
d41f1f2a4d | ||
|
|
f9967ff990 | ||
|
|
db0ab41ea4 | ||
|
|
da95cc30d3 | ||
|
|
6b3001573e |
14
TODO.md
14
TODO.md
@@ -2,6 +2,16 @@
|
||||
|
||||
## General
|
||||
|
||||
### Environment stability
|
||||
|
||||
Do not publish *any* SDK functions, macros, defines and includes. Define only what's needed in LT's public headers (like `Arduino.h`). Everything else is taken from `sdk_extern.h` or `WVariant.h` (TODO decide whether to keep WV public / make both private / get rid of WV and use sdk_extern only). Private headers are included by LT's .cpp units (maybe a dedicated private header that would include sdk_extern + Arduino.h).
|
||||
|
||||
Developers wanting to use SDK functions need to include them.
|
||||
|
||||
Explicit is better than implicit.
|
||||
|
||||
- consider moving to C++17 (GNU)? or any newer than C++11
|
||||
|
||||
### New families
|
||||
|
||||
- BL602
|
||||
@@ -10,6 +20,7 @@
|
||||
- RTL8720D
|
||||
- W600 and/or W800
|
||||
- LN8825
|
||||
- BK7231Q
|
||||
- host-native family
|
||||
|
||||
### Tools
|
||||
@@ -30,7 +41,6 @@
|
||||
|
||||
## BK7231
|
||||
|
||||
- implement OTA
|
||||
- fix WiFi on BK7231N, test other functionality
|
||||
- fix SSL (mbedTLS)
|
||||
- I2C (Wire)
|
||||
@@ -39,5 +49,5 @@
|
||||
|
||||
## RTL8710B
|
||||
|
||||
- move to GNU++11 (and verify that it works) - take all stdio functions from stdio.h
|
||||
- take all stdio functions from stdio.h
|
||||
- rewrite most of Wiring (it was copied from `ambd_arduino`, and is ugly)
|
||||
|
||||
@@ -83,6 +83,8 @@ void SoftwareSerial::begin(unsigned long baudrate, uint16_t config) {
|
||||
}
|
||||
|
||||
void SoftwareSerial::end() {
|
||||
if (!(bool)this)
|
||||
return;
|
||||
gtimer_stop(OBJ);
|
||||
gtimer_deinit(OBJ);
|
||||
free(OBJ);
|
||||
|
||||
@@ -31,7 +31,7 @@ env.Append(
|
||||
],
|
||||
CXXFLAGS=[
|
||||
# borrowed from RtlDuino/development/rtl87xx/platform.txt
|
||||
"-std=c++11",
|
||||
"-std=gnu++11",
|
||||
"-MMD",
|
||||
"-fno-exceptions",
|
||||
"-fno-rtti",
|
||||
@@ -100,7 +100,6 @@ env.AddLibrary(
|
||||
"+<component/common/api/lwip_netconf.c>",
|
||||
"+<component/common/drivers/wlan/realtek/src/osdep/lwip_intf.c>",
|
||||
"+<component/common/network/dhcp/dhcps.c>",
|
||||
"+<component/common/network/sntp/sntp.c>",
|
||||
"+<component/common/network/ssl/ssl_ram_map/ssl_ram_map.c>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/portable/MemMang/heap_5.c>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM4F/port.c>",
|
||||
|
||||
@@ -22,7 +22,7 @@ Assuming you have PlatformIO, git and Python installed:
|
||||
|
||||
## Create your device config
|
||||
|
||||
1. Go to [Boards & CPU list](https://kuba2k2.github.io/libretuya/docs/supported/), click on your board and remember your board code.
|
||||
1. Go to [Boards & CPU list](../status/supported/), click on your board and remember your board code.
|
||||
2. Create a YAML config file for your device. You can either:
|
||||
- use `python -m esphome wizard yourdevice.yml` - type answers to the six questions the wizard asks, OR:
|
||||
- if your board isn't available in the wizard yet, use the manual YAML method below
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/kuba2k2/platformio-libretuya"
|
||||
},
|
||||
"version": "0.12.0",
|
||||
"version": "0.12.2",
|
||||
"frameworks": {
|
||||
"arduino": {
|
||||
"title": "Generic Arduino framework",
|
||||
|
||||
58
platform.py
58
platform.py
@@ -14,31 +14,53 @@ from platformio.package.manager.base import BasePackageManager
|
||||
from platformio.package.meta import PackageItem, PackageSpec
|
||||
from platformio.platform.base import PlatformBase
|
||||
from platformio.platform.board import PlatformBoardConfig
|
||||
from semantic_version import Version
|
||||
from semantic_version import SimpleSpec, Version
|
||||
|
||||
LTCHIPTOOL_VERSION = "^2.0.2"
|
||||
|
||||
# Install & import tools
|
||||
def check_ltchiptool():
|
||||
global ltchiptool
|
||||
import ltchiptool
|
||||
def check_ltchiptool(install: bool):
|
||||
if install:
|
||||
# update ltchiptool to a supported version
|
||||
print("Installing/updating ltchiptool")
|
||||
system(f"{sys.executable} -m pip install -U ltchiptool=={LTCHIPTOOL_VERSION}")
|
||||
|
||||
importlib.reload(ltchiptool)
|
||||
if Version(ltchiptool.get_version()) < Version("2.0.2"):
|
||||
# unload all modules from the old version
|
||||
for name, module in list(sorted(sys.modules.items())):
|
||||
if not name.startswith("ltchiptool"):
|
||||
continue
|
||||
del sys.modules[name]
|
||||
del module
|
||||
|
||||
# try to import it
|
||||
ltchiptool = importlib.import_module("ltchiptool")
|
||||
|
||||
# check if the version is known
|
||||
if Version(ltchiptool.get_version()) in SimpleSpec(LTCHIPTOOL_VERSION):
|
||||
return
|
||||
if not install:
|
||||
raise ImportError("Version too old")
|
||||
|
||||
|
||||
try:
|
||||
check_ltchiptool()
|
||||
except (ImportError, AttributeError):
|
||||
print("Installing/updating ltchiptool")
|
||||
system(" ".join([sys.executable, "-m", "pip install -U ltchiptool"]))
|
||||
try:
|
||||
check_ltchiptool()
|
||||
except (ImportError, AttributeError) as e:
|
||||
print(
|
||||
f"!!! Installing ltchiptool failed, or version outdated. Cannot continue: {e}"
|
||||
)
|
||||
raise e
|
||||
def try_check_ltchiptool():
|
||||
install_modes = [False, True]
|
||||
exception = None
|
||||
for install in install_modes:
|
||||
try:
|
||||
check_ltchiptool(install)
|
||||
return
|
||||
except (ImportError, AttributeError) as ex:
|
||||
exception = ex
|
||||
print(
|
||||
"!!! Installing ltchiptool failed, or version outdated. "
|
||||
"Please install ltchiptool manually using pip. "
|
||||
f"Cannot continue. {type(exception).name}: {exception}"
|
||||
)
|
||||
raise exception
|
||||
|
||||
|
||||
try_check_ltchiptool()
|
||||
import ltchiptool
|
||||
|
||||
# Remove current dir so it doesn't conflict with PIO
|
||||
if dirname(__file__) in sys.path:
|
||||
|
||||
Reference in New Issue
Block a user