Description
Overview
This issue tracks usermods that require updates to support 16-bit effect IDs (PR #270). The migration from 8-bit to 16-bit effect IDs affects usermods that store, compare, or iterate over effect/mode IDs.
Critical Issues
1. usermod_v2_rotary_encoder_ui_ALT - Incomplete 16-bit support
Location: usermods/usermod_v2_rotary_encoder_ui_ALT/usermod_v2_rotary_encoder_ui_ALT.h
While effectCurrentIndex and knownMode were updated to uint16_t in PR #270, several critical issues remain:
- Line 141:
byte *modes_alpha_indexes- Array usesbyte(uint8_t) to store mode indexes, limiting values to 0-255. - Line 354-358:
re_initIndexArray()allocates and initializes abytearray withbyteloop counter - Line 633: Loop counter is
uint8_t ibut iterates up tostrip.getModeCount()which now returns uint16_t - sorting of effects list (re_sortModes(), re_qstringCmp(), re_initIndexArray()) cannot handle 16bit IDs, and may crash or produce other random side-effects.
Fix: Change modes_alpha_indexes from byte* to uint16_t* and update all related loops to use uint16_t counters.
Usermods with uint8_t knownMode Variables
The following usermods still use uint8_t for storing mode IDs and need to be updated to uint16_t:
2. usermod_v2_four_line_display_ALT
Location: usermods/usermod_v2_four_line_display_ALT/usermod_v2_four_line_display_ALT.h:161
uint8_t knownModeneeds to beuint16_t
3. Wemos_D1_mini+Wemos32_mini_shield
Locations:
usermods/Wemos_D1_mini+Wemos32_mini_shield/usermod.cpp:87usermods/Wemos_D1_mini+Wemos32_mini_shield/usermod_bme280.cpp:88- Both have
uint8_t knownModethat needs to beuint16_t
4. Enclosure_with_OLED_temp_ESP07
Locations:
usermods/Enclosure_with_OLED_temp_ESP07/usermod.cpp:53usermods/Enclosure_with_OLED_temp_ESP07/usermod_bme280.cpp:92- Both have
uint8_t knownModethat needs to beuint16_t
5. TTGO-T-Display
Location: usermods/TTGO-T-Display/usermod.cpp:82
uint8_t knownModeneeds to beuint16_t
Elegant Fix Approach
For all affected usermods, the fix is straightforward:
- Change
uint8_t knownModedeclarations touint16_t knownMode - For usermod_v2_rotary_encoder_ui_ALT specifically:
MQTT Protocol
No issues found with MQTT serialization of effect IDs in usermods. MQTT typically uses JSON or string-based protocols which handle larger integers naturally.
Testing Recommendations
After fixes:
- Test with builds containing >255 effects
- Verify display usermods correctly show effect names for high-numbered effects
- Confirm rotary encoder usermod can navigate through all effects
Related
- PR change effect IDs from 8bit to 16bit #270: Change effect IDs from 8bit to 16bit
- Off-by-one bug in random effect selection (random8(lim) / random16(lim) calls) #273
- animartrix: new fixed effect IDs lead to effects being dropped (IDs already used by ParticleFX) #271
- Effects with IDs >255 will not work correctly until these usermods are fixed
Priority: Medium - These usermods will malfunction when effect IDs exceed 255.