python-esp-bridge 0.3.0__py3-none-any.whl → 0.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- espbridge/__init__.py +1 -1
- espbridge/eth.py +5 -7
- espbridge/neopixel.py +9 -1
- {python_esp_bridge-0.3.0.dist-info → python_esp_bridge-0.3.1.dist-info}/METADATA +1 -1
- {python_esp_bridge-0.3.0.dist-info → python_esp_bridge-0.3.1.dist-info}/RECORD +7 -7
- {python_esp_bridge-0.3.0.dist-info → python_esp_bridge-0.3.1.dist-info}/WHEEL +0 -0
- {python_esp_bridge-0.3.0.dist-info → python_esp_bridge-0.3.1.dist-info}/entry_points.txt +0 -0
espbridge/__init__.py
CHANGED
espbridge/eth.py
CHANGED
|
@@ -15,6 +15,7 @@ import struct
|
|
|
15
15
|
import threading
|
|
16
16
|
|
|
17
17
|
from . import constants as C
|
|
18
|
+
from .protocol import ip_str as _ip
|
|
18
19
|
|
|
19
20
|
# Stable wire phy ids (mirrors firmware mod_eth.cpp)
|
|
20
21
|
PHY = {"generic": 0, "lan8720": 1, "tlk110": 2, "ip101": 2, "rtl8201": 3,
|
|
@@ -48,7 +49,7 @@ class Eth:
|
|
|
48
49
|
|
|
49
50
|
def _on_state(self, payload: bytes) -> None:
|
|
50
51
|
if payload[0] == 2: # got IP
|
|
51
|
-
self._ip =
|
|
52
|
+
self._ip = _ip(payload[1:5])
|
|
52
53
|
self._got_ip.set()
|
|
53
54
|
elif payload[0] == 3:
|
|
54
55
|
self._got_ip.clear()
|
|
@@ -83,12 +84,9 @@ class Eth:
|
|
|
83
84
|
|
|
84
85
|
def status(self) -> dict:
|
|
85
86
|
r = self._b.request(C.ETH_STATUS)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
mac = ":".join(f"{b:02x}" for b in r[13:19])
|
|
90
|
-
return {"link": bool(r[0]), "ip": ip, "gateway": gw,
|
|
91
|
-
"netmask": mask, "mac": mac}
|
|
87
|
+
return {"link": bool(r[0]), "ip": _ip(r[1:5]), "gateway": _ip(r[5:9]),
|
|
88
|
+
"netmask": _ip(r[9:13]),
|
|
89
|
+
"mac": ":".join(f"{b:02x}" for b in r[13:19])}
|
|
92
90
|
|
|
93
91
|
def end(self) -> None:
|
|
94
92
|
self._b.request(C.ETH_STOP)
|
espbridge/neopixel.py
CHANGED
|
@@ -37,6 +37,8 @@ class NeoPixel:
|
|
|
37
37
|
raise ValueError(f"at most {(C.MAX_PAYLOAD - 16) // bpp} pixels "
|
|
38
38
|
f"per strip ({order})")
|
|
39
39
|
self._buf = bytearray(n * bpp)
|
|
40
|
+
self._scale: bytes | None = None # brightness LUT, built on first show()
|
|
41
|
+
self._scale_for = -1.0
|
|
40
42
|
self._rmt.init_tx(pin, _TICK_HZ)
|
|
41
43
|
|
|
42
44
|
def __len__(self) -> int:
|
|
@@ -68,7 +70,13 @@ class NeoPixel:
|
|
|
68
70
|
def show(self) -> None:
|
|
69
71
|
"""Push the pixel buffer to the strip."""
|
|
70
72
|
b = max(0.0, min(1.0, self.brightness))
|
|
71
|
-
|
|
73
|
+
if b >= 1.0:
|
|
74
|
+
data = bytes(self._buf)
|
|
75
|
+
else:
|
|
76
|
+
if b != self._scale_for: # LUT rebuilt only when brightness changes
|
|
77
|
+
self._scale = bytes(round(i * b) for i in range(256))
|
|
78
|
+
self._scale_for = b
|
|
79
|
+
data = self._buf.translate(self._scale)
|
|
72
80
|
self._rmt.tx_bytes(self._pin, _BIT0, _BIT1, data)
|
|
73
81
|
|
|
74
82
|
def deinit(self) -> None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-esp-bridge
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Control every ESP32 peripheral from Python over USB serial or Bluetooth — GPIO, ADC, DAC, PWM, touch, I2C, SPI, UART, Wi-Fi sockets, BLE, ESP-NOW, RMT, 1-Wire, CAN, I2S, files, NVS, OTA
|
|
5
5
|
Project-URL: Homepage, https://github.com/HamzaYslmn/python-esp-bridge
|
|
6
6
|
Author: HamzaYslmn
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
espbridge/__init__.py,sha256=
|
|
1
|
+
espbridge/__init__.py,sha256=7ocedmb-wkxxzjRputyJWtpMytk4veZBHLNg2lhKRlk,1734
|
|
2
2
|
espbridge/_log.py,sha256=oIhsrrRd_-WO81kVn2wPCtIipo0GrAz07bUphYuVevA,2335
|
|
3
3
|
espbridge/analog.py,sha256=zv1EFVZC2CSNBr-J0wvQw2QZIdKQzhSrknfYmaOkSig,2247
|
|
4
4
|
espbridge/ble.py,sha256=fuTWlVoqCiDlu0e0-6r4Trq1VR_7skZwSFtpIgzZNyc,8321
|
|
@@ -11,7 +11,7 @@ espbridge/dht.py,sha256=c_4WGUt2BXSEFElW1eThc4pDRE_E9gZ1WwDWD6whbnc,2741
|
|
|
11
11
|
espbridge/ds18b20.py,sha256=1IFd12DDvin1bKrCsXT52kpCIzfpOISik2z8eBWoYwo,2508
|
|
12
12
|
espbridge/errors.py,sha256=111gvpi0J3-ioZ71X-yORDlSZvWWp3eSsy4BTZKUYbI,1203
|
|
13
13
|
espbridge/espnow.py,sha256=V_4sjEhkUE6tvbJ8pBf5QWa0XRWyuY_h4mWG3nzA2Nc,6622
|
|
14
|
-
espbridge/eth.py,sha256=
|
|
14
|
+
espbridge/eth.py,sha256=lTN_UO4yDGz_1qJTZps5cu1A5OFM5Pmcwg3uv8xt3ow,3777
|
|
15
15
|
espbridge/fs.py,sha256=Ph3_D-X70123pG3xtSqmWu0vunq6YJtEtPmL8qalnAs,5580
|
|
16
16
|
espbridge/gpio.py,sha256=daaE7GgjYxGBnGpFbkKMTsqLmyao8e5Hs_1dM3uFWFc,2384
|
|
17
17
|
espbridge/hcsr04.py,sha256=00p-I0xFP0D871GdkT2qi7dbbIJpvcTIzxBKp8i_xKo,1339
|
|
@@ -19,7 +19,7 @@ espbridge/i2c.py,sha256=8ng0PHY46Wwwr-jOf38-LboljSm7HSTwQEdd41C8308,3183
|
|
|
19
19
|
espbridge/i2s.py,sha256=6KDIUWdYrFXrmU26zdmxeZYDe4zOKuhNRHz2J_2x78s,3128
|
|
20
20
|
espbridge/ir.py,sha256=AGajWjLXhpME_ZZTcM9L_zo8kyA31eABp9H5VFci2Vc,3186
|
|
21
21
|
espbridge/mcpwm.py,sha256=6JVxVsIkx5_hE4DujkwSI_ix_Z4QqgQ_pPsq95GO0y0,1371
|
|
22
|
-
espbridge/neopixel.py,sha256=
|
|
22
|
+
espbridge/neopixel.py,sha256=zgSpcCiGupM9B8VjwiMDADCudWMr96HeGRvMDMvo6JQ,2830
|
|
23
23
|
espbridge/net.py,sha256=PHVg2OQYh5Ap-Zdi1C9vW-qEohExzwgBT-03ImCElYI,9634
|
|
24
24
|
espbridge/nvs.py,sha256=QNhKIQTV1WP0AvHUnDpL0b1qM69x0iUW6tht55ARu1Y,2438
|
|
25
25
|
espbridge/oled.py,sha256=-yB3C4eIM915ZhhQCBNthg3HysVXDiLCp7PkJ1Wfbok,8146
|
|
@@ -43,7 +43,7 @@ espbridge/transports/__init__.py,sha256=0EFGmisSGAuhZx7UQ_RXDoNz8Pd2AqdqWCNOeLrY
|
|
|
43
43
|
espbridge/transports/ble.py,sha256=SRpnnoDBW3J-Q5jhSV6nK1lqJBYQnozFSwyqbhQVfdg,6084
|
|
44
44
|
espbridge/transports/mock.py,sha256=WtIMB8FxinYnM7ns0bRL8lHB_Czn33T5PobGDnvWRhY,1205
|
|
45
45
|
espbridge/transports/serial.py,sha256=PZcDRg8QG7-Y4MrBKfnm6DCC_2iO_ZOtztZsKxviVjo,2505
|
|
46
|
-
python_esp_bridge-0.3.
|
|
47
|
-
python_esp_bridge-0.3.
|
|
48
|
-
python_esp_bridge-0.3.
|
|
49
|
-
python_esp_bridge-0.3.
|
|
46
|
+
python_esp_bridge-0.3.1.dist-info/METADATA,sha256=pkJK1r4A_QlEBWcGpCsgSoeyZVivionX1ve0MCncPMM,1525
|
|
47
|
+
python_esp_bridge-0.3.1.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
48
|
+
python_esp_bridge-0.3.1.dist-info/entry_points.txt,sha256=xXm9lM8iMGXRhFiDBZrncBlA_RuWOSCxUO2_v7jGuGE,49
|
|
49
|
+
python_esp_bridge-0.3.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|