Skip to content

Commit

Permalink
refactor: update TouchAndHoldNoiseControlsEncoder for the Buds3
Browse files Browse the repository at this point in the history
  • Loading branch information
timschneeb committed Jul 12, 2024
1 parent f7aaeb5 commit 91484ab
Showing 1 changed file with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,29 @@ public override SppMessage Encode()
return new SppMessage(MsgIds.SET_TOUCH_AND_HOLD_NOISE_CONTROLS, MsgTypes.Request, states);
}

private static byte[] GetValues(NoiseControlCycleModes mode)
private byte[] GetValues(NoiseControlCycleModes mode)
{
return mode switch
if (DeviceSpec.Device >= Models.Buds3)
{
NoiseControlCycleModes.AncOff => [1, 0, 1],
NoiseControlCycleModes.AmbOff => [0, 1, 1],
NoiseControlCycleModes.AncAmb => [1, 1, 0],
_ => [0, 0, 0]
};
// New format
return mode switch
{
NoiseControlCycleModes.AncOff => [8 + 4],
NoiseControlCycleModes.AmbOff => [0 + 4],
NoiseControlCycleModes.AncAmb => [8 + 0],
_ => [0, 0]
};
// TODO implement Adaptive mode
}
else
{
return mode switch
{
NoiseControlCycleModes.AncOff => [1, 0, 1],
NoiseControlCycleModes.AmbOff => [0, 1, 1],
NoiseControlCycleModes.AncAmb => [1, 1, 0],
_ => [0, 0, 0]
};
}
}
}

0 comments on commit 91484ab

Please sign in to comment.