WildernessLabs / Meadow_Issues

Public repo for bugs and issues with Meadow
15 stars 0 forks source link

TimeSpan on F7/Mono only has millisecond resolution #731

Open ctacke opened 1 week ago

ctacke commented 1 week ago

TimeSpan on .NET 8 has (at least) microsecond resolution. On the F7/Mono, everything is rounded to millisecond precision, which kills the ability to use it for PWMs that have microsecond resolution.

This shows the problem very obviously:

int micros = 0;

while (true)
{
    var m = micros / 1000d;
    var ts = TimeSpan.FromMilliseconds(m);
    Resolver.Log.Info($"{m}: {ts} = {ts.TotalMilliseconds}");
    await Task.Delay(100);
    micros += 10;
}
alexischr commented 2 days ago

Fix released with 1.12.6.4

alexischr commented 2 days ago

This should fix button events being dropped by the debouncer logic in Meadow.Core's DigitalInterruptPort.cs , when said logic got faster