The Device actions menu entry is gone: clock sync, backup/restore, the identity key, reboot and factory reset are an Actions section on the Device config page, which now takes the repeater admin page's shape. It is full-screen, titled with the node's name and a staged count, and Apply sends in place, one value at a time; a value the device refuses stays staged with its reason. Read settings re-reads the device, and unread and blank values read ? and empty. The settings were checked against the companion firmware (MyMesh.cpp). New: client repeat, the radio command's trailing byte. Every radio edit now restates it, because the firmware reads a missing byte as off and a retune silently stopped a relaying companion. Also new: the auto-add hop limit, read off the raw frame the library half-parses, and a row for each custom variable the device reports. The firmware's own bounds now apply: a PIN of 0 or six digits, path-hash modes 0-2, telemetry deny / by contact / allow all, 150-2500 MHz, 7-500 kHz, and TX power from -9 dBm. Neither editor page slides its rows sideways any more. The Actions rows pin a head block, which on its own turned on horizontal scrolling for repeater admin's whole list and slid its setting labels out of view. SelectScreen(hscroll=False) now holds against the rows, and both pages use it, so long rows end at the edge the way Device config's always did. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
72 lines
2.4 KiB
Python
72 lines
2.4 KiB
Python
"""The ``advert`` tool: announce this node to the mesh, straight from the main menu.
|
|
|
|
Opens the Send advert flow (see :func:`meshterm.ui.config_editor.send_advert`) — a
|
|
zero-hop or flood advertisement, or this node's shareable contact card as a QR code.
|
|
A ``popup`` tool: the flow's prompts and result float over the still-pushed main menu
|
|
as modal dialogs (the quit-dialog pattern), so the everyday action stays a quick
|
|
in-place popup rather than a screen change.
|
|
|
|
Menu-only: the scripted equivalents are ``config advert`` and ``config share``, so no
|
|
duplicate subcommand is registered here.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
import typer
|
|
|
|
from ..context import AppContext
|
|
from .base import Tool, ToolResult, register
|
|
|
|
|
|
@register
|
|
class SendAdvertTool(Tool):
|
|
"""Send a zero-hop or flood advert, or share this node's contact card."""
|
|
|
|
name = "advert"
|
|
title = "Send advert"
|
|
icon = "📡"
|
|
help = "Announce this node — zero-hop, flood, or QR"
|
|
category = "This node"
|
|
order = 40 # your own node announcing itself: a device action, not a view
|
|
popup = True # dialog-sized: float over the menu instead of replacing it
|
|
|
|
async def prompt_params(self, ctx: AppContext) -> dict[str, Any] | None:
|
|
"""Run the interactive advert flow; there are never parameters to collect.
|
|
|
|
The flow presents its own result (the sent-advert note or the contact-card
|
|
view) before returning, so by the time the user backs out there is nothing
|
|
left for :meth:`run` to do — returning ``None`` tells the menu the invocation
|
|
is complete (the same pattern as the Device config page).
|
|
|
|
Args:
|
|
ctx: Shared application context.
|
|
|
|
Returns:
|
|
Always ``None``.
|
|
"""
|
|
from ..ui.config_editor import send_advert
|
|
|
|
await send_advert(ctx)
|
|
return None
|
|
|
|
async def run(self, ctx: AppContext, params: dict[str, Any]) -> ToolResult:
|
|
"""Nothing runs here: the advert is sent inside :meth:`prompt_params`.
|
|
|
|
Args:
|
|
ctx: Shared application context.
|
|
params: Unused.
|
|
|
|
Returns:
|
|
An empty :class:`ToolResult` (only reachable from a scripted call).
|
|
"""
|
|
return ToolResult(summary={})
|
|
|
|
def register_cli(self, app: typer.Typer) -> None:
|
|
"""Register no CLI command — ``config advert`` / ``config share`` cover scripting.
|
|
|
|
Args:
|
|
app: The Typer application (untouched).
|
|
"""
|