diff --git a/Sming/Arch/Esp32/Components/esp32/component.mk b/Sming/Arch/Esp32/Components/esp32/component.mk
index 80a45453de..bab9ebc984 100644
--- a/Sming/Arch/Esp32/Components/esp32/component.mk
+++ b/Sming/Arch/Esp32/Components/esp32/component.mk
@@ -169,7 +169,7 @@ endif
 endif
 
 ifeq ($(ENABLE_BLUETOOTH),1)
-ifeq (esp32s3-v5.2,$(ESP_VARIANT)-$(IDF_VERSION))
+ifeq (esp32s3-1,$(ESP_VARIANT)-$(IDF_VERSION_5x))
 ESP_BT_VARIANT := esp32c3
 else
 ESP_BT_VARIANT := $(ESP_VARIANT)
diff --git a/Sming/Arch/Esp32/build.mk b/Sming/Arch/Esp32/build.mk
index 4db95bf8c7..c1b1fee5a1 100644
--- a/Sming/Arch/Esp32/build.mk
+++ b/Sming/Arch/Esp32/build.mk
@@ -12,9 +12,12 @@ export IDF_PATH := $(call FixPath,$(IDF_PATH))
 
 # Extract IDF version
 ifndef IDF_VER
+# e.g. v5.2-beta1-265-g405b8b5512 or v5.0.5-173-g9d6770dfbb
 IDF_VER := $(shell (cd $$IDF_PATH && git describe --always --tags --dirty) | cut -c 1-31)
 endif
-IDF_VERSION := $(firstword $(subst -, ,$(IDF_VER)))
+# Now just vmajor.minor
+IDF_VERSION := $(subst ., ,$(firstword $(subst -, ,$(IDF_VER))))
+IDF_VERSION := $(firstword $(IDF_VERSION)).$(word 2,$(IDF_VERSION))
 
 # By default, downloaded tools will be installed under $HOME/.espressif directory
 # (%USERPROFILE%/.espressif on Windows). This path can be modified by setting