From 1e3ce4bea333b89e0a2913dd10bf7f1dce4615d0 Mon Sep 17 00:00:00 2001 From: Mike Parks Date: Wed, 18 Oct 2023 11:25:37 -0700 Subject: [PATCH 1/2] Mark Tilt addon as unavailable if pins are not defined when enabled. --- src/addons/tilt.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/addons/tilt.cpp b/src/addons/tilt.cpp index bb84b6329..bc6e74ae6 100644 --- a/src/addons/tilt.cpp +++ b/src/addons/tilt.cpp @@ -4,11 +4,12 @@ #include "config.pb.h" bool TiltInput::available() { - return Storage::getInstance().getAddonOptions().tiltOptions.enabled; + const TiltOptions& options = Storage::getInstance().getAddonOptions().tiltOptions; + return options.enabled && ((options.tilt1Pin != -1) || (options.tilt2Pin != -1)); } void TiltInput::setup() { - const TiltOptions& options = Storage::getInstance().getAddonOptions().tiltOptions; + const TiltOptions& options = Storage::getInstance().getAddonOptions().tiltOptions; tiltSOCDMode = options.tiltSOCDMode; pinTilt1 = options.tilt1Pin; From babc7ce1ac7e700963127b8601bbf34595b26ae9 Mon Sep 17 00:00:00 2001 From: Mike Parks Date: Wed, 18 Oct 2023 11:27:37 -0700 Subject: [PATCH 2/2] Fix indent on tilt. --- src/addons/tilt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/addons/tilt.cpp b/src/addons/tilt.cpp index bc6e74ae6..86cf49434 100644 --- a/src/addons/tilt.cpp +++ b/src/addons/tilt.cpp @@ -5,7 +5,7 @@ bool TiltInput::available() { const TiltOptions& options = Storage::getInstance().getAddonOptions().tiltOptions; - return options.enabled && ((options.tilt1Pin != -1) || (options.tilt2Pin != -1)); + return options.enabled && ((options.tilt1Pin != -1) || (options.tilt2Pin != -1)); } void TiltInput::setup() {