Skip to content

Commit 4b5f9c2

Browse files
committed
refactor(lib): change use_enabled_flag_to_disable to false for clarity
This doesn't change behavior since EnabledFlagKind is None, but it does make the code less confusing.
1 parent 63b858f commit 4b5f9c2

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

lib/src/devices/soundcore/a3959.rs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ soundcore_device!(
5858
pub const BUTTON_CONFIGURATION_SETTINGS: ButtonConfigurationSettings<8, 4> =
5959
ButtonConfigurationSettings {
6060
supports_set_all_packet: false,
61-
use_enabled_flag_to_disable: true,
61+
use_enabled_flag_to_disable: false,
6262
order: [
6363
Button::LeftSinglePress,
6464
Button::RightSinglePress,
@@ -281,6 +281,37 @@ mod tests {
281281
.await;
282282
}
283283

284+
#[tokio::test(start_paused = true)]
285+
async fn test_disable_button() {
286+
let mut device = TestSoundcoreDevice::new_with_packet_responses(
287+
super::device_registry,
288+
DeviceModel::SoundcoreA3959,
289+
HashMap::from([(
290+
packet::Command([1, 1]),
291+
packet::Inbound::new(
292+
packet::Command([1, 1]),
293+
vec![
294+
1, 1, 5, 6, 255, 255, 48, 49, 46, 54, 52, 48, 49, 46, 54, 52, 51, 57, 53,
295+
57, 68, 69, 68, 54, 54, 57, 50, 68, 66, 54, 70, 52, 254, 254, 101, 120,
296+
161, 171, 171, 152, 144, 179, 120, 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10,
297+
241, 240, 102, 102, 242, 243, 68, 68, 51, 0, 85, 0, 0, 1, 255, 1, 49, 1, 1,
298+
0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
299+
],
300+
),
301+
)]),
302+
)
303+
.await;
304+
device
305+
.assert_set_settings_response_unordered(
306+
vec![(SettingId::LeftSinglePress, "None".into())],
307+
vec![packet::Outbound::new(
308+
packet::Command([0x04, 0x81]),
309+
vec![0, 2, 0xFF],
310+
)],
311+
)
312+
.await;
313+
}
314+
284315
#[tokio::test(start_paused = true)]
285316
async fn test_set_equalizer_configuration() {
286317
let mut device = TestSoundcoreDevice::new_with_packet_responses(

0 commit comments

Comments
 (0)