fix errors when width>255 or height>255
some effects still don't work when x y dimensions do not fit into 8bit
This commit is contained in:
@@ -8421,7 +8421,7 @@ uint16_t mode_2Doctopus() {
|
||||
|
||||
const uint16_t cols = SEGMENT.virtualWidth();
|
||||
const uint16_t rows = SEGMENT.virtualHeight();
|
||||
const uint8_t mapp = 180 / MAX(cols,rows);
|
||||
const uint16_t mapp = max(1, 180 / MAX(cols,rows)); // WLEDMM make sure this value is not 0
|
||||
|
||||
typedef struct {
|
||||
uint8_t angle;
|
||||
@@ -8458,8 +8458,8 @@ uint16_t mode_2Doctopus() {
|
||||
SEGENV.aux1 = rows;
|
||||
*offsX = SEGMENT.custom1;
|
||||
*offsY = SEGMENT.custom2;
|
||||
const uint8_t C_X = cols / 2 + (SEGMENT.custom1 - 128)*cols/255;
|
||||
const uint8_t C_Y = rows / 2 + (SEGMENT.custom2 - 128)*rows/255;
|
||||
const uint16_t C_X = cols / 2 + (SEGMENT.custom1 - 128)*cols/255;
|
||||
const uint16_t C_Y = rows / 2 + (SEGMENT.custom2 - 128)*rows/255;
|
||||
for (int x = xStart; x < xEnd; x++) {
|
||||
for (int y = yStart; y < yEnd; y++) {
|
||||
rMap[XY(x, y)].angle = int(40.7436f * atan2f((y - C_Y), (x - C_X))); // avoid 128*atan2()/PI
|
||||
|
||||
12
wled00/FX.h
12
wled00/FX.h
@@ -390,8 +390,8 @@ typedef struct Segment {
|
||||
bool check2 : 1; // checkmark 2
|
||||
bool check3 : 1; // checkmark 3
|
||||
};
|
||||
uint8_t startY; // start Y coodrinate 2D (top); there should be no more than 255 rows
|
||||
uint8_t stopY; // stop Y coordinate 2D (bottom); there should be no more than 255 rows
|
||||
uint16_t startY; // start Y coodrinate 2D (top); there should be no more than 255 rows, but we cannot be sure.
|
||||
uint16_t stopY; // stop Y coordinate 2D (bottom); there should be no more than 255 rows, but we cannot be sure.
|
||||
char *name = nullptr; // WLEDMM initialize to nullptr
|
||||
|
||||
// runtime data
|
||||
@@ -1017,10 +1017,10 @@ class WS2812FX { // 96 bytes
|
||||
} panelO; //panelOrientation
|
||||
|
||||
typedef struct panel_t {
|
||||
uint8_t xOffset; // x offset relative to the top left of matrix in LEDs. WLEDMM 8 bits/256 is enough
|
||||
uint8_t yOffset; // y offset relative to the top left of matrix in LEDs. WLEDMM 8 bits/256 is enough
|
||||
uint8_t width; // width of the panel
|
||||
uint8_t height; // height of the panel
|
||||
uint16_t xOffset; // x offset relative to the top left of matrix in LEDs.
|
||||
uint16_t yOffset; // y offset relative to the top left of matrix in LEDs.
|
||||
uint16_t width; // width of the panel
|
||||
uint16_t height; // height of the panel
|
||||
union {
|
||||
uint8_t options;
|
||||
struct {
|
||||
|
||||
@@ -129,11 +129,11 @@ void WS2812FX::setUpMatrix() {
|
||||
}
|
||||
|
||||
if (needLedMap && customMappingTable != nullptr) { // softhack007
|
||||
uint16_t x, y, pix=0; //pixel
|
||||
uint_fast16_t x, y, pix=0; //pixel
|
||||
for (size_t pan = 0; pan < panel.size(); pan++) {
|
||||
Panel &p = panel[pan];
|
||||
uint16_t h = p.vertical ? p.height : p.width;
|
||||
uint16_t v = p.vertical ? p.width : p.height;
|
||||
uint_fast16_t h = p.vertical ? p.height : p.width;
|
||||
uint_fast16_t v = p.vertical ? p.width : p.height;
|
||||
for (size_t j = 0; j < v; j++){
|
||||
for(size_t i = 0; i < h; i++) {
|
||||
y = (p.vertical?p.rightStart:p.bottomStart) ? v-j-1 : j;
|
||||
|
||||
@@ -111,9 +111,9 @@ Orientation: <select id="P${i}V" name="P${i}V" oninput="draw()">
|
||||
<option value="1">Vertical</option>
|
||||
</select><br>
|
||||
Serpentine: <input id="P${i}S" name="P${i}S" type="checkbox" onclick="draw()"><br>
|
||||
Dimensions (WxH): <input id="P${i}W" name="P${i}W" type="number" min="1" max="255" value="${pw}" oninput="draw()"> x <input id="P${i}H" name="P${i}H" type="number" min="1" max="255" value="${ph}" oninput="draw()"><br>
|
||||
Offset X:<input id="P${i}X" name="P${i}X" type="number" min="0" max="255" value="0" oninput="draw()">
|
||||
Y:<input id="P${i}Y" name="P${i}Y" type="number" min="0" max="255" value="0" oninput="draw()"><br><i>(offset from top-left corner in # LEDs)</i>
|
||||
Dimensions (WxH): <input id="P${i}W" name="P${i}W" type="number" min="1" max="1023" value="${pw}" oninput="draw()"> x <input id="P${i}H" name="P${i}H" type="number" min="1" max="1023" value="${ph}" oninput="draw()"><br>
|
||||
Offset X:<input id="P${i}X" name="P${i}X" type="number" min="0" max="1023" value="0" oninput="draw()">
|
||||
Y:<input id="P${i}Y" name="P${i}Y" type="number" min="0" max="1023" value="0" oninput="draw()"><br><i>(offset from top-left corner in # LEDs)</i>
|
||||
</div>`;
|
||||
p.insertAdjacentHTML("beforeend", b);
|
||||
}
|
||||
@@ -401,7 +401,7 @@ Y:<input id="P${i}Y" name="P${i}Y" type="number" min="0" max="255" value="0" oni
|
||||
<h3 id="title">Matrix Generator <button type="button" id="expGen" onclick="expand(this,gId('mxGen'));">></button></h3>
|
||||
</div>
|
||||
<div id="mxGen" style="display:none;">
|
||||
Panel dimensions (WxH): <input name="PW" type="number" min="1" max="255" value="8" oninput="fieldChange()"> x <input name="PH" type="number" min="1" max="255" value="8" oninput="fieldChange()"><br>
|
||||
Panel dimensions (WxH): <input name="PW" type="number" min="1" max="1023" value="8" oninput="fieldChange()"> x <input name="PH" type="number" min="1" max="1023" value="8" oninput="fieldChange()"><br>
|
||||
Horizontal panels: <input name="MPH" type="number" min="1" max="8" value="1" oninput="fieldChange()">
|
||||
Vertical panels: <input name="MPV" type="number" min="1" max="8" value="1" oninput="fieldChange()"><br>
|
||||
<div id="blockPanelOrientation">
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
// version code in format yymmddb (b = daily build)
|
||||
#define VERSION 2411080
|
||||
#define VERSION 2411130
|
||||
|
||||
// WLEDMM - you can check for this define in usermods, to only enabled WLEDMM specific code in the "right" fork. Its not defined in AC WLED.
|
||||
#define _MoonModules_WLED_
|
||||
|
||||
Reference in New Issue
Block a user