From 627bea78cc1295cfe76dfc13e700afbcea91398e Mon Sep 17 00:00:00 2001 From: "carlos.solorzano" Date: Thu, 26 Sep 2019 11:15:36 -0500 Subject: [PATCH] Pi.Info fix --- src/Unosquare.RaspberryIO/Pi.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Unosquare.RaspberryIO/Pi.cs b/src/Unosquare.RaspberryIO/Pi.cs index da26d36..cb7dafe 100644 --- a/src/Unosquare.RaspberryIO/Pi.cs +++ b/src/Unosquare.RaspberryIO/Pi.cs @@ -1,4 +1,4 @@ -namespace Unosquare.RaspberryIO +namespace Unosquare.RaspberryIO { using Abstractions; using Camera; @@ -16,6 +16,7 @@ public static class Pi private const string MissingDependenciesMessage = "You need to load a valid assembly (WiringPi or PiGPIO)."; private static readonly object SyncLock = new object(); private static bool _isInit; + private static SystemInfo _info; /// /// Initializes static members of the class. @@ -24,7 +25,6 @@ static Pi() { lock (SyncLock) { - Info = SystemInfo.Instance; Camera = CameraController.Instance; PiDisplay = DsiDisplay.Instance; Audio = AudioSettings.Instance; @@ -35,7 +35,16 @@ static Pi() /// /// Provides information on this Raspberry Pi's CPU and form factor. /// - public static SystemInfo Info { get; } + public static SystemInfo Info + { + get + { + if (_info == null) + _info = SystemInfo.Instance; + + return _info; + } + } /// /// Provides access to the Raspberry Pi's GPIO as a collection of GPIO Pins.