Correctly initialize dictionary.

This commit is contained in:
Filip Strajnar 2024-09-27 23:45:51 +02:00
parent 9d65315b48
commit fdd1eb8e01

View file

@ -8,7 +8,7 @@ namespace Proculite.GpioRest.Services
{
public readonly ILogger<GpioService> _logger;
private readonly int[] _pins;
private readonly Dictionary<int, PwmWrapper> _pwmPins;
private readonly Dictionary<int, PwmWrapper> _pwmPins = new();
public GpioService(ILogger<GpioService> logger, IConfiguration configuration)
{
@ -25,7 +25,6 @@ namespace Proculite.GpioRest.Services
private void SetupPins()
{
_logger.LogInformation("Setting up {PinCount} pins.", _pins.Length);
PinMode pinMode = PinMode.Output;
foreach (var pin in _pins)
{