Snap volume to whole steps, and hide deleted AVR sources
A tap now moves to the next multiple of VOLUME_STEP rather than adding it, so 23 goes to 25 and 25 goes to 30 and the levels stay round. The panel counts taps and lets the speakers do the rounding from whatever level they are actually at, since the phone's copy can be seconds old; the same rule is mirrored in JS so the optimistic number never has to correct itself when the reply lands. The input picker also asks the AVR which sources are still switched on (SSSOD ?) and leaves out the ones deleted in its setup menu. Sources it does not mention are kept, so a model that ignores the command shows its whole list rather than nothing; deleted sources also keep their names, in case the AVR is sitting on one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+6
-1
@@ -120,7 +120,9 @@ class FakeHeos(threading.Thread):
|
||||
class FakeAvr(threading.Thread):
|
||||
"""A Denon Telnet server that knows SI and SSFUN."""
|
||||
|
||||
SOURCES = [("MPLAY", "Apple TV"), ("GAME", "PlayStation"), ("SAT/CBL", "TV Box")]
|
||||
SOURCES = [("MPLAY", "Apple TV"), ("GAME", "PlayStation"),
|
||||
("SAT/CBL", "TV Box"), ("DVD", "Old DVD")]
|
||||
DELETED = {"DVD"} # switched off in the AVR's setup menu
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(daemon=True)
|
||||
@@ -160,6 +162,9 @@ class FakeAvr(threading.Thread):
|
||||
if command == "SSFUN ?":
|
||||
# The real AVR pads the names out with spaces.
|
||||
return [f"SSFUN{code} {name} " for code, name in self.SOURCES] + ["SSFUN END"]
|
||||
if command == "SSSOD ?":
|
||||
return [f"SSSOD{code} {'DEL' if code in self.DELETED else 'USE'}"
|
||||
for code, _ in self.SOURCES] + ["SSSOD END"]
|
||||
if command == "SI?":
|
||||
return [f"SI{self.input}"]
|
||||
if command.startswith("SI"):
|
||||
|
||||
Reference in New Issue
Block a user