Skip to content

Release 4.1.0 #508

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

Merged
merged 17 commits into from
Feb 21, 2025
Merged
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, uint8_t min);
void clearClockByProgInit();

Expand Down
65 changes: 50 additions & 15 deletions include/clockWork.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#include <Arduino.h>
#include <BH1750.h>

#define LEDGPIO 27

OpenWMap weather;
BH1750 lightMeter(0x23);

Expand Down Expand Up @@ -68,19 +66,14 @@ void ClockWork::loopAutoBrightLogic() {
ledGain = 100.0;
}
if (ledGainOld != ledGain) {
led.set();
parametersChanged = true;
}
}

// Ambient Light Sensor BH1750
// Initialize the I2C bus using SCL and SDA pins
// (BH1750 library doesn't do this automatically)
void ClockWork::initBH1750Logic() {
#ifdef ESP8266
Wire.begin(D4, D3);
#elif defined(ESP32)
Wire.begin(21, 22);
#endif
// begin returns a boolean that can be used to detect setup problems.
if (lightMeter.begin(BH1750::CONTINUOUS_HIGH_RES_MODE)) {
Serial.println("BH1750 initialized. Using this sensor for ambient "
Expand Down Expand Up @@ -143,6 +136,8 @@ iUhrType *ClockWork::getPointer(uint8_t type) {
return &_se10x11;
case Ru10x11:
return &_ru10x11;
case Ch10x11V2:
return &_ch10x11V2;
default:
return nullptr;
}
Expand All @@ -162,8 +157,9 @@ void ClockWork::initLedStrip(uint8_t num) {
#ifdef ESP8266
strip_RGBW = new NeoPixelBus<NeoGrbwFeature, Neo800KbpsMethod>(500);
#elif defined(ESP32)
pinMode(LED_PIN, OUTPUT);
strip_RGBW =
new NeoPixelBus<NeoGrbwFeature, NeoSk6812Method>(500, LEDGPIO);
new NeoPixelBus<NeoGrbwFeature, NeoSk6812Method>(500, LED_PIN);
#endif
strip_RGBW->Begin();
}
Expand All @@ -177,8 +173,9 @@ void ClockWork::initLedStrip(uint8_t num) {
#ifdef ESP8266
strip_RGB = new NeoPixelBus<NeoMultiFeature, Neo800KbpsMethod>(500);
#elif defined(ESP32)
pinMode(LED_PIN, OUTPUT);
strip_RGB = new NeoPixelBus<NeoMultiFeature, NeoWs2812xMethod>(
500, LEDGPIO);
500, LED_PIN);
#endif
strip_RGB->Begin();
}
Expand Down Expand Up @@ -513,8 +510,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 +913,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, min);
}
}

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

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, _minute);
}
setItIs(_minute, offsetHour);
}

//------------------------------------------------------------------------------
Expand Down Expand Up @@ -1170,6 +1204,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
14 changes: 14 additions & 0 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
* in the settings menu on the clock's hosted website.
*/

//--------------------------------------------------------------------------
// PIN Configuration
//--------------------------------------------------------------------------

#define LED_PIN 3

// Define the I2C pins for the ESP32
#define SDA_PIN_ESP32 7
#define SCL_PIN_ESP32 6

//--------------------------------------------------------------------------
// Front panel layout
//--------------------------------------------------------------------------
Expand Down Expand Up @@ -107,6 +117,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
5 changes: 2 additions & 3 deletions include/led.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ class Led {
// Brightness Functions
//------------------------------------------------------------------------------
float setBrightnessAuto(float val);
void getCurrentManualBrightnessSetting(uint8_t &currentBrightness);
void getColorbyPositionWithAppliedBrightness(HsbColor &color,
ColorPosition position);
uint8_t getCurrentManualBrightnessSetting();
HsbColor getColorbyPositionWithAppliedBrightness(ColorPosition position);
void shiftColumnToRight();

//------------------------------------------------------------------------------
Expand Down
Loading
Loading