5 Commits

Author SHA1 Message Date
Kuba Szczodrzyński
d41f1f2a4d [release] v0.12.1
Some checks failed
Lint check / Lint with clang-format (push) Has been cancelled
Lint check / Lint with black (push) Has been cancelled
PlatformIO Publish / publish (push) Has been cancelled
2023-01-02 17:06:16 +01:00
Kuba Szczodrzyński
f9967ff990 [core] Fix importing ltchiptool after updating 2023-01-02 17:05:35 +01:00
Kuba Szczodrzyński
db0ab41ea4 [realtek-ambz] Check SoftwareSerial before stopping 2023-01-02 16:03:49 +01:00
Kuba Szczodrzyński
da95cc30d3 [realtek-ambz] Move to GNU++11, update TODO.md 2023-01-02 16:02:57 +01:00
Ross Reedstrom
6b3001573e [docs] Fix link to supported boards (#53) 2023-01-01 14:05:57 +01:00
6 changed files with 54 additions and 24 deletions

14
TODO.md
View File

@@ -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)

View File

@@ -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);

View File

@@ -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>",

View File

@@ -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

View File

@@ -6,7 +6,7 @@
"type": "git",
"url": "https://github.com/kuba2k2/platformio-libretuya"
},
"version": "0.12.0",
"version": "0.12.1",
"frameworks": {
"arduino": {
"title": "Generic Arduino framework",

View File

@@ -14,31 +14,50 @@ 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):
ltchiptool = importlib.import_module("ltchiptool")
importlib.reload(ltchiptool)
if Version(ltchiptool.get_version()) < Version("2.0.2"):
if Version(ltchiptool.get_version()) in SimpleSpec(LTCHIPTOOL_VERSION):
return
if not install:
raise ImportError("Version too old")
try:
check_ltchiptool()
except (ImportError, AttributeError):
# update ltchiptool to a supported version
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
system(f"{sys.executable} -m pip install -U ltchiptool=={LTCHIPTOOL_VERSION}")
# 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
def try_check_ltchiptool():
install_modes = [True, False]
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: {exception}"
)
raise exception
try_check_ltchiptool()
import ltchiptool
# Remove current dir so it doesn't conflict with PIO
if dirname(__file__) in sys.path: