bugfix: make pseudo-1D segments (width=1, height=x) work again

This commit is contained in:
Frank
2024-11-07 19:34:19 +01:00
parent 53ecf16ab1
commit aafebf7aad
3 changed files with 12 additions and 11 deletions

View File

@@ -565,9 +565,9 @@ typedef struct Segment {
inline bool hasRGB(void) const { return _isRGB; }
inline bool hasWhite(void) const { return _hasW; }
inline bool isCCT(void) const { return _isCCT; }
inline uint16_t width(void) const { return isActive() ? (stop - start) : 0; } // segment width in physical pixels (length if 1D)
inline uint16_t width(void) const { return (stop > start) ? (stop - start) : 0; } // segment width in physical pixels (length if 1D)
inline uint16_t height(void) const { return (stopY > startY) ? (stopY - startY) : 0; } // segment height (if 2D) in physical pixels // WLEDMM make sure its always > 0
inline uint16_t length(void) const { return width() * height(); } // segment length (count) in physical pixels
inline uint16_t length(void) const { return width() * height(); } // segment length (count) in physical pixels // WLEDMM fishy ... need to double-check if this is correct
inline uint16_t groupLength(void) const { return max(1, grouping + spacing); } // WLEDMM length = 0 could lead to div/0 in virtualWidth() and virtualHeight()
inline uint8_t getLightCapabilities(void) const { return _capabilities; }