From f279a6bf7aad40f98a843d820b6ff157c6eb3143 Mon Sep 17 00:00:00 2001 From: "claude-opus-4-8 (claude-code)" Date: Sat, 11 Jul 2026 13:03:31 -0700 Subject: [PATCH] Silence spurious MODE_BUTTON_PIN warning in PlatformIO builds PlatformIO's .ino conversion pass (gcc -fdirectives-only) registers every #define while passing #if conditionals through unevaluated, so the per-board MODE_BUTTON_PIN definitions looked like a redefinition in every pio build log. The compiled code was always correct; the warning was converter noise. Use an enum instead - same constant, nothing for the converter to warn on. Verified: no redefined warning in any pio env; uno/feather_m0 arduino-cli builds clean with --warnings all, uno flash/RAM byte-identical; sim-test passes. Agent: claude-opus-4-8 implement / claude-fable-5 validate (claude-code) Co-Authored-By: Claude Fable 5 --- tiny_scope/tiny_scope.ino | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tiny_scope/tiny_scope.ino b/tiny_scope/tiny_scope.ino index 8c59267..5169a47 100644 --- a/tiny_scope/tiny_scope.ino +++ b/tiny_scope/tiny_scope.ino @@ -30,11 +30,15 @@ public: #define ADC_PIN 1 // Which digital input the button is on - use to cycle through all the ADC modes +// (enum, not #define: PlatformIO's .ino conversion pass registers all +// #defines while ignoring the #if, and warns about a redefinition) +enum { #if defined(ARDUINO_ARCH_SAMD) -#define MODE_BUTTON_PIN 6 + MODE_BUTTON_PIN = 6 #else -#define MODE_BUTTON_PIN 7 + MODE_BUTTON_PIN = 7 #endif +}; // ADC reference voltage (mV). Default 5000 for AVR 5V, 3300 for 3.3V boards // Change this if AREF is connected to a different voltage reference