Skip to content

Commit ef1ac0b

Browse files
authored
Merge pull request #582 from BastiMu/Add-options-for-vertical,-extra-led-and-meander-layout
Add options for vertical, extra led and meander layout
2 parents f6c9b9a + a562f1d commit ef1ac0b

20 files changed

+84
-157
lines changed

include/Uhr.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ struct GLOBAL {
113113
MinuteVariant minuteVariant;
114114
ItIsVariant itIsVariant;
115115
bool languageVariant[6];
116-
bool layoutVariant[3];
116+
bool layoutVariant[6];
117117
char timeserver[PAYLOAD_LENGTH];
118118
char hostname[PAYLOAD_LENGTH];
119119
char scrollingText[PAYLOAD_LENGTH];
@@ -207,6 +207,9 @@ enum LayoutVariants {
207207
ReverseMinDirection = 0,
208208
MirrorVertical = 1,
209209
MirrorHorizontal = 2,
210+
FlipHorzVert = 3,
211+
ExtraLedPerRow = 4,
212+
MeanderRows = 5,
210213
};
211214

212215
enum fontSize {
@@ -277,7 +280,6 @@ enum ClockType {
277280
Ger10x11 = 1,
278281
Ger10x11Alternative = 2,
279282
Ger10x11AlternativeFrame = 4,
280-
Ger10x11Vertical = 12,
281283
Ger10x11Clock = 6,
282284
Ger10x11schwaebisch = 20,
283285
Ger10x11Nero = 11,

include/Uhrtypes/DE08x08.hpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,6 @@ class De08x08_t : public iUhrType {
2525

2626
//------------------------------------------------------------------------------
2727

28-
virtual const uint16_t getFrontMatrixIndex(const uint8_t row, uint8_t col) {
29-
30-
uint8_t newColsWordMatrix = colsWordMatrix();
31-
uint16_t numPixelsWordMatrix = rowsWordMatrix() * colsWordMatrix();
32-
33-
if (G.buildTypeDef == BuildTypeDef::DoubleResM1) {
34-
newColsWordMatrix = 2 * colsWordMatrix() - 1;
35-
numPixelsWordMatrix = rowsWordMatrix() * newColsWordMatrix;
36-
col *= 2;
37-
}
38-
uint16_t returnValue = col + (row * newColsWordMatrix);
39-
40-
if (returnValue > numPixelsWordMatrix) {
41-
Serial.println(
42-
"[ERROR] getFrontMatrixIndex() returnValue out of Bounds");
43-
}
44-
45-
return returnValue;
46-
};
47-
48-
//------------------------------------------------------------------------------
49-
5028
virtual const uint8_t rowsWordMatrix() override { return 8; };
5129

5230
//------------------------------------------------------------------------------

include/Uhrtypes/DE08x08.viertel.hpp

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,6 @@ class De08x08Viertel_t : public iUhrType {
2525

2626
//------------------------------------------------------------------------------
2727

28-
virtual const uint16_t getFrontMatrixIndex(const uint8_t row, uint8_t col) {
29-
30-
uint8_t newColsWordMatrix = colsWordMatrix();
31-
uint16_t numPixelsWordMatrix = rowsWordMatrix() * colsWordMatrix();
32-
33-
if (G.buildTypeDef == BuildTypeDef::DoubleResM1) {
34-
newColsWordMatrix = 2 * colsWordMatrix() - 1;
35-
numPixelsWordMatrix = rowsWordMatrix() * newColsWordMatrix;
36-
col *= 2;
37-
}
38-
uint16_t returnValue = col + (row * newColsWordMatrix);
39-
40-
if (returnValue > numPixelsWordMatrix) {
41-
Serial.println(
42-
"[ERROR] getFrontMatrixIndex() returnValue out of Bounds");
43-
}
44-
45-
return returnValue;
46-
};
47-
48-
//------------------------------------------------------------------------------
49-
5028
virtual const uint8_t rowsWordMatrix() override { return 8; };
5129

5230
//------------------------------------------------------------------------------
@@ -57,6 +35,8 @@ class De08x08Viertel_t : public iUhrType {
5735

5836
virtual const bool hasZwanzig() override { return false; }
5937

38+
//------------------------------------------------------------------------------
39+
6040
virtual const bool hasOnlyQuarterLayout() override { return true; }
6141

6242
//------------------------------------------------------------------------------

include/Uhrtypes/DE10x11.vertical.hpp

Lines changed: 0 additions & 49 deletions
This file was deleted.

include/Uhrtypes/EN08x08.hpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,6 @@ class En08x08_t : public iUhrType {
2525

2626
//------------------------------------------------------------------------------
2727

28-
virtual const uint16_t getFrontMatrixIndex(const uint8_t row, uint8_t col) {
29-
30-
uint8_t newColsWordMatrix = colsWordMatrix();
31-
uint16_t numPixelsWordMatrix = rowsWordMatrix() * colsWordMatrix();
32-
33-
if (G.buildTypeDef == BuildTypeDef::DoubleResM1) {
34-
newColsWordMatrix = 2 * colsWordMatrix() - 1;
35-
numPixelsWordMatrix = rowsWordMatrix() * newColsWordMatrix;
36-
col *= 2;
37-
}
38-
uint16_t returnValue = col + (row * newColsWordMatrix);
39-
40-
if (returnValue > numPixelsWordMatrix) {
41-
Serial.println(
42-
"[ERROR] getFrontMatrixIndex() returnValue out of Bounds");
43-
}
44-
45-
return returnValue;
46-
};
47-
48-
//------------------------------------------------------------------------------
49-
5028
virtual const uint8_t rowsWordMatrix() override { return 8; };
5129

5230
//------------------------------------------------------------------------------

include/Uhrtypes/ES08x08.cuarto.hpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,6 @@ class Es08x08Cuarto_t : public iUhrType {
2525

2626
//------------------------------------------------------------------------------
2727

28-
virtual const uint16_t getFrontMatrixIndex(const uint8_t row, uint8_t col) {
29-
30-
uint8_t newColsWordMatrix = colsWordMatrix();
31-
uint16_t numPixelsWordMatrix = rowsWordMatrix() * colsWordMatrix();
32-
33-
if (G.buildTypeDef == BuildTypeDef::DoubleResM1) {
34-
newColsWordMatrix = 2 * colsWordMatrix() - 1;
35-
numPixelsWordMatrix = rowsWordMatrix() * newColsWordMatrix;
36-
col *= 2;
37-
}
38-
uint16_t returnValue = col + (row * newColsWordMatrix);
39-
40-
if (returnValue > numPixelsWordMatrix) {
41-
Serial.println(
42-
"[ERROR] getFrontMatrixIndex() returnValue out of Bounds");
43-
}
44-
45-
return returnValue;
46-
};
47-
48-
//------------------------------------------------------------------------------
49-
5028
virtual const uint8_t rowsWordMatrix() override { return 8; };
5129

5230
//------------------------------------------------------------------------------

include/Uhrtypes/Uhrtype.hpp

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ class iUhrType {
206206

207207
virtual const bool hasSpecialWordBeen() { return false; }
208208

209-
virtual const uint16_t getFrontMatrixIndex(const uint8_t row, uint8_t col) {
209+
virtual const uint16_t getFrontMatrixIndex(uint8_t row, uint8_t col) {
210210

211211
uint8_t newColsWordMatrix = colsWordMatrix();
212212
uint16_t numPixelsWordMatrix = rowsWordMatrix() * colsWordMatrix();
@@ -216,10 +216,28 @@ class iUhrType {
216216
numPixelsWordMatrix = rowsWordMatrix() * newColsWordMatrix;
217217
col *= 2;
218218
}
219-
if (row % 2 != 0) {
220-
col = newColsWordMatrix - col - 1;
219+
220+
uint16_t returnValue;
221+
if (G.layoutVariant[FlipHorzVert] == false) {
222+
if (G.layoutVariant[MeanderRows] && (row % 2 != 0)) {
223+
col = newColsWordMatrix - col - 1;
224+
}
225+
returnValue = col + (row * newColsWordMatrix);
226+
if (G.layoutVariant[ExtraLedPerRow]) {
227+
returnValue += row;
228+
numPixelsWordMatrix += rowsWordMatrix() - 1;
229+
}
230+
} else {
231+
if (G.layoutVariant[MeanderRows] && (col % 2 == 0)) {
232+
row = rowsWordMatrix() - 1 - row;
233+
}
234+
returnValue =
235+
row + rowsWordMatrix() * (newColsWordMatrix - 1 - col);
236+
if (G.layoutVariant[ExtraLedPerRow]) {
237+
returnValue += colsWordMatrix() - 1 - col;
238+
numPixelsWordMatrix += colsWordMatrix() - 1;
239+
}
221240
}
222-
uint16_t returnValue = col + (row * newColsWordMatrix);
223241

224242
if (returnValue > numPixelsWordMatrix) {
225243
Serial.println(
@@ -235,6 +253,13 @@ class iUhrType {
235253
if (G.buildTypeDef == BuildTypeDef::DoubleResM1) {
236254
numPixelsWordMatrix = rowsWordMatrix() * (colsWordMatrix() * 2 - 1);
237255
}
256+
if (G.layoutVariant[ExtraLedPerRow]) {
257+
if (G.layoutVariant[FlipHorzVert] == false) {
258+
numPixelsWordMatrix += rowsWordMatrix() - 1;
259+
} else {
260+
numPixelsWordMatrix += colsWordMatrix() - 1;
261+
}
262+
}
238263

239264
for (uint8_t i = 0; i < 4; i++) {
240265
switch (col) {

include/clockWork.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ iUhrType *ClockWork::getPointer(uint8_t type) {
112112
return &_de10x11Alternative;
113113
case Ger10x11AlternativeFrame:
114114
return &_de10x11AlternativeFrame;
115-
case Ger10x11Vertical:
116-
return &_de10x11Vertical;
117115
case Ger10x11Clock:
118116
return &_de10x11Clock;
119117
case Ger10x11Nero:

include/config.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,13 @@
355355
* Valid values REVERSE_MINUTE_DIR [true, false]
356356
* Valid values MIRROR_FRONT_VERTICAL [true, false]
357357
* Valid values MIRROR_FRONT_HORIZONTAL [true, false]
358+
* Valid values EXTRA_LED_PER_ROW [true, false]
359+
* Valid values FLIP_HORIZONTAL_VERTICAL [true, false]
360+
* Valid values MEANDER_ROWS [true, false]
358361
*/
359362
#define REVERSE_MINUTE_DIR false
360363
#define MIRROR_FRONT_VERTICAL false
361-
#define MIRROR_FRONT_HORIZONTAL false
364+
#define MIRROR_FRONT_HORIZONTAL false
365+
#define EXTRA_LED_PER_ROW false
366+
#define FLIP_HORIZONTAL_VERTICAL false
367+
#define MEANDER_ROWS true

include/webPageAdapter.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,9 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t *payload,
399399
G.layoutVariant[ReverseMinDirection] = split(payload, 3);
400400
G.layoutVariant[MirrorVertical] = split(payload, 6);
401401
G.layoutVariant[MirrorHorizontal] = split(payload, 9);
402+
G.layoutVariant[FlipHorzVert] = split(payload, 12);
403+
G.layoutVariant[ExtraLedPerRow] = split(payload, 15);
404+
G.layoutVariant[MeanderRows] = split(payload, 18);
402405
break;
403406
}
404407

0 commit comments

Comments
 (0)