Compare commits

...

2 Commits

Author SHA1 Message Date
7c2a102bee Fix Wake 2021-01-10 00:50:59 +01:00
15e3e5a82a Fix TryComparison11 and TryComparison1N 2021-01-10 00:50:37 +01:00

View File

@@ -353,7 +353,7 @@ namespace WaveshareUARTFingerprintSensor
{ {
(byte high, byte low) = Utils.Split(userID); (byte high, byte low) = Utils.Split(userID);
if (TrySendAndReceive(CommandType.Comparison11, high, low, 0, out var response, 1000)) if (TrySendAndReceive(CommandType.Comparison11, high, low, 0, out var response))
{ {
return response.responseType == ResponseType.Success; return response.responseType == ResponseType.Success;
} }
@@ -368,7 +368,7 @@ namespace WaveshareUARTFingerprintSensor
/// <returns></returns> /// <returns></returns>
public bool TryComparison1N(out (ushort userID, UserPermission permission) userInfo) public bool TryComparison1N(out (ushort userID, UserPermission permission) userInfo)
{ {
if (TrySendAndReceive(CommandType.Comparison1N, 0, 0, 0, out var response, 1000)) if (TrySendAndReceive(CommandType.Comparison1N, 0, 0, 0, out var response))
{ {
if (response.responseType != ResponseType.NoUser && response.responseType != ResponseType.Timeout) if (response.responseType != ResponseType.NoUser && response.responseType != ResponseType.Timeout)
{ {
@@ -510,7 +510,11 @@ namespace WaveshareUARTFingerprintSensor
public void Wake() public void Wake()
{ {
_sleeping = false; _sleeping = false;
_rstPin.Write(GpioPinValue.High); _rstPin.Write(GpioPinValue.High);
// Needed after wake to really wake the sensor
// Because the first command always fail for whatever reason
TryGetUserCount(out var _);
} }
private void OnWake() private void OnWake()