Merge pull request #118 from Brandon502/mdev
This commit is contained in:
@@ -354,7 +354,8 @@ typedef enum mapping1D2D {
|
|||||||
M12_pCorner = 3,
|
M12_pCorner = 3,
|
||||||
M12_jMap = 4, //WLEDMM jMap
|
M12_jMap = 4, //WLEDMM jMap
|
||||||
M12_sCircle = 5, //WLEDMM Circle
|
M12_sCircle = 5, //WLEDMM Circle
|
||||||
M12_sBlock = 6 //WLEDMM Block
|
M12_sBlock = 6, //WLEDMM Block
|
||||||
|
M12_sPinWheel = 7 //WLEDMM PinWheel
|
||||||
} mapping1D2D_t;
|
} mapping1D2D_t;
|
||||||
|
|
||||||
// segment, 72 bytes
|
// segment, 72 bytes
|
||||||
|
|||||||
@@ -805,6 +805,9 @@ uint16_t Segment::virtualLength() const {
|
|||||||
else
|
else
|
||||||
vLen = max(vW,vH) * 0.5; // get the longest dimension
|
vLen = max(vW,vH) * 0.5; // get the longest dimension
|
||||||
break;
|
break;
|
||||||
|
case M12_sPinWheel: //WLEDMM
|
||||||
|
vLen = 360; // full circle
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return vLen;
|
return vLen;
|
||||||
}
|
}
|
||||||
@@ -932,6 +935,27 @@ void IRAM_ATTR_YN Segment::setPixelColor(int i, uint32_t col) //WLEDMM: IRAM_ATT
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case M12_sPinWheel: {
|
||||||
|
// i = 0 through 359
|
||||||
|
float centerX = (vW-1) / 2;
|
||||||
|
float centerY = (vH-1) / 2;
|
||||||
|
// int maxDistance = sqrt(centerX * centerX + centerY * centerY) + 1;
|
||||||
|
|
||||||
|
int distance = 0;
|
||||||
|
float cosVal = cos(i * DEG_TO_RAD); // i = current angle
|
||||||
|
float sinVal = sin(i * DEG_TO_RAD);
|
||||||
|
while (true) {
|
||||||
|
int x = round(centerX + distance * cosVal);
|
||||||
|
int y = round(centerY + distance * sinVal);
|
||||||
|
// Check bounds
|
||||||
|
if (x < 0 || x >= vW || y < 0 || y >= vH) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
setPixelColorXY(x, y, col);
|
||||||
|
distance++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if (Segment::maxHeight!=1 && (width()==1 || height()==1)) {
|
} else if (Segment::maxHeight!=1 && (width()==1 || height()==1)) {
|
||||||
@@ -1069,6 +1093,14 @@ uint32_t Segment::getPixelColor(int i)
|
|||||||
else
|
else
|
||||||
return getPixelColorXY(vW / 2, vH / 2 - i - 1);
|
return getPixelColorXY(vW / 2, vH / 2 - i - 1);
|
||||||
break;
|
break;
|
||||||
|
case M12_sPinWheel: //WLEDMM
|
||||||
|
// not 100% accurate, returns outer edge of circle
|
||||||
|
int distance = min(vH, vW) / 2;
|
||||||
|
float centerX = (vW - 1) / 2;
|
||||||
|
float centerY = (vH - 1) / 2;
|
||||||
|
int x = round(centerX + distance * cos(i * DEG_TO_RAD));
|
||||||
|
int y = round(centerY + distance * sin(i * DEG_TO_RAD));
|
||||||
|
return getPixelColorXY(x, y);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -779,6 +779,7 @@ function populateSegments(s)
|
|||||||
`<option value="4" ${inst.m12==4?' selected':''}>jMap ☾</option>`+
|
`<option value="4" ${inst.m12==4?' selected':''}>jMap ☾</option>`+
|
||||||
`<option value="5" ${inst.m12==5?' selected':''}>Circle ☾</option>`+
|
`<option value="5" ${inst.m12==5?' selected':''}>Circle ☾</option>`+
|
||||||
`<option value="6" ${inst.m12==6?' selected':''}>Block ☾</option>`+
|
`<option value="6" ${inst.m12==6?' selected':''}>Block ☾</option>`+
|
||||||
|
`<option value="6" ${inst.m12==7?' selected':''}>PinWheel ☾</option>`+
|
||||||
`</select></div>`+
|
`</select></div>`+
|
||||||
`</div>`;
|
`</div>`;
|
||||||
let sndSim = `<div data-snd="si" class="lbl-s hide">Sound sim<br>`+
|
let sndSim = `<div data-snd="si" class="lbl-s hide">Sound sim<br>`+
|
||||||
|
|||||||
2659
wled00/html_ui.h
2659
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user