Skip to content

Commit c5d4f2a

Browse files
authored
feat: set default modulation for NEC (#13)
Closes #9
1 parent 0f80ee8 commit c5d4f2a

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

infrared_protocols/codes/lg/tv.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,4 @@ class LGTVCode(IntEnum):
5151

5252
def make_command(code: LGTVCode, repeat_count: int = 0) -> Command:
5353
"""Get the NECCommand for an LG TV IR code."""
54-
return NECCommand(
55-
address=0xFB04, command=code, modulation=38000, repeat_count=repeat_count
56-
)
54+
return NECCommand(address=0xFB04, command=code, repeat_count=repeat_count)

infrared_protocols/codes/nedis/vmat3462at.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,4 @@ class NedisVMAT3462ATCode(IntEnum):
2323

2424
def make_command(code: NedisVMAT3462ATCode, repeat_count: int = 0) -> Command:
2525
"""Get the NECCommand for a Nedis VMAT3462AT HDMI switch IR code."""
26-
return NECCommand(
27-
address=0x0, command=code, modulation=38000, repeat_count=repeat_count
28-
)
26+
return NECCommand(address=0x0, command=code, repeat_count=repeat_count)

infrared_protocols/commands.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ class NECCommand(Command):
3636
command: int
3737

3838
def __init__(
39-
self, *, address: int, command: int, modulation: int, repeat_count: int = 0
39+
self,
40+
*,
41+
address: int,
42+
command: int,
43+
modulation: int = 38000,
44+
repeat_count: int = 0,
4045
) -> None:
4146
"""Initialize the NEC IR command."""
4247
super().__init__(modulation=modulation, repeat_count=repeat_count)

tests/test_commands.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ def test_nec_command_get_raw_timings_standard() -> None:
4141
Timing(high_us=562, low_us=1687),
4242
Timing(high_us=562, low_us=0),
4343
]
44-
command = NECCommand(address=0x04, command=0x08, modulation=38000, repeat_count=0)
44+
command = NECCommand(address=0x04, command=0x08, repeat_count=0)
4545
timings = command.get_raw_timings()
4646
assert timings == expected_raw_timings
47+
assert command.modulation == 38000
4748

4849
# Same command now with 2 repeats
4950
command_with_repeats = NECCommand(

0 commit comments

Comments
 (0)