diff --git a/wled00/FX.cpp b/wled00/FX.cpp
index 0bface88..79614d22 100644
--- a/wled00/FX.cpp
+++ b/wled00/FX.cpp
@@ -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
diff --git a/wled00/FX.h b/wled00/FX.h
index 413b87cd..c0693462 100644
--- a/wled00/FX.h
+++ b/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 {
diff --git a/wled00/FX_2Dfcn.cpp b/wled00/FX_2Dfcn.cpp
index 57612247..f6d2bc0b 100644
--- a/wled00/FX_2Dfcn.cpp
+++ b/wled00/FX_2Dfcn.cpp
@@ -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;
diff --git a/wled00/data/settings_2D.htm b/wled00/data/settings_2D.htm
index c602b98c..c57bf3d9 100644
--- a/wled00/data/settings_2D.htm
+++ b/wled00/data/settings_2D.htm
@@ -111,9 +111,9 @@ Orientation:
Serpentine:
-Dimensions (WxH): x
-Offset X:
-Y:
(offset from top-left corner in # LEDs)
+Dimensions (WxH): x
+Offset X:
+Y:
(offset from top-left corner in # LEDs)
`;
p.insertAdjacentHTML("beforeend", b);
}
@@ -401,7 +401,7 @@ Y:Matrix Generator