adding hints for the compiler for optimization.
In case your custom build complains about "const", just remove the keyword. based on e82f38e277, but going further :-)
* "const" class functions : function does not modify any class attributes ( --> "this" becomes const)
* __attribute__((pure)) : function return value depends only on the parameters and/or global variables. The function does not modify any global or static variables.
* __attribute__((const)) : function only examines arguments (no globals), and has no effects except the return value. This slightly more strict than "pure"
* hot: tells the compiler "this functions is called very often"
* cold: the opposite of hot
* added usermod config information (so it can be disabled)
* check that "INTERRUPT_PIN" does support interrupts (MM specific)
* expose "dmpReady" in public interface
* adjusted games usermod to switch to "simulation" in case mpu6050 is not active
Still toDo:
1. add interrupt PIN and errormessages to settings page.
2. de-alloc intPin when disabled (and disable interrupt)
3. usermod is still destroying DEBUG_PRINT macros.
4. temporarily disable MPU interrupt when onUpdateBegin(true)
* Additional functions: isPinPWM, isPinINT
* aliases: PM_ADC1 instead of PinManagerClass::ADC1
* make getADCPin work on "classic ESP32"
--> Tested and works on 8266, ESP32 (default platform), ESP32 (V4 Platform). ESP32-S3, ESP32-S2, ESP32-C3
bool isPinTouch(int gpio); // true if gpio supports touch functions
bool isPinAnalog(int gpio); // true if gpio supports analogRead
bool isPinADC1(int gpio); // true if gpio supports analogRead, and it belongs to ADC unit 1
bool isPinADC2(int gpio); // true if gpio supports analogRead, and it belongs to ADC unit 2
#define PM_NO_PIN 255
typedef enum { ADC_none = 0, ADC1 = 1, ADC2 = 2 } AdcIdentifier;
uint8_t getADCPin(AdcIdentifier adcUnit, uint8_t adcPort); // get GPIO number for ADC unit x, channel y. 255 = no such pin
- add WLED_NUM_PINS constant, to get rid of magic number "50"
- only show I2S defaults when USERMOD_AUDIOREACTIVE is enabled
- added alternate names for SPI pins
- small correction for -C3
* 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!
pinmanager ran out out array bounds on -S2 and -S3, as these MCUs have more than 40 GPIO. As consequence, memory was overwriten, and pins > 39 were reported as "allocated" but not "owned".
Thisfixes the problem, by extending internal arrays so that up to 50 pins can be managed.
fixing some array-out-of-bounds problems that happens on MCUs with more than 40 GPIO (-S2, -S3).
PinManager wrongly reprted the pins as "allocated" but "no owner"!
Improvements for debugging GPIO conflicts. HTML UI integration still pending.
* pinManager can be asked for pin owner (String) and pin special purpose (string).
* wled.cpp: show GPIO allocation when compiling with WLED_DEBUG
* pinmanager: show Pin Owner as name when possible.
The results looks like this
GPIO | Assigned to | Info
--------|-----------------------|------------
i/o 0 Button
i/o 1 debug Serial TX
i/o 2 DMX out
i/o 3 ./. Serial RX
i/o 5 ./. SPI SS
i/o 15 AudioReactive (UM)
i/o 16 LEDs (digital)
i/o 17 Relay
i/o 18 ./. SPI CLK
i/o 19 IR Receiver SPI MISO
i/o 21 I2C I2C SDA
i/o 22 I2C I2C SCL
i/o 23 ./. SPI MOSI
i/o 32 AudioReactive (UM)
* BH1750 upgrades
Moved the definitions into the main usermods_list.cpp instead of having a section to copy across.
Added Home Assistant Discovery topic for light sensor. This is toggleable from the usermod menu.
* Configure pin, other enhancements, readme
Implemented pin manager
Made pins configurable at runtime
Improved info screen outputs
Added F() around strings
Updated readme
* Resolve conflict
* Merge branch 'main'
* Missing comma
Co-authored-by: Christian Schwinne <dev.aircoookie@gmail.com>
Co-authored-by: Christian Schwinne <cschwinne@gmail.com>
Implemented PinManager and rerun setup of usermod after updating pins/
Registered in const.h and pin_manager.h I tried to follow the existing formatting/numbering in these files.
Wrapped any strings I could in F()
* UM QuinLED-An-Penta: First version
* UM QuinLED-An-Penta: Made OLED seconds a setting; small improvements
* UM QuinLED-An-Penta: Fixed unique ID
* Merge branch 'master' of https://github.com/Aircoookie/WLED
* UM QuinLED-An-Penta: Fixed config loading
* UM QuinLED-An-Penta: Replaced ledcRead() with calculating the percentage
* UM QuinLED-An-Penta: Fixed temp sensor readings
* UM QuinLED-An-Penta: Removing OLED bus clk setting
* UM QuinLED-An-Penta: ETH support, lots of OLED improvements
* Improved pin manager, ethernet config
* Ethernet is configured prior even to LED pins
* Pin Manager allocation / deallocation functions
now take an "ownership" tag parameter, helping
avoid accidentally free'ing pins that were allocated
by other code
* Pin Manager now has ability to allocate multiple
pins at once; Simplifies error handling
* Fix operator precedence error
Bitwise AND has lower precedence than the
relational "greater than" operator.
* PinManager update for some user modules
* don't build everything...
* Final step to reduce RAM overhead
* update comment
* remove macros
* Remove leftover allocated
* Init ethernet after settings saved
Co-authored-by: Christian Schwinne <dev.aircoookie@gmail.com>