feat(bridge): alt(331f) 写通道——build 4 + CLI raw --channel alt,测试全绿
This commit is contained in:
1 parent
c4f577905f
commit
4db823f207
6 files changed
+30
-9
No files matched your search
@@ -145,6 +145,10 @@ class BridgeTransport:
|
||||
async def write_rxtx(self, data: bytes, response: bool = True):
|
||||
await self._rpc("write", char="rxtx", data=data.hex(), response=response)
|
||||
|
||||
async def write_alt(self, data: bytes, response: bool = True):
|
||||
"""经 331f 通道写(实机证据:1f1f 仅 ATT-ACK,331f 为活命令通道)。"""
|
||||
await self._rpc("write", char="alt", data=data.hex(), response=response)
|
||||
|
||||
async def read_rxtx(self) -> bytes:
|
||||
return bytes.fromhex((await self._rpc("read", char="rxtx"))["data"])
|
||||
|
||||
|
||||
+3
-1
@@ -172,7 +172,7 @@ def build_parser() -> argparse.ArgumentParser:
|
||||
|
||||
sp = sub.add_parser("raw", help="高级命令:直发 hex")
|
||||
sp.add_argument("hex")
|
||||
sp.add_argument("--channel", default="rxtx", choices=["rxtx", "epd"])
|
||||
sp.add_argument("--channel", default="rxtx", choices=["rxtx", "epd", "alt"])
|
||||
sp.add_argument("--no-response", action="store_true")
|
||||
|
||||
sp = sub.add_parser("ota", help="SUOTA 固件升级(高危,需确认)")
|
||||
@@ -255,6 +255,8 @@ async def _run_command(args, t):
|
||||
data = bytes.fromhex(args.hex)
|
||||
if args.channel == "epd":
|
||||
await t.write_epd(data, response=not args.no_response)
|
||||
elif args.channel == "alt":
|
||||
await t.write_alt(data, response=not args.no_response)
|
||||
else:
|
||||
await t.write_rxtx(data, response=not args.no_response)
|
||||
return {"sent": len(data)}
|
||||
|
||||
Reference in new issue
Block a user