Skip to content
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

Release 4.1.0 #508

Open
wants to merge 9 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
Binary file removed docs/~$leitung-Wort-Uhr.docx
Binary file not shown.
11 changes: 11 additions & 0 deletions erase_before_upload.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Import("env")

old_uploaderflags = env["UPLOADERFLAGS"]
#print("Old uploaderflags: " + str(old_uploaderflags))

index_write_flash = old_uploaderflags.index("write_flash")
if index_write_flash != -1:
new_uploaderflags = old_uploaderflags[::]
new_uploaderflags.insert(index_write_flash + 1, "--erase-all")
#print("Replaced with: " + str(new_uploaderflags))
env.Replace(UPLOADERFLAGS=new_uploaderflags)
2 changes: 1 addition & 1 deletion include/Transitiontypes/Transition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,7 @@ void Transition::loop(struct tm &tm) {
setMinute();
if (G.secondVariant != SecondVariant::Off) {
led.setbySecondArray();
// Workaround: setbySecoundArray not in 'work'
// Workaround: setbySecondArray not in 'work'
}
}
led.show();
Expand Down
13 changes: 11 additions & 2 deletions include/Uhr.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ enum class WordclockChanges {
Words,
};

enum class ItIsVariant {
Permanent = 0,
Quarterly = 1,
HalfHourly = 2,
Hourly = 3,
Off = 4,
};

struct GLOBAL {
uint16_t sernr;
uint16_t prog;
Expand All @@ -103,6 +111,7 @@ struct GLOBAL {
uint8_t client_nr;
SecondVariant secondVariant;
MinuteVariant minuteVariant;
ItIsVariant itIsVariant;
bool languageVariant[6];
bool layoutVariant[3];
char timeserver[PAYLOAD_LENGTH];
Expand Down Expand Up @@ -190,8 +199,7 @@ enum LanguageDialects {
ItIs20 = 1,
ItIs40 = 2,
ItIs45 = 3,
NotShowItIs = 4,
EN_ShowAQuarter = 5,
EN_ShowAQuarter = 4,
};

enum LayoutVariants {
Expand Down Expand Up @@ -285,6 +293,7 @@ enum ClockType {
Fr10x11 = 21,
Se10x11 = 22,
Ru10x11 = 23,
Ch10x11V2 = 24,
};

enum Icons {
Expand Down
130 changes: 130 additions & 0 deletions include/Uhrtypes/CH10x11v2.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
#pragma once

#include "CH10x11.hpp"

/*
* Layout Front
* COL
* X 9 8 7 6 5 4 3 2 1 0
* ROW + - - - - - - - - - - -
* 0 | E S K I S C H U F Ü F
* 1 | V I E R T U N F Z Ä Ä
* 2 | Z W Ä N Z G S E V O R
* 3 | A B C H A U B I E C M
* 4 | E I S Z W Ö I S D R Ü
* 5 | V I E R I F Ü F I S T
* 6 | S Ä C H S I S I B N I
* 7 | A C H T I N Ü N I E L
* 8 | Z Ä N I E C H E U F I
* 9 | Z W Ö U F I E N G S I
*/

class Ch10x11V2_t : public Ch10x11_t {
public:
virtual LanguageAbbreviation usedLang() override {
return LanguageAbbreviation::DE;
};

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

void show(FrontWord word) override {
switch (word) {

case FrontWord::es_ist:
setFrontMatrixWord(0, 9, 10);
setFrontMatrixWord(0, 4, 7);
break;

case FrontWord::nach:
case FrontWord::v_nach:
setFrontMatrixWord(3, 9, 10);
break;

case FrontWord::vor:
case FrontWord::v_vor:
setFrontMatrixWord(2, 0, 2);
break;

case FrontWord::viertel:
setFrontMatrixWord(1, 5, 10);
break;

case FrontWord::min_5:
setFrontMatrixWord(0, 0, 2);
break;

case FrontWord::min_10:
setFrontMatrixWord(1, 0, 2);
break;

case FrontWord::min_20:
setFrontMatrixWord(2, 5, 10);
break;

case FrontWord::halb:
setFrontMatrixWord(3, 3, 7);
break;

case FrontWord::eins:
setFrontMatrixWord(4, 8, 10);
break;

case FrontWord::hour_1:
setFrontMatrixWord(4, 8, 10);
break;

case FrontWord::hour_2:
setFrontMatrixWord(4, 4, 7);
break;

case FrontWord::hour_3:
setFrontMatrixWord(4, 0, 2);
break;

case FrontWord::hour_4:
setFrontMatrixWord(5, 6, 10);
break;

case FrontWord::hour_5:
setFrontMatrixWord(5, 2, 5);
break;

case FrontWord::hour_6:
setFrontMatrixWord(6, 5, 10);
break;

case FrontWord::hour_7:
setFrontMatrixWord(6, 0, 4);
break;

case FrontWord::hour_8:
setFrontMatrixWord(7, 6, 10);
break;

case FrontWord::hour_9:
setFrontMatrixWord(7, 2, 5);
break;

case FrontWord::hour_10:
setFrontMatrixWord(8, 7, 10);
break;

case FrontWord::hour_11:
setFrontMatrixWord(8, 0, 3);
break;

case FrontWord::hour_12:
setFrontMatrixWord(9, 5, 10);
break;

case FrontWord::gewesen:
setFrontMatrixWord(9, 0, 2);
break;

default:
break;
};
};
};

Ch10x11_t _ch10x11V2;
2 changes: 1 addition & 1 deletion include/Uhrtypes/DE16x8.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class De16x8_t : public iUhrType {
break;

case FrontWord::hour_9:
setFrontMatrixWord(4, 7, 10);
setFrontMatrixWord(4, 4, 7);
break;

case FrontWord::hour_10:
Expand Down
3 changes: 3 additions & 0 deletions include/clockWork.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class ClockWork {
void showMinute(uint8_t min);
void resetMinVariantIfNotAvailable();
FrontWord getFrontWordForNum(uint8_t min);
bool checkTwentyUsage();
bool hasTwentyAndCheckForUsage();
bool hasDreiviertelAndCheckForUsage();
void setMinute(uint8_t min, uint8_t &offsetHour, bool &fullHour);
Expand All @@ -59,6 +60,8 @@ class ClockWork {
WordclockChanges changesInClockface();
void calcClockface();
void setClock();
void setItIs(uint8_t min, const uint8_t offsetHour);
bool DetermineIfItIsIsShown(const uint8_t min);
void DetermineWhichItIsToShow(uint8_t offsetHour);
void clearClockByProgInit();

Expand Down
50 changes: 45 additions & 5 deletions include/clockWork.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ iUhrType *ClockWork::getPointer(uint8_t type) {
return &_se10x11;
case Ru10x11:
return &_ru10x11;
case Ch10x11V2:
return &_ch10x11V2;
default:
return nullptr;
}
Expand Down Expand Up @@ -513,8 +515,15 @@ FrontWord ClockWork::getFrontWordForNum(uint8_t min) {

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

bool ClockWork::checkTwentyUsage() {
return G.languageVariant[ItIs20] || G.languageVariant[ItIs40];
}

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

bool ClockWork::hasTwentyAndCheckForUsage() {
return usedUhrType->hasZwanzig() || G.languageVariant[ItIs40];
// ToDo: Is this true for every supoorted language variant?
return usedUhrType->hasZwanzig() && checkTwentyUsage();
}

//------------------------------------------------------------------------------
Expand Down Expand Up @@ -909,16 +918,46 @@ WordclockChanges ClockWork::changesInClockface() {

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

bool ClockWork::DetermineIfItIsIsShown(const uint8_t min) {
switch (G.itIsVariant) {
case ItIsVariant::Permanent:
return true;
break;
case ItIsVariant::Hourly:
return !min;
break;
case ItIsVariant::HalfHourly:
return !(min % 30);
break;
case ItIsVariant::Quarterly:
return !(min % 15);
break;
case ItIsVariant::Off:
default:
return false;
break;
}
}

//------------------------------------------------------------------------------
void ClockWork::setItIs(uint8_t min, const uint8_t offsetHour) {
min /= 5;
min *= 5;

if (DetermineIfItIsIsShown(min)) {
DetermineWhichItIsToShow(_hour + offsetHour);
}
}

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

void ClockWork::setClock() {
uint8_t offsetHour = 0;
bool fullHour = 0;

setMinute(_minute, offsetHour, fullHour);
setHour(_hour + offsetHour, fullHour);

if (!G.languageVariant[NotShowItIs]) {
DetermineWhichItIsToShow(_hour + offsetHour);
}
setItIs(_minute, offsetHour);
}

//------------------------------------------------------------------------------
Expand Down Expand Up @@ -1168,6 +1207,7 @@ void ClockWork::loop(struct tm &tm) {
config["effectSpeed"] = G.effectSpeed;
config["colortype"] = G.Colortype;
config["hasHappyBirthday"] = usedUhrType->hasHappyBirthday();
config["hasSecondsFrame"] = usedUhrType->hasSecondsFrame();
config["prog"] = G.prog;
serializeJson(config, str);
webSocket.sendTXT(G.client_nr, str, strlen(str));
Expand Down
4 changes: 4 additions & 0 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@
// #define DEFAULT_LAYOUT Ch10x11
// 10 rows, 11 LED's per row + 4 LED's for minutes, with modified
// layout for the Swiss German language
//
// #define DEFAULT_LAYOUT Ch10x11V2
// 10 rows, 11 LED's per row + 4 LED's for minutes, with modified
// layout for the Swiss German language with "Gsi" option

/**********************/
/* Romanian */
Expand Down
2 changes: 1 addition & 1 deletion include/webPageAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t *payload,
G.languageVariant[ItIs20] = split(payload, 6);
G.languageVariant[ItIs40] = split(payload, 9);
G.languageVariant[ItIs45] = split(payload, 12);
G.languageVariant[NotShowItIs] = split(payload, 15);
G.itIsVariant = static_cast<ItIsVariant>(split(payload, 15));
G.languageVariant[EN_ShowAQuarter] = split(payload, 18);
break;
}
Expand Down
6 changes: 3 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ lib_deps =
extra_scripts = pre:extra_scripts.py

[env:esp32c3dev]
platform = espressif32
platform = espressif32 @ 6.9.0
board = esp32-c3-devkitc-02
board_build.partitions = partitions_singleapp_large.csv
framework = arduino
upload_speed = 921600
upload_speed = 115200
monitor_speed = 460800
build_flags =
-Os
Expand All @@ -66,7 +66,7 @@ build_flags =
lib_deps =
makuna/NeoPixelBus@^2.7.6
bblanchon/ArduinoJson@^6.17.2
links2004/[email protected]
links2004/WebSockets@^2.4.1
adafruit/RTClib@^1.11.2
knolleary/PubSubClient@^2.8.0
https://github.com/tzapu/WiFiManager#v2.0.17
Expand Down
Loading
Loading