Add numeric device ID option
Allow setting ESPNow device id from CLI and persist to settings. Made-with: Cursor
This commit is contained in:
12
cli.py
12
cli.py
@@ -243,6 +243,14 @@ Examples:
|
||||
help="Device name"
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--id",
|
||||
dest="device_id",
|
||||
type=int,
|
||||
metavar="0-255",
|
||||
help="Numeric device ID used for ESPNow (0-255)"
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--pin",
|
||||
type=int,
|
||||
@@ -499,6 +507,10 @@ Examples:
|
||||
if args.default is not None:
|
||||
edits["default"] = args.default
|
||||
|
||||
if args.device_id is not None:
|
||||
# Clamp into single-byte range; store as int in settings.json
|
||||
edits["id"] = max(0, min(255, args.device_id))
|
||||
|
||||
# 1. Download: get current settings from device
|
||||
try:
|
||||
print(f"Downloading settings from {args.port}...", file=sys.stderr)
|
||||
|
||||
Reference in New Issue
Block a user