python-esp-bridge 0.3.0__tar.gz → 0.3.1__tar.gz

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.
Files changed (51) hide show
  1. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/PKG-INFO +1 -1
  2. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/__init__.py +1 -1
  3. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/eth.py +5 -7
  4. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/neopixel.py +9 -1
  5. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/pyproject.toml +1 -1
  6. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/.gitignore +0 -0
  7. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/.python-version +0 -0
  8. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/README.md +0 -0
  9. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/_log.py +0 -0
  10. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/analog.py +0 -0
  11. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/ble.py +0 -0
  12. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/bridge.py +0 -0
  13. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/camera.py +0 -0
  14. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/can.py +0 -0
  15. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/cli.py +0 -0
  16. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/compat/__init__.py +0 -0
  17. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/compat/blinka.py +0 -0
  18. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/compat/gpiozero.py +0 -0
  19. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/compat/luma.py +0 -0
  20. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/compat/rpi_gpio.py +0 -0
  21. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/compat/smbus.py +0 -0
  22. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/constants.py +0 -0
  23. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/dht.py +0 -0
  24. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/ds18b20.py +0 -0
  25. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/errors.py +0 -0
  26. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/espnow.py +0 -0
  27. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/fs.py +0 -0
  28. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/gpio.py +0 -0
  29. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/hcsr04.py +0 -0
  30. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/i2c.py +0 -0
  31. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/i2s.py +0 -0
  32. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/ir.py +0 -0
  33. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/mcpwm.py +0 -0
  34. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/net.py +0 -0
  35. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/nvs.py +0 -0
  36. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/oled.py +0 -0
  37. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/onewire.py +0 -0
  38. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/ota.py +0 -0
  39. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/protocol.py +0 -0
  40. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/pwm.py +0 -0
  41. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/rmt.py +0 -0
  42. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/spi.py +0 -0
  43. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/stepper.py +0 -0
  44. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/transport.py +0 -0
  45. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/transports/__init__.py +0 -0
  46. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/transports/ble.py +0 -0
  47. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/transports/mock.py +0 -0
  48. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/transports/serial.py +0 -0
  49. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/uart.py +0 -0
  50. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/espbridge/wifi.py +0 -0
  51. {python_esp_bridge-0.3.0 → python_esp_bridge-0.3.1}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-esp-bridge
3
- Version: 0.3.0
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
@@ -40,7 +40,7 @@ def find_ble_devices(timeout: float = 5.0):
40
40
 
41
41
  return _scan(timeout)
42
42
 
43
- __version__ = "0.3.0"
43
+ __version__ = "0.3.1"
44
44
 
45
45
  __all__ = [
46
46
  "Bridge",
@@ -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 = ".".join(str(b) for b in payload[1:5])
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
- ip = ".".join(str(b) for b in r[1:5])
87
- gw = ".".join(str(b) for b in r[5:9])
88
- mask = ".".join(str(b) for b in r[9:13])
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)
@@ -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
- data = bytes(round(v * b) for v in self._buf) if b < 1.0 else bytes(self._buf)
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
  [project]
2
2
  name = "python-esp-bridge"
3
- version = "0.3.0"
3
+ version = "0.3.1"
4
4
  description = "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
  readme = "README.md"
6
6
  requires-python = ">=3.10"