Further pin improvements

platformio
- create _all entries (wip)
- set FLD_PIN_SCL to -1 (use global)

4ld
- one bug fix and errorMessage improvements

const.h
- comments

wled.h
- do not use the I2CSDAPIN vars but HW_PIN_SDA instead
This commit is contained in:
Ewoud
2023-01-08 13:51:27 +01:00
parent ed815beabf
commit 544446d35e
6 changed files with 87 additions and 31 deletions

View File

@@ -42,7 +42,9 @@
default_envs = default_envs =
esp32_4MB_min esp32_4MB_min
esp32_4MB_max ; recommended default esp32_4MB_max ; recommended default
; esp32_4MB_all
esp32_16MB_max esp32_16MB_max
; esp32_16MB_all
esp8266_4MB_min esp8266_4MB_min
esp32_4MB_PSRAM_max esp32_4MB_PSRAM_max
esp32S3_8MB_max esp32S3_8MB_max
@@ -53,6 +55,7 @@ default_envs =
wemos_shield_esp32_16MB_max wemos_shield_esp32_16MB_max
wemos_shield_esp32_16MB_ICS4343x_max wemos_shield_esp32_16MB_ICS4343x_max
wemos_shield_esp32_16MB_SPM1423_max wemos_shield_esp32_16MB_SPM1423_max
; wemos_shield_esp32_16MB_SPM1423_all
wemos_shield_esp32_16MB_LineIn_max wemos_shield_esp32_16MB_LineIn_max
esp32_pico_4MB_max esp32_pico_4MB_max
esp32s2_tinyUF2_PSRAM_max esp32s2_tinyUF2_PSRAM_max
@@ -620,10 +623,9 @@ build_flags_min =
lib_deps_min = lib_deps_min =
https://github.com/kosme/arduinoFFT#develop @ 1.9.2 ; used for USERMOD_AUDIOREACTIVE https://github.com/kosme/arduinoFFT#develop @ 1.9.2 ; used for USERMOD_AUDIOREACTIVE
; monitor_filters = esp32_exception_decoder ; used to show crash details
build_flags_max = build_flags_max =
-D WLED_MAX_USERMODS=14 ; default only 4-6 ; -D WLED_MAX_USERMODS=14 ; default only 4-6
;; -D ARDUINO_USB_CDC_ON_BOOT=0 ; needed for arduino-esp32 >=2.0.4 ewowi to softhack: move to build_flags_min? - We need a different solution ;; -D ARDUINO_USB_CDC_ON_BOOT=0 ; needed for arduino-esp32 >=2.0.4 ewowi to softhack: move to build_flags_min? - We need a different solution
-D WLED_USE_MY_CONFIG ; include custom my_config.h ewowi to softhack: redundant as also in build_flags_min? -D WLED_USE_MY_CONFIG ; include custom my_config.h ewowi to softhack: redundant as also in build_flags_min?
-D USERMOD_DALLASTEMPERATURE -D USERMOD_DALLASTEMPERATURE
@@ -652,13 +654,15 @@ lib_deps_V4_max =
claws/BH1750 @^1.2.0 ; used for USERMOD_BH1750 claws/BH1750 @^1.2.0 ; used for USERMOD_BH1750
build_flags_all = build_flags_all =
-D WLED_MAX_USERMODS=16 ; default only 4-6
-D USERMOD_RTC ;; experimental -D USERMOD_RTC ;; experimental
-D USERMOD_SENSORSTOMQTT ;; experimental ; -D USERMOD_SENSORSTOMQTT ;; experimental
-D USERMOD_ANALOG_CLOCK
lib_deps_all = lib_deps_all =
adafruit/Adafruit BMP280 Library @ 2.1.0 ;; experimental for usermod USERMOD_SENSORSTOMQTT ; adafruit/Adafruit BMP280 Library @ 2.1.0 ;; experimental for usermod USERMOD_SENSORSTOMQTT
adafruit/Adafruit CCS811 Library @ 1.0.4 ;; experimental for usermod USERMOD_SENSORSTOMQTT ; adafruit/Adafruit CCS811 Library @ 1.0.4 ;; experimental for usermod USERMOD_SENSORSTOMQTT
adafruit/Adafruit Si7021 Library @ 1.4.0 ;; experimental for usermod USERMOD_SENSORSTOMQTT ; adafruit/Adafruit Si7021 Library @ 1.4.0 ;; experimental for usermod USERMOD_SENSORSTOMQTT
; end of common ; end of common
@@ -676,6 +680,7 @@ lib_deps = ${esp32.lib_deps} ${common_mm.lib_deps_min}
board_build.partitions = ${esp32.default_partitions} board_build.partitions = ${esp32.default_partitions}
board_build.f_flash = 80000000L ; use full 80MHz speed for flash (default = 40Mhz) board_build.f_flash = 80000000L ; use full 80MHz speed for flash (default = 40Mhz)
board_build.flash_mode = dio ; (dio = dual i/o; more compatible than qio = quad i/o) board_build.flash_mode = dio ; (dio = dual i/o; more compatible than qio = quad i/o)
monitor_filters = esp32_exception_decoder ; used to show crash details
;common default for all max environments ;common default for all max environments
[esp32_4MB_max_base] [esp32_4MB_max_base]
@@ -685,6 +690,13 @@ lib_deps = ${esp32_4MB_min_base.lib_deps} ${common_mm.lib_deps_max}
board_build.partitions = ${esp32_4MB_min_base.board_build.partitions} board_build.partitions = ${esp32_4MB_min_base.board_build.partitions}
; board_build.partitions = tools/WLED_ESP32-wrover_4MB.csv ; board_build.partitions = tools/WLED_ESP32-wrover_4MB.csv
[esp32_4MB_all_base]
extends = esp32_4MB_min_base
build_flags = ${esp32_4MB_min_base.build_flags} ${common_mm.build_flags_max} ${common_mm.build_flags_all}
lib_deps = ${esp32_4MB_min_base.lib_deps} ${common_mm.lib_deps_max} ${common_mm.lib_deps_all}
board_build.partitions = ${esp32_4MB_min_base.board_build.partitions}
; board_build.partitions = tools/WLED_ESP32-wrover_4MB.csv
;common default for all V4 min environments ;common default for all V4 min environments
[esp32_4MB_V4_min_base] [esp32_4MB_V4_min_base]
board = esp32dev board = esp32dev
@@ -699,6 +711,7 @@ board_build.partitions = ${esp32.default_partitions}
board_build.f_flash = 80000000L ; use full 80MHz speed for flash (default = 40Mhz) board_build.f_flash = 80000000L ; use full 80MHz speed for flash (default = 40Mhz)
board_build.flash_mode = dio ; (dio = dual i/o; more compatible than qio = quad i/o) board_build.flash_mode = dio ; (dio = dual i/o; more compatible than qio = quad i/o)
;lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation ;lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
; monitor_filters = esp32_exception_decoder ; used to show crash details
[esp32_4MB_V4_max_base] [esp32_4MB_V4_max_base]
extends = esp32_4MB_V4_min_base extends = esp32_4MB_V4_min_base
@@ -746,6 +759,13 @@ build_flags = ${esp32_4MB_max_base.build_flags}
; RAM: [== ] 24.4% (used 79804 bytes from 327680 bytes) ; RAM: [== ] 24.4% (used 79804 bytes from 327680 bytes)
; Flash: [========= ] 88.7% (used 1394813 bytes from 1572864 bytes) ; Flash: [========= ] 88.7% (used 1394813 bytes from 1572864 bytes)
[env:esp32_4MB_all]
extends = esp32_4MB_all_base
build_flags = ${esp32_4MB_all_base.build_flags}
-D WLED_RELEASE_NAME=esp32_4MB_all
; RAM: [== ] 24.4% (used 79804 bytes from 327680 bytes)
; Flash: [========= ] 88.7% (used 1394813 bytes from 1572864 bytes)
[env:esp32_16MB_max] [env:esp32_16MB_max]
extends = esp32_4MB_max_base extends = esp32_4MB_max_base
build_flags = ${esp32_4MB_max_base.build_flags} build_flags = ${esp32_4MB_max_base.build_flags}
@@ -756,6 +776,16 @@ board_build.partitions = ${Board_ESP32_16MB.board_build.partitions}
; Flash: [======= ] 67.0% (used 1405701 bytes from 2097152 bytes) ; Flash: [======= ] 67.0% (used 1405701 bytes from 2097152 bytes)
;lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation ;lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
[env:esp32_16MB_all]
extends = esp32_4MB_all_base
build_flags = ${esp32_4MB_all_base.build_flags}
-D WLED_RELEASE_NAME=esp32_16MB_all
board = ${Board_ESP32_16MB.board}
board_build.partitions = ${Board_ESP32_16MB.board_build.partitions}
; RAM: [== ] 24.4% (used 79916 bytes from 327680 bytes)
; Flash: [======= ] 67.0% (used 1405701 bytes from 2097152 bytes)
;lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
[env:esp8266_4MB_min] [env:esp8266_4MB_min]
extends = env:d1_mini extends = env:d1_mini
upload_speed = 460800 ;115200 upload_speed = 460800 ;115200
@@ -971,7 +1001,22 @@ build_flags = ${esp32_4MB_max_base.build_flags}
-D IRPIN=18 -D IRPIN=18
-D AUDIOPIN=-1 -D AUDIOPIN=-1
-D TEMPERATURE_PIN=23 -D TEMPERATURE_PIN=23
-D FLD_PIN_SCL=22 -D FLD_PIN_SDA=21 -D FLD_PIN_SCL=-1 -D FLD_PIN_SDA=-1 ; use global!
-D HW_PIN_SCL=22 -D HW_PIN_SDA=21
-D ENCODER_DT_PIN=35 -D ENCODER_CLK_PIN=5 -D ENCODER_SW_PIN=39 ;WLEDMM spec by @SERG74: use 35 and 39 instead of 18 and 19 (conflicts)
; -D WLED_USE_MY_CONFIG
[wemos_shield_esp32_4MB_all_base]
extends = esp32_4MB_all_base
build_flags = ${esp32_4MB_all_base.build_flags}
-D ABL_MILLIAMPS_DEFAULT=9500 ; Wemos max 10A
-D LEDPIN=16
-D RLYPIN=19
-D BTNPIN=17
-D IRPIN=18
-D AUDIOPIN=-1
-D TEMPERATURE_PIN=23
-D FLD_PIN_SCL=-1 -D FLD_PIN_SDA=-1 ; use global!
-D HW_PIN_SCL=22 -D HW_PIN_SDA=21 -D HW_PIN_SCL=22 -D HW_PIN_SDA=21
-D ENCODER_DT_PIN=35 -D ENCODER_CLK_PIN=5 -D ENCODER_SW_PIN=39 ;WLEDMM spec by @SERG74: use 35 and 39 instead of 18 and 19 (conflicts) -D ENCODER_DT_PIN=35 -D ENCODER_CLK_PIN=5 -D ENCODER_SW_PIN=39 ;WLEDMM spec by @SERG74: use 35 and 39 instead of 18 and 19 (conflicts)
; -D WLED_USE_MY_CONFIG ; -D WLED_USE_MY_CONFIG
@@ -1028,6 +1073,17 @@ board = ${Board_ESP32_16MB.board}
board_build.partitions = ${Board_ESP32_16MB.board_build.partitions} board_build.partitions = ${Board_ESP32_16MB.board_build.partitions}
; RAM: [== ] 24.4% (used 79820 bytes from 327680 bytes) ; RAM: [== ] 24.4% (used 79820 bytes from 327680 bytes)
; Flash: [========= ] 88.6% (used 1393421 bytes from 1572864 bytes) ; Flash: [========= ] 88.6% (used 1393421 bytes from 1572864 bytes)
monitor_filters = esp32_exception_decoder ; used to show crash details
[env:wemos_shield_esp32_16MB_SPM1423_all]
extends = wemos_shield_esp32_4MB_all_base
build_flags = ${wemos_shield_esp32_4MB_all_base.build_flags} ${Shield_SPM1423.build_flags}
-D WLED_RELEASE_NAME=wemos_shield_esp32_16MB_SPM1423_all
board = ${Board_ESP32_16MB.board}
board_build.partitions = ${Board_ESP32_16MB.board_build.partitions}
; RAM: [== ] 24.4% (used 79820 bytes from 327680 bytes)
; Flash: [========= ] 88.6% (used 1393421 bytes from 1572864 bytes)
monitor_filters = esp32_exception_decoder ; used to show crash details
[env:wemos_shield_esp32_16MB_LineIn_max] [env:wemos_shield_esp32_16MB_LineIn_max]
extends = wemos_shield_esp32_4MB_max_base extends = wemos_shield_esp32_4MB_max_base

View File

@@ -112,7 +112,7 @@ class FourLineDisplayUsermod : public Usermod {
bool initDone = false; bool initDone = false;
volatile bool drawing = false; volatile bool drawing = false;
char errorMessage[100] = "No errors"; //WLEDMM: show error in um settings if occurred char errorMessage[100] = ""; //WLEDMM: show error in um settings if occurred
// HW interface & configuration // HW interface & configuration
U8X8 *u8x8 = nullptr; // pointer to U8X8 display object U8X8 *u8x8 = nullptr; // pointer to U8X8 display object
@@ -231,7 +231,7 @@ class FourLineDisplayUsermod : public Usermod {
u8x8->draw2x2Glyph(col, row, glyph); u8x8->draw2x2Glyph(col, row, glyph);
} }
uint8_t getCols() { uint8_t getCols() {
if (type==NONE || !enabled) return 0; if (!typeOK || !enabled) return 0;
return u8x8->getCols(); return u8x8->getCols();
} }
void clear() { void clear() {
@@ -1075,7 +1075,7 @@ class FourLineDisplayUsermod : public Usermod {
//WLEDMM add errorMessage to um settings //WLEDMM add errorMessage to um settings
if (strcmp(errorMessage, "") != 0) { if (strcmp(errorMessage, "") != 0) {
oappend(SET_F("addInfo('errorMessage', 0, '<i>error: ")); oappend(SET_F(errorMessage)); oappend("!</i>');"); oappend(SET_F("addInfo('errorMessage', 0, '<i>error: ")); oappend(SET_F(errorMessage)); oappend("! Correct and reboot</i>');");
} }
} }

View File

@@ -311,7 +311,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
#endif #endif
Wire.begin(); Wire.begin();
} else { } else {
Serial.printf("pinmgr not success i2c %d %d\n", i2c_sda, i2c_scl); Serial.printf("pinmgr not success for global i2c %d %d\n", i2c_sda, i2c_scl);
} }
JsonArray hw_if_spi = hw[F("if")][F("spi-pin")]; JsonArray hw_if_spi = hw[F("if")][F("spi-pin")];
CJSON(spi_mosi, hw_if_spi[0]); CJSON(spi_mosi, hw_if_spi[0]);
@@ -325,7 +325,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
SPI.begin(); SPI.begin();
#endif #endif
} else { } else {
Serial.printf("pinmgr not success spi %d %d %d\n", spi_mosi, spi_miso, spi_sclk); Serial.printf("pinmgr not success for global spi %d %d %d\n", spi_mosi, spi_miso, spi_sclk);
} }
//int hw_status_pin = hw[F("status")]["pin"]; // -1 //int hw_status_pin = hw[F("status")]["pin"]; // -1

View File

@@ -433,10 +433,10 @@
#endif #endif
// defaults for 1st I2C on ESP32 (Wire global) // defaults for 1st I2C on ESP32 (Wire global)
#ifndef HW_PIN_SCL #ifndef HW_PIN_SCL
#define HW_PIN_SCL SCL #define HW_PIN_SCL SCL //WLEDMM to check if -1 is better
#endif #endif
#ifndef HW_PIN_SDA #ifndef HW_PIN_SDA
#define HW_PIN_SDA SDA #define HW_PIN_SDA SDA //WLEDMM to check if -1 is better
#endif #endif
// HW_PIN_SCLKSPI & HW_PIN_MOSISPI & HW_PIN_MISOSPI are used for information in usermods settings page and usermods themselves // HW_PIN_SCLKSPI & HW_PIN_MOSISPI & HW_PIN_MISOSPI are used for information in usermods settings page and usermods themselves
@@ -444,7 +444,7 @@
#if defined(SPISCLKPIN) && !defined(HW_PIN_CLOCKSPI) #if defined(SPISCLKPIN) && !defined(HW_PIN_CLOCKSPI)
#define HW_PIN_CLOCKSPI SPISCLKPIN #define HW_PIN_CLOCKSPI SPISCLKPIN
#endif #endif
#if defined(SPIMOSIPIN) && !defined(HW_PIN_MOSISPI) #if defined(SPIMOSIPIN) && !defined(HW_PIN_MOSISPI) //WLEDMM not HW_PIN_DATASPI???
#define HW_PIN_MOSISPI SPIMOSIPIN #define HW_PIN_MOSISPI SPIMOSIPIN
#endif #endif
#if defined(SPIMISOPIN) && !defined(HW_PIN_MISOSPI) #if defined(SPIMISOPIN) && !defined(HW_PIN_MISOSPI)
@@ -462,13 +462,13 @@
#endif #endif
// defaults for VSPI on ESP32 (SPI global, SPI.cpp) as HSPI is used by WLED (bus_wrapper.h) // defaults for VSPI on ESP32 (SPI global, SPI.cpp) as HSPI is used by WLED (bus_wrapper.h)
#ifndef HW_PIN_CLOCKSPI #ifndef HW_PIN_CLOCKSPI
#define HW_PIN_CLOCKSPI SCK #define HW_PIN_CLOCKSPI SCK //WLEDMM to check if -1 is better
#endif #endif
#ifndef HW_PIN_DATASPI #ifndef HW_PIN_DATASPI
#define HW_PIN_DATASPI MOSI #define HW_PIN_DATASPI MOSI //WLEDMM to check if -1 is better
#endif #endif
#ifndef HW_PIN_MISOSPI #ifndef HW_PIN_MISOSPI
#define HW_PIN_MISOSPI MISO #define HW_PIN_MISOSPI MISO //WLEDMM to check if -1 is better
#endif #endif
// WLEDMM: IRAM_ATTR for 8266 causes error: section `.text1' will not fit in region `iram1_0_seg' // WLEDMM: IRAM_ATTR for 8266 causes error: section `.text1' will not fit in region `iram1_0_seg'

View File

@@ -549,7 +549,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
DEBUG_PRINTLN(F("Could not allocate I2C pins.")); DEBUG_PRINTLN(F("Could not allocate I2C pins."));
uint8_t i2c[2] = { static_cast<uint8_t>(i2c_scl), static_cast<uint8_t>(i2c_sda) }; uint8_t i2c[2] = { static_cast<uint8_t>(i2c_scl), static_cast<uint8_t>(i2c_sda) };
pinManager.deallocateMultiplePins(i2c, 2, PinOwner::HW_I2C); // just in case deallocation of old pins pinManager.deallocateMultiplePins(i2c, 2, PinOwner::HW_I2C); // just in case deallocation of old pins
Serial.printf("pinmgr not success i2c %d %d\n", i2c_sda, i2c_scl); Serial.printf("pinmgr not success for global i2c %d %d\n", i2c_sda, i2c_scl);
} }
#ifdef ESP8266 #ifdef ESP8266
@@ -575,7 +575,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
DEBUG_PRINTLN(F("Could not allocate SPI pins.")); DEBUG_PRINTLN(F("Could not allocate SPI pins."));
uint8_t spi[3] = { static_cast<uint8_t>(spi_mosi), static_cast<uint8_t>(spi_miso), static_cast<uint8_t>(spi_sclk) }; uint8_t spi[3] = { static_cast<uint8_t>(spi_mosi), static_cast<uint8_t>(spi_miso), static_cast<uint8_t>(spi_sclk) };
pinManager.deallocateMultiplePins(spi, 3, PinOwner::HW_SPI); // just in case deallocation of old pins pinManager.deallocateMultiplePins(spi, 3, PinOwner::HW_SPI); // just in case deallocation of old pins
Serial.printf("pinmgr not success spi %d %d %d\n", spi_mosi, spi_miso, spi_sclk); Serial.printf("pinmgr not success for global spi %d %d %d\n", spi_mosi, spi_miso, spi_sclk);
} }
JsonObject um = doc.createNestedObject("um"); JsonObject um = doc.createNestedObject("um");

View File

@@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2301081 #define VERSION 2301082
//uncomment this if you have a "my_config.h" file you'd like to use //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG
@@ -679,35 +679,35 @@ WLED_GLOBAL uint16_t ledMaps _INIT(0); // bitfield representation of available l
WLED_GLOBAL UsermodManager usermods _INIT(UsermodManager()); WLED_GLOBAL UsermodManager usermods _INIT(UsermodManager());
// global I2C SDA pin (used for usermods) // global I2C SDA pin (used for usermods)
#ifndef I2CSDAPIN #ifndef HW_PIN_SDA //WLEDMM not I2CSDAPIN
WLED_GLOBAL int8_t i2c_sda _INIT(-1); WLED_GLOBAL int8_t i2c_sda _INIT(-1);
#else #else
WLED_GLOBAL int8_t i2c_sda _INIT(I2CSDAPIN); WLED_GLOBAL int8_t i2c_sda _INIT(HW_PIN_SDA);
#endif #endif
// global I2C SCL pin (used for usermods) // global I2C SCL pin (used for usermods)
#ifndef I2CSCLPIN #ifndef HW_PIN_SCL //WLEDMM not I2CSCLPIN
WLED_GLOBAL int8_t i2c_scl _INIT(-1); WLED_GLOBAL int8_t i2c_scl _INIT(-1);
#else #else
WLED_GLOBAL int8_t i2c_scl _INIT(I2CSCLPIN); WLED_GLOBAL int8_t i2c_scl _INIT(HW_PIN_SCL);
#endif #endif
// global SPI DATA/MOSI pin (used for usermods) // global SPI DATA/MOSI pin (used for usermods)
#ifndef SPIMOSIPIN #ifndef HW_PIN_MOSISPI // WLEDMM not SPIMOSIPIN, what about HW_PIN_DATASPI ????
WLED_GLOBAL int8_t spi_mosi _INIT(-1); WLED_GLOBAL int8_t spi_mosi _INIT(-1);
#else #else
WLED_GLOBAL int8_t spi_mosi _INIT(SPIMOSIPIN); WLED_GLOBAL int8_t spi_mosi _INIT(HW_PIN_MOSISPI);
#endif #endif
// global SPI DATA/MISO pin (used for usermods) // global SPI DATA/MISO pin (used for usermods)
#ifndef SPIMISOPIN #ifndef HW_PIN_MISOSPI //WLEDMM not SPIMISOPIN
WLED_GLOBAL int8_t spi_miso _INIT(-1); WLED_GLOBAL int8_t spi_miso _INIT(-1);
#else #else
WLED_GLOBAL int8_t spi_miso _INIT(SPIMISOPIN); WLED_GLOBAL int8_t spi_miso _INIT(HW_PIN_MISOSPI);
#endif #endif
// global SPI CLOCK/SCLK pin (used for usermods) // global SPI CLOCK/SCLK pin (used for usermods)
#ifndef SPISCLKPIN #ifndef HW_PIN_CLOCKSPI //WLEDMM not SPISCLKPIN
WLED_GLOBAL int8_t spi_sclk _INIT(-1); WLED_GLOBAL int8_t spi_sclk _INIT(-1);
#else #else
WLED_GLOBAL int8_t spi_sclk _INIT(SPISCLKPIN); WLED_GLOBAL int8_t spi_sclk _INIT(HW_PIN_CLOCKSPI);
#endif #endif
// global ArduinoJson buffer // global ArduinoJson buffer