Skip to content

Add options for vertical, extra led and meander layout #582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions include/Uhr.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ struct GLOBAL {
MinuteVariant minuteVariant;
ItIsVariant itIsVariant;
bool languageVariant[6];
bool layoutVariant[3];
bool layoutVariant[6];
char timeserver[PAYLOAD_LENGTH];
char hostname[PAYLOAD_LENGTH];
char scrollingText[PAYLOAD_LENGTH];
Expand Down Expand Up @@ -206,6 +206,9 @@ enum LayoutVariants {
ReverseMinDirection = 0,
MirrorVertical = 1,
MirrorHorizontal = 2,
FlipHorzVert = 3,
ExtraLedPerRow = 4,
MeanderRows = 5,
};

enum fontSize {
Expand Down Expand Up @@ -275,7 +278,6 @@ enum ClockType {
Ger10x11 = 1,
Ger10x11Alternative = 2,
Ger10x11AlternativeFrame = 4,
Ger10x11Vertical = 12,
Ger10x11Clock = 6,
Ger10x11schwaebisch = 20,
Ger10x11Nero = 11,
Expand Down
22 changes: 0 additions & 22 deletions include/Uhrtypes/DE08x08.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,6 @@ class De08x08_t : public iUhrType {

//------------------------------------------------------------------------------

virtual const uint16_t getFrontMatrixIndex(const uint8_t row, uint8_t col) {

uint8_t newColsWordMatrix = colsWordMatrix();
uint16_t numPixelsWordMatrix = rowsWordMatrix() * colsWordMatrix();

if (G.buildTypeDef == BuildTypeDef::DoubleResM1) {
newColsWordMatrix = 2 * colsWordMatrix() - 1;
numPixelsWordMatrix = rowsWordMatrix() * newColsWordMatrix;
col *= 2;
}
uint16_t returnValue = col + (row * newColsWordMatrix);

if (returnValue > numPixelsWordMatrix) {
Serial.println(
"[ERROR] getFrontMatrixIndex() returnValue out of Bounds");
}

return returnValue;
};

//------------------------------------------------------------------------------

virtual const uint8_t rowsWordMatrix() override { return 8; };

//------------------------------------------------------------------------------
Expand Down
24 changes: 2 additions & 22 deletions include/Uhrtypes/DE08x08.viertel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,6 @@ class De08x08Viertel_t : public iUhrType {

//------------------------------------------------------------------------------

virtual const uint16_t getFrontMatrixIndex(const uint8_t row, uint8_t col) {

uint8_t newColsWordMatrix = colsWordMatrix();
uint16_t numPixelsWordMatrix = rowsWordMatrix() * colsWordMatrix();

if (G.buildTypeDef == BuildTypeDef::DoubleResM1) {
newColsWordMatrix = 2 * colsWordMatrix() - 1;
numPixelsWordMatrix = rowsWordMatrix() * newColsWordMatrix;
col *= 2;
}
uint16_t returnValue = col + (row * newColsWordMatrix);

if (returnValue > numPixelsWordMatrix) {
Serial.println(
"[ERROR] getFrontMatrixIndex() returnValue out of Bounds");
}

return returnValue;
};

//------------------------------------------------------------------------------

virtual const uint8_t rowsWordMatrix() override { return 8; };

//------------------------------------------------------------------------------
Expand All @@ -57,6 +35,8 @@ class De08x08Viertel_t : public iUhrType {

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

//------------------------------------------------------------------------------

virtual const bool hasOnlyQuarterLayout() override { return true; }

//------------------------------------------------------------------------------
Expand Down
49 changes: 0 additions & 49 deletions include/Uhrtypes/DE10x11.vertical.hpp

This file was deleted.

22 changes: 0 additions & 22 deletions include/Uhrtypes/EN08x08.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,6 @@ class En08x08_t : public iUhrType {

//------------------------------------------------------------------------------

virtual const uint16_t getFrontMatrixIndex(const uint8_t row, uint8_t col) {

uint8_t newColsWordMatrix = colsWordMatrix();
uint16_t numPixelsWordMatrix = rowsWordMatrix() * colsWordMatrix();

if (G.buildTypeDef == BuildTypeDef::DoubleResM1) {
newColsWordMatrix = 2 * colsWordMatrix() - 1;
numPixelsWordMatrix = rowsWordMatrix() * newColsWordMatrix;
col *= 2;
}
uint16_t returnValue = col + (row * newColsWordMatrix);

if (returnValue > numPixelsWordMatrix) {
Serial.println(
"[ERROR] getFrontMatrixIndex() returnValue out of Bounds");
}

return returnValue;
};

//------------------------------------------------------------------------------

virtual const uint8_t rowsWordMatrix() override { return 8; };

//------------------------------------------------------------------------------
Expand Down
22 changes: 0 additions & 22 deletions include/Uhrtypes/ES08x08.cuarto.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,6 @@ class Es08x08Cuarto_t : public iUhrType {

//------------------------------------------------------------------------------

virtual const uint16_t getFrontMatrixIndex(const uint8_t row, uint8_t col) {

uint8_t newColsWordMatrix = colsWordMatrix();
uint16_t numPixelsWordMatrix = rowsWordMatrix() * colsWordMatrix();

if (G.buildTypeDef == BuildTypeDef::DoubleResM1) {
newColsWordMatrix = 2 * colsWordMatrix() - 1;
numPixelsWordMatrix = rowsWordMatrix() * newColsWordMatrix;
col *= 2;
}
uint16_t returnValue = col + (row * newColsWordMatrix);

if (returnValue > numPixelsWordMatrix) {
Serial.println(
"[ERROR] getFrontMatrixIndex() returnValue out of Bounds");
}

return returnValue;
};

//------------------------------------------------------------------------------

virtual const uint8_t rowsWordMatrix() override { return 8; };

//------------------------------------------------------------------------------
Expand Down
32 changes: 28 additions & 4 deletions include/Uhrtypes/Uhrtype.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class iUhrType {

virtual const bool hasSpecialWordBeen() { return false; }

virtual const uint16_t getFrontMatrixIndex(const uint8_t row, uint8_t col) {
virtual const uint16_t getFrontMatrixIndex(uint8_t row, uint8_t col) {

uint8_t newColsWordMatrix = colsWordMatrix();
uint16_t numPixelsWordMatrix = rowsWordMatrix() * colsWordMatrix();
Expand All @@ -216,10 +216,27 @@ class iUhrType {
numPixelsWordMatrix = rowsWordMatrix() * newColsWordMatrix;
col *= 2;
}
if (row % 2 != 0) {
col = newColsWordMatrix - col - 1;

uint16_t returnValue;
if (G.layoutVariant[FlipHorzVert] == false) {
if (G.layoutVariant[MeanderRows] && (row % 2 != 0)) {
col = newColsWordMatrix - col - 1;
}
returnValue = col + (row * newColsWordMatrix);
if (G.layoutVariant[ExtraLedPerRow]) {
returnValue += row;
numPixelsWordMatrix += rowsWordMatrix() - 1;
}
} else {
if (G.layoutVariant[MeanderRows] && (col % 2 == 0)) {
row = rowsWordMatrix() - 1 - row;
}
returnValue = row + rowsWordMatrix() * (newColsWordMatrix - 1 - col);
if (G.layoutVariant[ExtraLedPerRow]) {
returnValue += colsWordMatrix() - 1 - col;
numPixelsWordMatrix += colsWordMatrix() - 1;
}
}
uint16_t returnValue = col + (row * newColsWordMatrix);

if (returnValue > numPixelsWordMatrix) {
Serial.println(
Expand All @@ -235,6 +252,13 @@ class iUhrType {
if (G.buildTypeDef == BuildTypeDef::DoubleResM1) {
numPixelsWordMatrix = rowsWordMatrix() * (colsWordMatrix() * 2 - 1);
}
if (G.layoutVariant[ExtraLedPerRow]) {
if (G.layoutVariant[FlipHorzVert] == false) {
numPixelsWordMatrix += rowsWordMatrix() - 1;
} else {
numPixelsWordMatrix += colsWordMatrix() - 1;
}
}

for (uint8_t i = 0; i < 4; i++) {
switch (col) {
Expand Down
2 changes: 0 additions & 2 deletions include/clockWork.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ iUhrType *ClockWork::getPointer(uint8_t type) {
return &_de10x11Alternative;
case Ger10x11AlternativeFrame:
return &_de10x11AlternativeFrame;
case Ger10x11Vertical:
return &_de10x11Vertical;
case Ger10x11Clock:
return &_de10x11Clock;
case Ger10x11Nero:
Expand Down
8 changes: 7 additions & 1 deletion include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,13 @@
* Valid values REVERSE_MINUTE_DIR [true, false]
* Valid values MIRROR_FRONT_VERTICAL [true, false]
* Valid values MIRROR_FRONT_HORIZONTAL [true, false]
* Valid values EXTRA_LED_PER_ROW [true, false]
* Valid values FLIP_HORIZONTAL_VERTICAL [true, false]
* Valid values MEANDER_ROWS [true, false]
*/
#define REVERSE_MINUTE_DIR false
#define MIRROR_FRONT_VERTICAL false
#define MIRROR_FRONT_HORIZONTAL false
#define MIRROR_FRONT_HORIZONTAL false
#define EXTRA_LED_PER_ROW false
#define FLIP_HORIZONTAL_VERTICAL false
#define MEANDER_ROWS true
3 changes: 3 additions & 0 deletions include/webPageAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,9 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t *payload,
G.layoutVariant[ReverseMinDirection] = split(payload, 3);
G.layoutVariant[MirrorVertical] = split(payload, 6);
G.layoutVariant[MirrorHorizontal] = split(payload, 9);
G.layoutVariant[FlipHorzVert] = split(payload, 12);
G.layoutVariant[ExtraLedPerRow] = split(payload, 15);
G.layoutVariant[MeanderRows] = split(payload, 18);
break;
}

Expand Down
3 changes: 3 additions & 0 deletions src/Wortuhr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ void setup() {
G.layoutVariant[ReverseMinDirection] = REVERSE_MINUTE_DIR;
G.layoutVariant[MirrorVertical] = MIRROR_FRONT_VERTICAL;
G.layoutVariant[MirrorHorizontal] = MIRROR_FRONT_HORIZONTAL;
G.layoutVariant[FlipHorzVert] = FLIP_HORIZONTAL_VERTICAL;
G.layoutVariant[ExtraLedPerRow] = EXTRA_LED_PER_ROW;
G.layoutVariant[MeanderRows] = MEANDER_ROWS;
for (uint8_t i = 0;
i < sizeof(G.languageVariant) / sizeof(G.languageVariant[0]);
i++) {
Expand Down
22 changes: 21 additions & 1 deletion webpage/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ <h2 data-i18next="view.front.h2"></h2>
<option value="1" data-i18next="view.front.de-10-11" selected></option>
<option value="2" data-i18next="view.front.de-10-11-alt"></option>
<option value="4" data-i18next="view.front.de-10-11-alt-frame"></option>
<option value="12" data-i18next="view.front.de-10-11-vertical"></option>
<option value="6" data-i18next="view.front.de-10-11-clock"></option>
<option value="20" data-i18next="view.front.de-10-11-schwaebisch"></option>
<option value="11" data-i18next="view.front.de-10-11-nero"></option>
Expand Down Expand Up @@ -392,6 +391,27 @@ <h2 data-i18next="view.front.h2"></h2>
<span class="slider round"></span>
</label>
</div>
<div class="pure-control-group">
<label for="layvar-3" data-i18next="view.front.flip-horz-vert"></label>
<label class="switch">
<input type="checkbox" id="layvar-3">
<span class="slider round"></span>
</label>
</div>
<div class="pure-control-group">
<label for="layvar-4" data-i18next="view.front.extra-led-per-row"></label>
<label class="switch">
<input type="checkbox" id="layvar-4">
<span class="slider round"></span>
</label>
</div>
<div class="pure-control-group">
<label for="layvar-5" data-i18next="view.front.meander-rows"></label>
<label class="switch">
<input type="checkbox" id="layvar-5">
<span class="slider round"></span>
</label>
</div>
<div class="pure-control-group">
<label for="buildtype" data-i18next="view.front.buildtype"></label><select name="buildtype" id="buildtype" size="1">
<option value="0" data-i18next="view.front.normal" selected></option>
Expand Down
4 changes: 3 additions & 1 deletion webpage/language/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ let TRANSLATION_DE_DE = {
"de-10-11": "🇩🇪 10 × 11",
"de-10-11-alt": "🇩🇪 10 × 11 Alternativ",
"de-10-11-alt-frame": "🇩🇪 10 × 11 Alternativer Rahmen",
"de-10-11-vertical": "🇩🇪 10 × 11 Vertikal",
"de-10-11-clock": "🇩🇪 10 × 11 Uhr",
"de-10-11-nero": "🇩🇪 10 × 11 Nero",
"de-10-11-nero-frame": "🇩🇪 10 × 11 Nero Rahmen",
Expand Down Expand Up @@ -156,6 +155,9 @@ let TRANSLATION_DE_DE = {
"invert-min-dir": "Minutenzählrichtung invertieren",
"mirror-vertically": "Wortuhr vertikal spiegeln",
"mirror-horizontally": "Wortuhr horizontal spiegeln",
"flip-horz-vert": "Horizontales und vertikales Layout drehen",
"extra-led-per-row": "Extra LED pro Reihe hinzufügen",
"meander-rows": "Reihen in Mäander angeordnet",
"buildtype": "Bauart",
"normal": "Jede LED entspricht einem Buchstaben",
"doubleResM1": "Jede zweite LED entspricht einem Buchstaben",
Expand Down
4 changes: 3 additions & 1 deletion webpage/language/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ let TRANSLATION_EN_US = {
"de-10-11": "🇩🇪 10 × 11",
"de-10-11-alt": "🇩🇪 10 × 11 Alternative",
"de-10-11-alt-frame": "🇩🇪 10 × 11 Alternative Frame",
"de-10-11-vertical": "🇩🇪 10 × 11 Vertical",
"de-10-11-clock": "🇩🇪 10 × 11 Clock",
"de-10-11-nero": "🇩🇪 10 × 11 Nero",
"de-10-11-nero-frame": "🇩🇪 10 × 11 Nero Frame",
Expand Down Expand Up @@ -156,6 +155,9 @@ let TRANSLATION_EN_US = {
"invert-min-dir": "Invert Minute Counting Direction",
"mirror-vertically": "Mirror Word Clock Vertically",
"mirror-horizontally": "Mirror Word Clock Horizontally",
"extra-led-per-row": "Add Extra LED per Row",
"flip-horz-vert": "Flip Horizontally and Vertically Layout",
"meander-rows": "Rows placed in meanders",
"buildtype": "Buildtype",
"normal": "Each LED corresponds to one letter",
"doubleResM1": "Every second LED corresponds to one letter",
Expand Down
1 change: 0 additions & 1 deletion webpage/language/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ let TRANSLATION_ES = {
"de-10-11": "🇩🇪 10 × 11",
"de-10-11-alt": "🇩🇪 10 × 11 Alternativ",
"de-10-11-alt-frame": "🇩🇪 10 × 11 Alternativer Rahmen",
"de-10-11-vertical": "🇩🇪 10 × 11 Vertikal",
"de-10-11-clock": "🇩🇪 10 × 11 Uhr",
"de-10-11-nero": "🇩🇪 10 × 11 Nero",
"de-10-11-nero-frame": "🇩🇪 10 × 11 Nero Rahmen",
Expand Down
1 change: 0 additions & 1 deletion webpage/language/hu.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ let TRANSLATION_HU = {
"de-10-11": "🇩🇪 10 × 11",
"de-10-11-alt": "🇩🇪 10 × 11 Alternatív",
"de-10-11-alt-frame": "🇩🇪 10 × 11 Alternatív keretek",
"de-10-11-vertical": "🇩🇪 10 × 11 függőleges",
"de-10-11-clock": "🇩🇪 10 × 11 óra",
"de-10-11-nero": "🇩🇪 10 × 11 Nero",
"de-10-11-nero-frame": "🇩🇪 10 × 11 Nero keretek",
Expand Down
1 change: 0 additions & 1 deletion webpage/language/it.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ let TRANSLATION_IT = {
"de-10-11": "🇩🇪 10 × 11",
"de-10-11-alt": "🇩🇪 10 × 11 Alternativ",
"de-10-11-alt-frame": "🇩🇪 10 × 11 Alternativer Rahmen",
"de-10-11-vertical": "🇩🇪 10 × 11 Vertikal",
"de-10-11-clock": "🇩🇪 10 × 11 Uhr",
"de-10-11-nero": "🇩🇪 10 × 11 Nero",
"de-10-11-nero-frame": "🇩🇪 10 × 11 Nero Rahmen",
Expand Down
Loading