From 457fe2cfc93cc20ed312e19ee3ef3be22706117a Mon Sep 17 00:00:00 2001 From: Spacefish Date: Wed, 11 Dec 2024 16:00:06 +0100 Subject: [PATCH] ESP32-C6 support (#327) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Designate all initializer clauses to fix compiler errors with newer compilers * ESP32C6 support * fshelper: fixed ESP8266 regression caused by abstracting FS access #321 (#328) * fshelper: fixed ESP8266 regression caused by abstracting FS access #321 * Removing not needed ifdef l0ud spotted that this is not need. Co-Authored-By: Przemyslaw Romaniak --------- Co-authored-by: Przemyslaw Romaniak * Fix enabling motion bias estimation (#325) * fix pre-processor warning * add macro for calculating radians (#317) * feat: add macro for calculating radians * style: silence unused variable warning * remove unnecessary float cast in macro * SoftFusion sensor framework with BMI, ICM, LSM6, MPU sensor implementations (#322) * Update readme to mention BMI270 support. * Soft fusion sensor initial code, wip * Soft fusion ICM-42688-P lazy WIP implementation. * sfusion: Cleanup, implemented sensor frequency calibration * icm42688: add more comments, basic driver (no hw filtering) should be working * sfustion: compilation fix * sfusion: start calibration when upside down * cleanup: remove confusing had data flag * sensor manager: use unique_ptr instead of raw pointers * sfusion: big refactoring wip * sfusion: make aux work, at least sfusion sensors should now be functional * sfusion: lightweight implementation of BMI270 sensor, no sensitivity cal yet * sfusion: BMI270: added CRT and gyro zx factor. should be functionally equivalent to the old driver * Added lsm6dsv * Trying to work around esp32c3 compilation problem, not liking that solution * sfusion: fix problems found after rebase * Update README.md * Bump Arduino core to 3.0 to match GCC12 * Remove fast pin swapping that is no longer compatible with arduino core v3 * Bring back fast pin swapping * Update platformio-tools.ini * Fix accel timescale (calibration no longer takes forever) * Fix non-sfusion sensors * Added LSM6DSO and DSR support and refactored DSV support * Removed template float param from the implementation * sfusion: port MPU6050 driver wip, not expecting to be functional yet * sfusion: add headers specifying main code owners * connection: fix warning * update README.md * fshelper: fixed ESP8266 regression caused by abstracting FS access * sfusion: fix error on merge * bno080: differentiate bno080, bno085, bno086 again * sfusion: final touches * restore hadData functionality, implementing it in every sensor, made configured flag bno-only * fix address supplement in non-sfusion sensors, do i2c bus reset for all sensors * sfusion: make MPU6050 driver use normal MPU6050 ImuID, change eatSamplesAndReturn function to take ms instead of seconds * sfusion: hotfix, don't apply sensorOffset, it's applied in sensor base * Log FIFO overruns on LSMs * Reset the soft watchdog while eating or collecting calibration samples Resolves an issue where the soft watchdog would trigger. * Fix missing word in comment, switch to constexpr * Update esp32/esp8266 --------- Co-authored-by: Gorbit99 Co-authored-by: nekomona Co-authored-by: nekomona Co-authored-by: unlogisch04 <98281608+unlogisch04@users.noreply.github.com> Co-authored-by: kounocom Co-authored-by: Kubuxu * Add Haritora to consts (#333) Add haritora consts, fix misspelling * dont double scan i2c address on bus for ESP32C6 * add custom portmap for ESP32C6 * update to latest tasmota tools for ESP32C6 * serial over USB * remove change that does nothing * remove 2s wait in main.cpp it´s not required * make it change neutral * more change neutrality --------- Co-authored-by: unlogisch04 <98281608+unlogisch04@users.noreply.github.com> Co-authored-by: Przemyslaw Romaniak Co-authored-by: Meia Kouno <71262281+kounocom@users.noreply.github.com> Co-authored-by: Fredrik Hatletvedt <32248439+Pespiri@users.noreply.github.com> Co-authored-by: Przemyslaw Romaniak Co-authored-by: Gorbit99 Co-authored-by: nekomona Co-authored-by: nekomona Co-authored-by: kounocom Co-authored-by: Kubuxu Co-authored-by: JovannMC Co-authored-by: Eiren Rain --- lib/i2cscan/i2cscan.cpp | 5 +++++ platformio-tools.ini | 7 +++++++ platformio.ini | 10 ++++++++++ src/consts.h | 5 +++-- src/defines.h | 2 +- 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/lib/i2cscan/i2cscan.cpp b/lib/i2cscan/i2cscan.cpp index a252caed7..4dde0fca5 100644 --- a/lib/i2cscan/i2cscan.cpp +++ b/lib/i2cscan/i2cscan.cpp @@ -10,6 +10,11 @@ String portMap[] = {"D0", "D1", "D2", "D4", "D5", "D6", "D7"}; uint8_t portArray[] = {2, 3, 4, 5, 6, 7, 8, 9, 10}; uint8_t portExclude[] = {18, 19, 20, 21, LED_PIN}; String portMap[] = {"2", "3", "4", "5", "6", "7", "8", "9", "10"}; +// this is for the ESP32C6 has a lot of pins (10/11 only availiable on the WROOM modules but not on the "mini") +#elif defined(ESP32C6) +uint8_t portArray[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 18, 19, 20, 21, 22, 23}; +String portMap[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "14", "15", "18", "19", "20", "21", "22", "23"}; +uint8_t portExclude[] = {12, 13, 16, 17, LED_PIN}; // exclude USB D+,D- and serial TX/RX #elif defined(ESP32) uint8_t portArray[] = {4, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32, 33}; String portMap[] = {"4", "13", "14", "15", "16", "17", "18", "19", "21", "22", "23", "25", "26", "27", "32", "33"}; diff --git a/platformio-tools.ini b/platformio-tools.ini index f77b312b5..8b2d8dac3 100644 --- a/platformio-tools.ini +++ b/platformio-tools.ini @@ -80,6 +80,13 @@ build_flags = -DESP32C3 board = esp32-c3-devkitm-1 +[env:BOARD_ES32C6DEVKITC1] +platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.06.11/platform-espressif32.zip +build_flags = + ${env.build_flags} + -DESP32C6 +board = esp32-c6-devkitc-1 + [env:BOARD_XIAO_ESP32C3] platform = espressif32 @ 6.7.0 platform_packages = diff --git a/platformio.ini b/platformio.ini index 0e90d8028..fb654067f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -109,3 +109,13 @@ upload_speed = 921600 ; ${env.build_flags} ; -DESP32C3 ;board = lolin_c3_mini + +; If you want to use a ESP32C6, you can use this (experimental) +;[env:esp32c6] +;platform = https://github.com/tasmota/platform-espressif32/releases/download/2024.06.11/platform-espressif32.zip +;board = esp32-c6-devkitc-1 +;build_flags = +; ${env.build_flags} +; -DESP32C6 +; -DARDUINO_USB_MODE=1 +; -DARDUINO_USB_CDC_ON_BOOT=1 \ No newline at end of file diff --git a/src/consts.h b/src/consts.h index 04e57698d..4d529d036 100644 --- a/src/consts.h +++ b/src/consts.h @@ -83,8 +83,9 @@ enum class ImuID { #define BOARD_MOCOPI 15 // Used by mocopi/moslime #define BOARD_WEMOSWROOM02 16 #define BOARD_XIAO_ESP32C3 17 -#define BOARD_HARITORA 18 // Used by Haritora/SlimeTora -#define BOARD_DEV_RESERVED 250 // Reserved, should not be used in any release firmware +#define BOARD_HARITORA 18 // Used by Haritora/SlimeTora +#define BOARD_ES32C6DEVKITC1 19 +#define BOARD_DEV_RESERVED 250 // Reserved, should not be used in any release firmware #define BAT_EXTERNAL 1 #define BAT_INTERNAL 2 diff --git a/src/defines.h b/src/defines.h index 34da04b99..3f3ce5f84 100644 --- a/src/defines.h +++ b/src/defines.h @@ -192,7 +192,7 @@ PIN_IMU_SDA, PRIMARY_IMU_OPTIONAL, BMI160_QMC_REMAP) \ #define PIN_BATTERY_LEVEL 3 #define LED_PIN 10 #define LED_INVERTED false -#elif BOARD == BOARD_ES32C3DEVKITM1 +#elif BOARD == BOARD_ES32C3DEVKITM1 || BOARD == BOARD_ES32C6DEVKITC1 #define PIN_IMU_SDA 5 #define PIN_IMU_SCL 4 #define PIN_IMU_INT 6