public override void TakeReading(bool ignoreExceptions) { try { CurrentValue = Mcp3208SpiDevice.Instance().GetSpread(_myChannel); //this sensor does +/- 5Amps LastUpdate = DateTime.UtcNow; } catch { if (!ignoreExceptions) { throw; } //We are probably going to ignore exceptions here. The current sensor is not a critical //componant and it will naturally flip to inop if we don't get a successful reading soon. } }
public static Mcp3208SpiDevice Instance() { return(_instance ?? (_instance = new Mcp3208SpiDevice())); }