Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions wled00/FX_fcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -869,9 +869,12 @@ uint16_t Segment::virtualLength() const {
vLen = vH;
break;
case M12_pCorner:
case M12_pArc:
vLen = max(vW,vH); // get the longest dimension
break;
case M12_pArc:
vLen = sqrt16(vW * vW + vH * vH);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sqrt16 parameter will overflow if we go above 32767 pixels (182x182). But for the next few years we'll be safe - max_pixels is around 18k right now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

24,576 pixels is my current record. 😁

if (vW != vH) vLen++; // round up
break;
case M12_jMap: //WLEDMM jMap
if (jMap)
vLen = ((JMapC *)jMap)->length();
Expand Down Expand Up @@ -1218,11 +1221,18 @@ uint32_t __attribute__((hot)) Segment::getPixelColor(int i) const
if (vStrip>0) return getPixelColorXY(vStrip - 1, vH - i -1);
else return getPixelColorXY(0, vH - i -1);
break;
case M12_pArc:
case M12_pCorner:
// use longest dimension
return vW>vH ? getPixelColorXY(i, 0) : getPixelColorXY(0, i);
case M12_pArc: {
if (i < max(vW, vH)) {
return vW>vH ? getPixelColorXY(i, 0) : getPixelColorXY(0, i); // Corner and Arc
break;
}
int length = virtualLength();
int x = i * vW / length;
int y = i * vH / length;
return getPixelColorXY(x, y); // Not 100% accurate
break;
}
case M12_jMap: //WLEDMM jMap
if (jMap)
return ((JMapC *)jMap)->getPixelColor(i);
Expand Down