diff --git a/arch/esp32/esp32.ini b/arch/esp32/esp32.ini
index 39935b849..7e55f0934 100644
--- a/arch/esp32/esp32.ini
+++ b/arch/esp32/esp32.ini
@@ -1,7 +1,7 @@
; Common settings for ESP targes, mixin with extends = esp32_base
[esp32_base]
extends = arduino_base
-platform = platformio/espressif32@6.3.2 # This is a temporary fix to the S3-based devices bluetooth issues until we can determine what within ESP-IDF changed and can develop a suitable patch.
+platform = platformio/espressif32@6.7.0
build_src_filter =
${arduino_base.build_src_filter} - - - - -
@@ -15,8 +15,10 @@ board_build.filesystem = littlefs
# Remove -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL for low level BLE logging.
# See library directory for BLE logging possible values: .pio/libdeps/tbeam/NimBLE-Arduino/src/log_common/log_common.h
# This overrides the BLE logging default of LOG_LEVEL_INFO (1) from: .pio/libdeps/tbeam/NimBLE-Arduino/src/esp_nimble_cfg.h
+build_unflags = -fno-lto
build_flags =
${arduino_base.build_flags}
+ -flto
-Wall
-Wextra
-Isrc/platform/esp32
diff --git a/bin/platformio-custom.py b/bin/platformio-custom.py
index 651677af2..3382ff891 100644
--- a/bin/platformio-custom.py
+++ b/bin/platformio-custom.py
@@ -1,3 +1,5 @@
+# trunk-ignore-all(ruff/F821)
+# trunk-ignore-all(flake8/F821): For SConstruct imports
import sys
from os.path import join
@@ -60,6 +62,7 @@ if platform.name == "espressif32":
import esptool
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_combined_bin)
+ env.Append(LINKFLAGS=["--specs=nano.specs", "-u", "_printf_float"])
Import("projenv")
diff --git a/src/Power.cpp b/src/Power.cpp
index 8d0c8be62..b80d8a0d5 100644
--- a/src/Power.cpp
+++ b/src/Power.cpp
@@ -50,7 +50,7 @@ RTC_NOINIT_ATTR uint64_t RTC_reg_b;
esp_adc_cal_characteristics_t *adc_characs = (esp_adc_cal_characteristics_t *)calloc(1, sizeof(esp_adc_cal_characteristics_t));
#ifndef ADC_ATTENUATION
-static const adc_atten_t atten = ADC_ATTEN_DB_11;
+static const adc_atten_t atten = ADC_ATTEN_DB_12;
#else
static const adc_atten_t atten = ADC_ATTENUATION;
#endif
diff --git a/src/nimble/NimbleBluetooth.cpp b/src/nimble/NimbleBluetooth.cpp
index 8f7e00461..68aa9b465 100644
--- a/src/nimble/NimbleBluetooth.cpp
+++ b/src/nimble/NimbleBluetooth.cpp
@@ -157,7 +157,9 @@ void NimbleBluetooth::setup()
NimBLEDevice::setPower(ESP_PWR_LVL_P9);
if (config.bluetooth.mode != meshtastic_Config_BluetoothConfig_PairingMode_NO_PIN) {
- NimBLEDevice::setSecurityAuth(true, true, true);
+ NimBLEDevice::setSecurityAuth(BLE_SM_PAIR_AUTHREQ_BOND | BLE_SM_PAIR_AUTHREQ_MITM | BLE_SM_PAIR_AUTHREQ_SC);
+ NimBLEDevice::setSecurityInitKey(BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID);
+ NimBLEDevice::setSecurityRespKey(BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID);
NimBLEDevice::setSecurityIOCap(BLE_HS_IO_DISPLAY_ONLY);
}
bleServer = NimBLEDevice::createServer();
diff --git a/src/platform/esp32/main-esp32.cpp b/src/platform/esp32/main-esp32.cpp
index 2894a49fc..57f466594 100644
--- a/src/platform/esp32/main-esp32.cpp
+++ b/src/platform/esp32/main-esp32.cpp
@@ -218,7 +218,12 @@ void cpuDeepSleep(uint32_t msecToWake)
// just the first) gpio_pullup_en((gpio_num_t)BUTTON_PIN);
#if SOC_PM_SUPPORT_EXT_WAKEUP
+#ifdef CONFIG_IDF_TARGET_ESP32
+ // ESP_EXT1_WAKEUP_ALL_LOW has been deprecated since esp-idf v5.4 for any other target.
esp_sleep_enable_ext1_wakeup(gpioMask, ESP_EXT1_WAKEUP_ALL_LOW);
+#else
+ esp_sleep_enable_ext1_wakeup(gpioMask, ESP_EXT1_WAKEUP_ANY_LOW);
+#endif
#endif
#endif
diff --git a/variants/CDEBYTE_EoRa-S3/pins_arduino.h b/variants/CDEBYTE_EoRa-S3/pins_arduino.h
index 38a9103f0..46415d30f 100644
--- a/variants/CDEBYTE_EoRa-S3/pins_arduino.h
+++ b/variants/CDEBYTE_EoRa-S3/pins_arduino.h
@@ -11,15 +11,6 @@
#define USB_VID 0x303a
#define USB_PID 0x1001
-#define EXTERNAL_NUM_INTERRUPTS 46
-#define NUM_DIGITAL_PINS 48
-#define NUM_ANALOG_INPUTS 20
-
-#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
-#define digitalPinToInterrupt(p) \
- (((p) < 48) ? (p) : -1) // Maybe it should be <= 48 but this is from a trustworthy source so it is likely correct
-#define digitalPinHasPWM(p) (p < 46)
-
// Serial
static const uint8_t TX = UART_TX;
static const uint8_t RX = UART_RX;
diff --git a/variants/EBYTE_ESP32-S3/pins_arduino.h b/variants/EBYTE_ESP32-S3/pins_arduino.h
index 38a9103f0..46415d30f 100644
--- a/variants/EBYTE_ESP32-S3/pins_arduino.h
+++ b/variants/EBYTE_ESP32-S3/pins_arduino.h
@@ -11,15 +11,6 @@
#define USB_VID 0x303a
#define USB_PID 0x1001
-#define EXTERNAL_NUM_INTERRUPTS 46
-#define NUM_DIGITAL_PINS 48
-#define NUM_ANALOG_INPUTS 20
-
-#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
-#define digitalPinToInterrupt(p) \
- (((p) < 48) ? (p) : -1) // Maybe it should be <= 48 but this is from a trustworthy source so it is likely correct
-#define digitalPinHasPWM(p) (p < 46)
-
// Serial
static const uint8_t TX = UART_TX;
static const uint8_t RX = UART_RX;
diff --git a/variants/bpi_picow_esp32_s3/pins_arduino.h b/variants/bpi_picow_esp32_s3/pins_arduino.h
index af03bf28a..dd7b3c518 100644
--- a/variants/bpi_picow_esp32_s3/pins_arduino.h
+++ b/variants/bpi_picow_esp32_s3/pins_arduino.h
@@ -6,14 +6,6 @@
#define USB_VID 0x303a
#define USB_PID 0x1001
-#define EXTERNAL_NUM_INTERRUPTS 46
-#define NUM_DIGITAL_PINS 48
-#define NUM_ANALOG_INPUTS 20
-
-#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
-#define digitalPinToInterrupt(p) (((p) < 48) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < 46)
-
static const uint8_t TX = 43;
static const uint8_t RX = 44;
diff --git a/variants/esp32-s3-pico/pins_arduino.h b/variants/esp32-s3-pico/pins_arduino.h
index d24d98a2e..57a66fea2 100644
--- a/variants/esp32-s3-pico/pins_arduino.h
+++ b/variants/esp32-s3-pico/pins_arduino.h
@@ -6,14 +6,6 @@
#define USB_VID 0x303a
#define USB_PID 0x1001
-#define EXTERNAL_NUM_INTERRUPTS 46
-#define NUM_DIGITAL_PINS 48
-#define NUM_ANALOG_INPUTS 20
-
-#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
-#define digitalPinToInterrupt(p) (((p) < 48) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < 46)
-
// The default Wire will be mapped to PMU and RTC
static const uint8_t SDA = 15;
static const uint8_t SCL = 16;
diff --git a/variants/heltec_esp32c3/pins_arduino.h b/variants/heltec_esp32c3/pins_arduino.h
index db30a2f30..a717a3706 100644
--- a/variants/heltec_esp32c3/pins_arduino.h
+++ b/variants/heltec_esp32c3/pins_arduino.h
@@ -3,14 +3,6 @@
#include
-#define EXTERNAL_NUM_INTERRUPTS 22
-#define NUM_DIGITAL_PINS 22
-#define NUM_ANALOG_INPUTS 6
-
-#define analogInputToDigitalPin(p) (((p) < NUM_ANALOG_INPUTS) ? (esp32_adc2gpio[(p)]) : -1)
-#define digitalPinToInterrupt(p) (((p) < NUM_DIGITAL_PINS) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < EXTERNAL_NUM_INTERRUPTS)
-
static const uint8_t TX = 21;
static const uint8_t RX = 20;
diff --git a/variants/heltec_wireless_paper/pins_arduino.h b/variants/heltec_wireless_paper/pins_arduino.h
index 66d091691..9e1d8a9a0 100644
--- a/variants/heltec_wireless_paper/pins_arduino.h
+++ b/variants/heltec_wireless_paper/pins_arduino.h
@@ -7,14 +7,6 @@
#define DISPLAY_HEIGHT 64
#define DISPLAY_WIDTH 128
-#define EXTERNAL_NUM_INTERRUPTS 16
-#define NUM_DIGITAL_PINS 40
-#define NUM_ANALOG_INPUTS 16
-
-#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
-#define digitalPinToInterrupt(p) (((p) < 40) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < 34)
-
static const uint8_t LED_BUILTIN = 35;
#define BUILTIN_LED LED_BUILTIN // backward compatibility
#define LED_BUILTIN LED_BUILTIN
diff --git a/variants/heltec_wireless_paper_v1/pins_arduino.h b/variants/heltec_wireless_paper_v1/pins_arduino.h
index 66d091691..9e1d8a9a0 100644
--- a/variants/heltec_wireless_paper_v1/pins_arduino.h
+++ b/variants/heltec_wireless_paper_v1/pins_arduino.h
@@ -7,14 +7,6 @@
#define DISPLAY_HEIGHT 64
#define DISPLAY_WIDTH 128
-#define EXTERNAL_NUM_INTERRUPTS 16
-#define NUM_DIGITAL_PINS 40
-#define NUM_ANALOG_INPUTS 16
-
-#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
-#define digitalPinToInterrupt(p) (((p) < 40) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < 34)
-
static const uint8_t LED_BUILTIN = 35;
#define BUILTIN_LED LED_BUILTIN // backward compatibility
#define LED_BUILTIN LED_BUILTIN
diff --git a/variants/heltec_wireless_tracker/pins_arduino.h b/variants/heltec_wireless_tracker/pins_arduino.h
index 5c0b529b0..1052af961 100644
--- a/variants/heltec_wireless_tracker/pins_arduino.h
+++ b/variants/heltec_wireless_tracker/pins_arduino.h
@@ -11,18 +11,10 @@
#define USB_VID 0x303a
#define USB_PID 0x1001
-#define EXTERNAL_NUM_INTERRUPTS 46
-#define NUM_DIGITAL_PINS 48
-#define NUM_ANALOG_INPUTS 20
-
static const uint8_t LED_BUILTIN = 18;
#define BUILTIN_LED LED_BUILTIN // backward compatibility
#define LED_BUILTIN LED_BUILTIN
-#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
-#define digitalPinToInterrupt(p) (((p) < 48) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < 46)
-
static const uint8_t TX = 43;
static const uint8_t RX = 44;
diff --git a/variants/heltec_wireless_tracker_V1_0/pins_arduino.h b/variants/heltec_wireless_tracker_V1_0/pins_arduino.h
index f72c7661a..28b982012 100644
--- a/variants/heltec_wireless_tracker_V1_0/pins_arduino.h
+++ b/variants/heltec_wireless_tracker_V1_0/pins_arduino.h
@@ -11,18 +11,10 @@
#define USB_VID 0x303a
#define USB_PID 0x1001
-#define EXTERNAL_NUM_INTERRUPTS 46
-#define NUM_DIGITAL_PINS 48
-#define NUM_ANALOG_INPUTS 20
-
static const uint8_t LED_BUILTIN = 18;
#define BUILTIN_LED LED_BUILTIN // backward compatibility
#define LED_BUILTIN LED_BUILTIN
-#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
-#define digitalPinToInterrupt(p) (((p) < 48) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < 46)
-
static const uint8_t TX = 43;
static const uint8_t RX = 44;
diff --git a/variants/m5stack-stamp-c3/pins_arduino.h b/variants/m5stack-stamp-c3/pins_arduino.h
index 38ef9934e..22d2af51d 100644
--- a/variants/m5stack-stamp-c3/pins_arduino.h
+++ b/variants/m5stack-stamp-c3/pins_arduino.h
@@ -3,14 +3,6 @@
#include
-#define EXTERNAL_NUM_INTERRUPTS 22
-#define NUM_DIGITAL_PINS 22
-#define NUM_ANALOG_INPUTS 6
-
-#define analogInputToDigitalPin(p) (((p) < NUM_ANALOG_INPUTS) ? (esp32_adc2gpio[(p)]) : -1)
-#define digitalPinToInterrupt(p) (((p) < NUM_DIGITAL_PINS) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < EXTERNAL_NUM_INTERRUPTS)
-
static const uint8_t TX = -1; // 21;
static const uint8_t RX = -1; // 20;
diff --git a/variants/m5stack_core/pins_arduino.h b/variants/m5stack_core/pins_arduino.h
index 8f2a0041e..cf807aab4 100644
--- a/variants/m5stack_core/pins_arduino.h
+++ b/variants/m5stack_core/pins_arduino.h
@@ -3,14 +3,6 @@
#include
-#define EXTERNAL_NUM_INTERRUPTS 16
-#define NUM_DIGITAL_PINS 20
-#define NUM_ANALOG_INPUTS 16
-
-#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
-#define digitalPinToInterrupt(p) (((p) < 40) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < 34)
-
static const uint8_t TX = 1;
static const uint8_t RX = 3;
diff --git a/variants/m5stack_coreink/pins_arduino.h b/variants/m5stack_coreink/pins_arduino.h
index 7f9a14785..c75283ab2 100644
--- a/variants/m5stack_coreink/pins_arduino.h
+++ b/variants/m5stack_coreink/pins_arduino.h
@@ -3,14 +3,6 @@
#include
-#define EXTERNAL_NUM_INTERRUPTS 16
-#define NUM_DIGITAL_PINS 40
-#define NUM_ANALOG_INPUTS 16
-
-#define analogInputToDigitalPin(p) (((p) < 20) ? (esp32_adc2gpio[(p)]) : -1)
-#define digitalPinToInterrupt(p) (((p) < 40) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < 34)
-
#define TX2 -1
#define RX2 -1
diff --git a/variants/my_esp32s3_diy_eink/pins_arduino.h b/variants/my_esp32s3_diy_eink/pins_arduino.h
index 39e316624..b37a258c3 100644
--- a/variants/my_esp32s3_diy_eink/pins_arduino.h
+++ b/variants/my_esp32s3_diy_eink/pins_arduino.h
@@ -6,14 +6,6 @@
#define USB_VID 0x303a
#define USB_PID 0x1001
-#define EXTERNAL_NUM_INTERRUPTS 46
-#define NUM_DIGITAL_PINS 48
-#define NUM_ANALOG_INPUTS 20
-
-#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
-#define digitalPinToInterrupt(p) (((p) < 48) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < 46)
-
// The default Wire will be mapped to PMU and RTC
static const uint8_t SDA = 18;
static const uint8_t SCL = 17;
diff --git a/variants/my_esp32s3_diy_oled/pins_arduino.h b/variants/my_esp32s3_diy_oled/pins_arduino.h
index 39e316624..b37a258c3 100644
--- a/variants/my_esp32s3_diy_oled/pins_arduino.h
+++ b/variants/my_esp32s3_diy_oled/pins_arduino.h
@@ -6,14 +6,6 @@
#define USB_VID 0x303a
#define USB_PID 0x1001
-#define EXTERNAL_NUM_INTERRUPTS 46
-#define NUM_DIGITAL_PINS 48
-#define NUM_ANALOG_INPUTS 20
-
-#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
-#define digitalPinToInterrupt(p) (((p) < 48) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < 46)
-
// The default Wire will be mapped to PMU and RTC
static const uint8_t SDA = 18;
static const uint8_t SCL = 17;
diff --git a/variants/picomputer-s3/pins_arduino.h b/variants/picomputer-s3/pins_arduino.h
index c84601b1e..a3d40018c 100644
--- a/variants/picomputer-s3/pins_arduino.h
+++ b/variants/picomputer-s3/pins_arduino.h
@@ -6,14 +6,6 @@
#define USB_VID 0x303a
#define USB_PID 0x1001
-#define EXTERNAL_NUM_INTERRUPTS 46
-#define NUM_DIGITAL_PINS 48
-#define NUM_ANALOG_INPUTS 20
-
-#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
-#define digitalPinToInterrupt(p) (((p) < 48) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < 46)
-
static const uint8_t TX = 43;
static const uint8_t RX = 44;
diff --git a/variants/rak11200/pins_arduino.h b/variants/rak11200/pins_arduino.h
index 2dfe02614..f383d54a7 100644
--- a/variants/rak11200/pins_arduino.h
+++ b/variants/rak11200/pins_arduino.h
@@ -3,14 +3,6 @@
#include
-#define EXTERNAL_NUM_INTERRUPTS 16
-#define NUM_DIGITAL_PINS 40
-#define NUM_ANALOG_INPUTS 16
-
-#define analogInputToDigitalPin(p) (((p) < 20) ? (esp32_adc2gpio[(p)]) : -1)
-#define digitalPinToInterrupt(p) (((p) < 40) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < 34)
-
#define LED_GREEN 12
#define LED_BLUE 2
diff --git a/variants/rak11200/variant.h b/variants/rak11200/variant.h
index 3399594e5..3cd601254 100644
--- a/variants/rak11200/variant.h
+++ b/variants/rak11200/variant.h
@@ -3,14 +3,6 @@
#include
-#define EXTERNAL_NUM_INTERRUPTS 16
-#define NUM_DIGITAL_PINS 40
-#define NUM_ANALOG_INPUTS 16
-
-#define analogInputToDigitalPin(p) (((p) < 20) ? (esp32_adc2gpio[(p)]) : -1)
-#define digitalPinToInterrupt(p) (((p) < 40) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < 34)
-
#define LED_GREEN 12
#define LED_BLUE 2
diff --git a/variants/station-g2/pins_arduino.h b/variants/station-g2/pins_arduino.h
index 98cbd46d3..6a803008d 100755
--- a/variants/station-g2/pins_arduino.h
+++ b/variants/station-g2/pins_arduino.h
@@ -6,14 +6,6 @@
#define USB_VID 0x303a
#define USB_PID 0x1001
-#define EXTERNAL_NUM_INTERRUPTS 46
-#define NUM_DIGITAL_PINS 48
-#define NUM_ANALOG_INPUTS 20
-
-#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
-#define digitalPinToInterrupt(p) (((p) <= 48) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < 46)
-
// GPIO48 Reference: https://github.com/espressif/arduino-esp32/pull/8600
// The default Wire will be mapped to Screen and Sensors
diff --git a/variants/station-g2/platformio.ini b/variants/station-g2/platformio.ini
index e96c0ab88..b674c8bae 100755
--- a/variants/station-g2/platformio.ini
+++ b/variants/station-g2/platformio.ini
@@ -8,7 +8,9 @@ upload_protocol = esptool
upload_speed = 921600
lib_deps =
${esp32s3_base.lib_deps}
-build_unflags = -DARDUINO_USB_MODE=1
+build_unflags =
+ ${esp32s3_base.build_unflags}
+ -DARDUINO_USB_MODE=1
build_flags =
${esp32s3_base.build_flags} -D STATION_G2 -I variants/station-g2
-DBOARD_HAS_PSRAM
diff --git a/variants/t-deck/pins_arduino.h b/variants/t-deck/pins_arduino.h
index 0150935ed..cb429d776 100644
--- a/variants/t-deck/pins_arduino.h
+++ b/variants/t-deck/pins_arduino.h
@@ -6,14 +6,6 @@
#define USB_VID 0x303a
#define USB_PID 0x1001
-#define EXTERNAL_NUM_INTERRUPTS 46
-#define NUM_DIGITAL_PINS 48
-#define NUM_ANALOG_INPUTS 20
-
-#define analogInputToDigitalPin(p) (((p) < NUM_ANALOG_INPUTS) ? (analogChannelToDigitalPin(p)) : -1)
-#define digitalPinToInterrupt(p) (((p) < NUM_DIGITAL_PINS) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < EXTERNAL_NUM_INTERRUPTS)
-
// static const uint8_t LED_BUILTIN = -1;
static const uint8_t TX = 43;
diff --git a/variants/t-watch-s3/pins_arduino.h b/variants/t-watch-s3/pins_arduino.h
index d3dde6856..35f0e933e 100644
--- a/variants/t-watch-s3/pins_arduino.h
+++ b/variants/t-watch-s3/pins_arduino.h
@@ -3,14 +3,6 @@
#include
-#define EXTERNAL_NUM_INTERRUPTS 46
-#define NUM_DIGITAL_PINS 48
-#define NUM_ANALOG_INPUTS 20
-
-#define analogInputToDigitalPin(p) (((p) < NUM_ANALOG_INPUTS) ? (analogChannelToDigitalPin(p)) : -1)
-#define digitalPinToInterrupt(p) (((p) < NUM_DIGITAL_PINS) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < EXTERNAL_NUM_INTERRUPTS)
-
// static const uint8_t LED_BUILTIN = -1;
// static const uint8_t TX = 43;
diff --git a/variants/tlora_t3s3_v1/pins_arduino.h b/variants/tlora_t3s3_v1/pins_arduino.h
index 627dad19d..4ced1b446 100644
--- a/variants/tlora_t3s3_v1/pins_arduino.h
+++ b/variants/tlora_t3s3_v1/pins_arduino.h
@@ -6,14 +6,6 @@
#define USB_VID 0x303a
#define USB_PID 0x1001
-#define EXTERNAL_NUM_INTERRUPTS 46
-#define NUM_DIGITAL_PINS 48
-#define NUM_ANALOG_INPUTS 20
-
-#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
-#define digitalPinToInterrupt(p) (((p) < 48) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < 46)
-
// The default Wire will be mapped to PMU and RTC
static const uint8_t SDA = 18;
static const uint8_t SCL = 17;
diff --git a/variants/tracksenger/internal/pins_arduino.h b/variants/tracksenger/internal/pins_arduino.h
index 5c0b529b0..1052af961 100644
--- a/variants/tracksenger/internal/pins_arduino.h
+++ b/variants/tracksenger/internal/pins_arduino.h
@@ -11,18 +11,10 @@
#define USB_VID 0x303a
#define USB_PID 0x1001
-#define EXTERNAL_NUM_INTERRUPTS 46
-#define NUM_DIGITAL_PINS 48
-#define NUM_ANALOG_INPUTS 20
-
static const uint8_t LED_BUILTIN = 18;
#define BUILTIN_LED LED_BUILTIN // backward compatibility
#define LED_BUILTIN LED_BUILTIN
-#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
-#define digitalPinToInterrupt(p) (((p) < 48) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < 46)
-
static const uint8_t TX = 43;
static const uint8_t RX = 44;
diff --git a/variants/tracksenger/lcd/pins_arduino.h b/variants/tracksenger/lcd/pins_arduino.h
index 5c0b529b0..1052af961 100644
--- a/variants/tracksenger/lcd/pins_arduino.h
+++ b/variants/tracksenger/lcd/pins_arduino.h
@@ -11,18 +11,10 @@
#define USB_VID 0x303a
#define USB_PID 0x1001
-#define EXTERNAL_NUM_INTERRUPTS 46
-#define NUM_DIGITAL_PINS 48
-#define NUM_ANALOG_INPUTS 20
-
static const uint8_t LED_BUILTIN = 18;
#define BUILTIN_LED LED_BUILTIN // backward compatibility
#define LED_BUILTIN LED_BUILTIN
-#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
-#define digitalPinToInterrupt(p) (((p) < 48) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < 46)
-
static const uint8_t TX = 43;
static const uint8_t RX = 44;
diff --git a/variants/tracksenger/oled/pins_arduino.h b/variants/tracksenger/oled/pins_arduino.h
index 5c0b529b0..1052af961 100644
--- a/variants/tracksenger/oled/pins_arduino.h
+++ b/variants/tracksenger/oled/pins_arduino.h
@@ -11,18 +11,10 @@
#define USB_VID 0x303a
#define USB_PID 0x1001
-#define EXTERNAL_NUM_INTERRUPTS 46
-#define NUM_DIGITAL_PINS 48
-#define NUM_ANALOG_INPUTS 20
-
static const uint8_t LED_BUILTIN = 18;
#define BUILTIN_LED LED_BUILTIN // backward compatibility
#define LED_BUILTIN LED_BUILTIN
-#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1)
-#define digitalPinToInterrupt(p) (((p) < 48) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < 46)
-
static const uint8_t TX = 43;
static const uint8_t RX = 44;
diff --git a/variants/unphone/platformio.ini b/variants/unphone/platformio.ini
index f66b5db49..dbfa0599d 100644
--- a/variants/unphone/platformio.ini
+++ b/variants/unphone/platformio.ini
@@ -9,6 +9,7 @@ monitor_speed = 115200
monitor_filters = esp32_exception_decoder
build_unflags =
+ ${esp32s3_base.build_unflags}
-D ARDUINO_USB_MODE
build_flags = ${esp32_base.build_flags}
diff --git a/variants/wiphone/pins_arduino.h b/variants/wiphone/pins_arduino.h
index bca9c1173..3759219d1 100644
--- a/variants/wiphone/pins_arduino.h
+++ b/variants/wiphone/pins_arduino.h
@@ -3,14 +3,6 @@
#include
-#define EXTERNAL_NUM_INTERRUPTS 16
-#define NUM_DIGITAL_PINS 20
-#define NUM_ANALOG_INPUTS 16
-
-#define analogInputToDigitalPin(p) (((p) < 20) ? (esp32_adc2gpio[(p)]) : -1)
-#define digitalPinToInterrupt(p) (((p) < 40) ? (p) : -1)
-#define digitalPinHasPWM(p) (p < 34)
-
static const uint8_t TX = 1;
static const uint8_t RX = 3;