Add LNB polarity toggle (V-pol 13V / H-pol 18V)
Bridge: set_lnb_voltage(mode) wraps firmware lnbdc command, enable_lna() now delegates to it. MCP: new set_lnb_voltage tool + 3 tests. TUI: Signal screen button toggles between V-pol and H-pol instead of one-way LNA enable.
This commit is contained in:
parent
8a6b99bd8c
commit
f8bfd69ceb
5 changed files with 123 additions and 19 deletions
|
|
@ -115,7 +115,7 @@ class SignalScreen(Container):
|
|||
yield Static(" Hz", classes="label")
|
||||
yield Button("Start", id="btn-start", variant="primary")
|
||||
yield Button("Stop", id="btn-stop")
|
||||
yield Button("Enable LNA", id="btn-lna")
|
||||
yield Button("V-pol 13V", id="btn-lna")
|
||||
yield Button("Reset Peak", id="btn-reset-peak")
|
||||
|
||||
# -- Sweep mode -------------------------------------------
|
||||
|
|
@ -350,9 +350,13 @@ class SignalScreen(Container):
|
|||
label = "YES" if locked else "NO"
|
||||
self.query_one("#lock-status", Static).update(f" Lock: {label}")
|
||||
|
||||
def _update_lna_label(self) -> None:
|
||||
label = "ON" if self._lna_enabled else "OFF"
|
||||
self.query_one("#lna-status", Static).update(f" LNA: {label}")
|
||||
def _update_lna_ui(self) -> None:
|
||||
if self._lna_enabled:
|
||||
self.query_one("#lna-status", Static).update(" LNA: ON (V-pol)")
|
||||
self.query_one("#btn-lna", Button).label = "H-pol 18V"
|
||||
else:
|
||||
self.query_one("#lna-status", Static).update(" LNA: OFF (H-pol)")
|
||||
self.query_one("#btn-lna", Button).label = "V-pol 13V"
|
||||
|
||||
def _update_status_strip_rssi(self, rssi_avg: int) -> None:
|
||||
"""Push RSSI to the app-level StatusStrip."""
|
||||
|
|
@ -386,19 +390,29 @@ class SignalScreen(Container):
|
|||
if self._device is None:
|
||||
self.app.notify("No device connected", severity="warning")
|
||||
return
|
||||
self._do_enable_lna()
|
||||
self._do_toggle_lnb()
|
||||
|
||||
@work(thread=True, exclusive=False, group="signal-cmd")
|
||||
def _do_enable_lna(self) -> None:
|
||||
def _do_toggle_lnb(self) -> None:
|
||||
try:
|
||||
self._device.enable_lna()
|
||||
self._lna_enabled = True
|
||||
self.app.call_from_thread(self._update_lna_label)
|
||||
self.app.call_from_thread(self.app.notify, "LNA enabled (13V ODU)")
|
||||
if self._lna_enabled:
|
||||
self._device.set_lnb_voltage("stb")
|
||||
self._lna_enabled = False
|
||||
self.app.call_from_thread(self._update_lna_ui)
|
||||
self.app.call_from_thread(
|
||||
self.app.notify, "LNB set to 18V (H-pol)"
|
||||
)
|
||||
else:
|
||||
self._device.set_lnb_voltage("odu")
|
||||
self._lna_enabled = True
|
||||
self.app.call_from_thread(self._update_lna_ui)
|
||||
self.app.call_from_thread(
|
||||
self.app.notify, "LNB set to 13V (V-pol, LNA on)"
|
||||
)
|
||||
except Exception:
|
||||
log.exception("LNA enable failed")
|
||||
log.exception("LNB voltage switch failed")
|
||||
self.app.call_from_thread(
|
||||
self.app.notify, "LNA enable failed", severity="error"
|
||||
self.app.notify, "LNB voltage switch failed", severity="error"
|
||||
)
|
||||
|
||||
def _handle_reset_peak(self) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue