pin info: show conflicts

* set.cpp: reject non-ADC pins as analog button pins (bugfix)
* pinmanager:
record conflicts
added getOwnerText(PinOwner tag) and getPinConflicts(int gpio)

GPIO    | Assigned to           | Info
--------|-----------------------|------------
i/o   0   Button            !! Conflict with AudioReactive (UM) !!        (default) I2S MCLK
i/o   1   debug output            Serial TX
i/o   2   ./.                     (default) LED pin
i/o   3   ./.                     Serial RX
i/o   5   ./.                     (default) SPI SS
i/o  13   Button            !! Conflict with IR Receiver !!

PIN ALLOC error: GPIO19 for analog button #2 is not an analog pin!
This commit is contained in:
Frank
2022-12-04 02:22:50 +01:00
parent 4bafc222f9
commit d2d8a86d81
5 changed files with 51 additions and 18 deletions

View File

@@ -67,10 +67,12 @@ class PinManagerClass {
#ifdef ESP8266
uint8_t pinAlloc[3] = {0x00, 0x00, 0x00}; //24bit, 1 bit per pin, we use first 17bits
PinOwner ownerTag[17] = { PinOwner::None };
PinOwner ownerConflict[17] = { PinOwner::None }; // WLEDMM: record pin alloc conflicts
#else
uint8_t pinAlloc[7] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; //WLEDMM bugfix - 56bit, 1 bit per pin, we use 50 bits on -S3
uint8_t ledcAlloc[2] = {0x00, 0x00}; //16 LEDC channels
PinOwner ownerTag[50] = { PinOwner::None }; // WLEDMM bugfix - new MCU's have up to 50 GPIO
PinOwner ownerConflict[50] = { PinOwner::None }; // WLEDMM: record pin alloc conflicts
#endif
struct {
uint8_t i2cAllocCount : 4; // allow multiple allocation of I2C bus pins but keep track of allocations
@@ -108,9 +110,10 @@ class PinManagerClass {
bool isPinOk(byte gpio, bool output = true);
PinOwner getPinOwner(byte gpio);
//String getOwnerText(PinOwner tag); // WLEDMM work in progress
String getPinOwnerText(int gpio); // WLEDMM
String getPinSpecialText(int gpio); // WLEDMM
String getOwnerText(PinOwner tag); // WLEDMM - return PIN owner tag as text
String getPinOwnerText(int gpio); // WLEDMM - return PIN owner as text
String getPinSpecialText(int gpio); // WLEDMM - return PIN special comments (if any)
String getPinConflicts(int gpio); // WLEDMM - return PIN alloc conflicts (if any)
#ifdef ARDUINO_ARCH_ESP32
byte allocateLedc(byte channels);
void deallocateLedc(byte pos, byte channels);