Skip to content

Commit

Permalink
Merge pull request #180 from dbambus/main
Browse files Browse the repository at this point in the history
A few Updates for 2.6.2 Release :-)
  • Loading branch information
dbambus committed Dec 15, 2022
2 parents 8047ac3 + 3c1e457 commit fa9b7be
Show file tree
Hide file tree
Showing 10 changed files with 693 additions and 392 deletions.
56 changes: 28 additions & 28 deletions include/Animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ struct RgbfColor : RgbColor {
RgbfColor(uint8_t r, uint8_t g, uint8_t b) : RgbColor(r, g, b) {
Flags = F_NULL;
}
RgbfColor(RgbColor rgb, uint f) : RgbColor(rgb) { Flags = f; }
RgbfColor(HsbColor hsb, uint f) : RgbColor(hsb) { Flags = f; }
RgbfColor(uint8_t h, uint f) : RgbColor(h) { Flags = f; }
RgbfColor(RgbColor rgb, uint32_t f) : RgbColor(rgb) { Flags = f; }
RgbfColor(HsbColor hsb, uint32_t f) : RgbColor(hsb) { Flags = f; }
RgbfColor(uint8_t h, uint32_t f) : RgbColor(h) { Flags = f; }

void changeRgb(RgbColor color) {
R = color.R;
Expand Down Expand Up @@ -56,15 +56,15 @@ struct RgbfColor : RgbColor {
uint8_t getFlags() { return Flags; }

protected:
uint Flags;
uint32_t Flags;
};
struct RgbaColor : RgbfColor {
RgbaColor() : RgbfColor() { Alpha = 255; };
RgbaColor(RgbColor rgb) : RgbfColor(rgb) { Alpha = 255; }
RgbaColor(uint8_t h) : RgbfColor(h) { Alpha = 255; }
RgbaColor(RgbColor rgb, uint f) : RgbfColor(rgb, f) { Alpha = 255; }
RgbaColor(HsbColor hsb, uint f) : RgbfColor(hsb, f) { Alpha = 255; }
RgbaColor(uint8_t h, uint f) : RgbfColor(h, f) { Alpha = 255; }
RgbaColor(RgbColor rgb, uint32_t f) : RgbfColor(rgb, f) { Alpha = 255; }
RgbaColor(HsbColor hsb, uint32_t f) : RgbfColor(hsb, f) { Alpha = 255; }
RgbaColor(uint8_t h, uint32_t f) : RgbfColor(h, f) { Alpha = 255; }
// ---------------------
RgbaColor(RgbColor rgb, float a) : RgbfColor(rgb) {
Alpha = (uint8_t)(a * 255);
Expand Down Expand Up @@ -122,7 +122,7 @@ class Animation {
protected:
uint16_t phase = 0;
bool matrixChanged = false;
uint animationDelay = 100;
uint32_t animationDelay = 100;
Animation_t animType = KEINE;
uint32_t nextActionTime = 0;
uint8_t lastMinute = 100;
Expand Down Expand Up @@ -198,7 +198,7 @@ class Rain {
}
virtual ~Rain(){};

void begin(int frames, int stop, uint8_t helligkeit) {
void begin(int32_t frames, int32_t stop, uint8_t helligkeit) {
white = RgbaColor(helligkeit, 1.0f);
// white.Lighten(helligkeit);
green = RgbaColor(0, helligkeit, 0, 0.5);
Expand All @@ -217,11 +217,11 @@ class Rain {
stopPhase = frames - speedlimit * max_rows;
}

RgbaColor get(int r) {
int row = (max_rows - 1 - r);
RgbaColor get(int32_t r) {
int32_t row = (max_rows - 1 - r);
// pro Bild laeuft row von (max_rows - 1) runter auf 0

int pos = (row + offset) % (deadtime + lifetime);
int32_t pos = (row + offset) % (deadtime + lifetime);

if (row == 0) { // letzte row faer dieses Bild
if (phase++ == stopPhase) {
Expand Down Expand Up @@ -263,8 +263,8 @@ class Rain {

protected:
uint8_t max_rows, max_cols;
int speed, speedlimit, offset, lifetime, deadtime;
int phase, frames, stopPhase, stopLine, stopTop, stopBottom;
int32_t speed, speedlimit, offset, lifetime, deadtime;
int32_t phase, frames, stopPhase, stopLine, stopTop, stopBottom;
bool stopping;
RgbaColor white = RgbaColor(255, 255, 255, 0.9);
RgbaColor green = RgbaColor(0, 255, 0, 0.75);
Expand All @@ -282,8 +282,8 @@ class Ball {
}
virtual ~Ball(){};

void begin(int row, int column, RgbfColor foreground, RgbfColor background,
int delay) {
void begin(int32_t row, int32_t column, RgbfColor foreground,
RgbfColor background, int32_t delay) {
this->delay = delay;
y = row << 8; // increase precision
r = row;
Expand All @@ -300,11 +300,11 @@ class Ball {
// x = 0, y = 0 -> links oben
// x = 10, y = 9 -> rechts unten
// v positiv -> nach unten
int move(int timedelta) {
int32_t move(int32_t timedelta) {
if (!end) {
delay -= timedelta;
if (delay <= 0) {
int _vy = vy;
int32_t _vy = vy;
y += (((g * timedelta) / 1000) * timedelta) / 2000 +
(vy * timedelta) / 1000;
vy += (g * timedelta) / 1000;
Expand All @@ -325,13 +325,13 @@ class Ball {
}

public:
int r, c; // after calling move() r and c contain new actual values
int32_t r, c; // after calling move() r and c contain new actual values
RgbfColor color;

protected:
int unten;
int lastPos;
int g, vy, y, end, delay;
int32_t unten;
int32_t lastPos;
int32_t g, vy, y, end, delay;
bool lastDown;
RgbfColor colorForeground, colorBackground;
};
Expand Down Expand Up @@ -365,7 +365,7 @@ class Snake {
GoToPos *motions;
Coord head;
bool goRight;
int index;
int32_t index;
std::queue<Coord> snake;
RgbfColor **work;
RgbfColor **old;
Expand Down Expand Up @@ -418,7 +418,7 @@ class Snake {
while (rowCounter-- > 0) {
left = max_cols;
right = 0;
for (int col = 0; col < max_cols; col++) {
for (int32_t col = 0; col < max_cols; col++) {
if (matrix[row][col].isForeground()) {
// search for right most foreground
right = col;
Expand Down Expand Up @@ -485,7 +485,7 @@ class Firework {
RgbColor colors[3];
Icons icons[3];
bool mirrored;
int maxLayer;
int32_t maxLayer;
uint8_t max_rows, max_cols;

public:
Expand All @@ -495,7 +495,7 @@ class Firework {
}

// layers must be prepared in ascending order !!!
void prepare(int layer, RgbColor &color, Icons icon, bool mirrored) {
void prepare(int32_t layer, RgbColor &color, Icons icon, bool mirrored) {
if (layer == 0) {
icons[1] = static_cast<Icons>(0);
icons[2] = static_cast<Icons>(0);
Expand All @@ -507,13 +507,13 @@ class Firework {
}

bool getPixel(uint8_t r, uint8_t c, RgbColor &color) {
// void Animation::copyBlock(RgbfColor color, uint block, bool fgbg,
// void Animation::copyBlock(RgbfColor color, uint32_t block, bool fgbg,
// bool mirrored,
// bool init) {

if ((r < 10) && (r < max_rows) && (c < 11) && (c < max_cols)) {
uint16_t pixels = 0;
for (int layer = 0; layer <= maxLayer; layer++) {
for (int32_t layer = 0; layer <= maxLayer; layer++) {
if (icons[layer] != static_cast<Icons>(0)) {
pixels = animation->reverse(
pgm_read_word(&(grafik_11x10[icons[layer]][r])),
Expand Down
1 change: 1 addition & 0 deletions include/Uhr.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ enum UhrTypeDefinitions {
Uhr_114 = 1,
Uhr_114_Alternative = 2,
Uhr_114_2Clock = 6,
Uhr_114_Dutch = 9,
Uhr_125 = 3,
Uhr_125_Type2 = 8,
Uhr_169 = 4,
Expand Down
192 changes: 192 additions & 0 deletions include/Uhrtypes/uhr_func_114_dutch.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
#include "Uhrtype.hpp"

/*
* Layout Front
*
* H E T R I S L V I J F
* T I E N Z J A R U A G
* D R I E S K W A R T N
* F T O V E R V O O R M
* H A L F X T W A A L F
* T W E E N Z E V E N P
* L D R I E B Y V I J F
* E L F A C H T V I E R
* N E G E N P M T I E N
* O S Z E S T L P U U R
*
*/

class UHR_114_dutch_t : public iUhrType {
public:
const uint16_t min_arr[2][4] = {
// ergänzt aus "Uhr func 169"-datei
{110, 111, 112, 113}, // LED für Minuten Anzeige Zeile
{110, 111, 112, 113} // LED für Minuten Anzeige Ecken
};

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

virtual const uint16_t getMinArr(uint8_t col, uint8_t row) override {
return min_arr[col][row];
};

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

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

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

void show(uint8_t text) override {
switch (text) {

case es_ist:
// Es
Letter_set(0);
Letter_set(1);
Letter_set(2);

// Ist
Letter_set(4);
Letter_set(5);
break;

case nach:
case v_nach:
Letter_set(41);
Letter_set(40);
Letter_set(39);
Letter_set(38);
break;

case vor:
case v_vor:
Letter_set(37);
Letter_set(36);
Letter_set(35);
Letter_set(34);
break;

case viertel:
Letter_set(27);
Letter_set(28);
Letter_set(29);
Letter_set(30);
break;

case fuenf:
Letter_set(7);
Letter_set(8);
Letter_set(9);
Letter_set(10);
break;

case zehn:
Letter_set(21);
Letter_set(20);
Letter_set(19);
Letter_set(18);
break;

case halb:
Letter_set(44);
Letter_set(45);
Letter_set(46);
Letter_set(47);
break;

case h_ein:
Letter_set(63);
Letter_set(62);
Letter_set(61);
break;

case uhr:
Letter_set(101);
Letter_set(100);
Letter_set(99);
break;

case h_zwei:
Letter_set(65);
Letter_set(64);
Letter_set(63);
Letter_set(62);
break;

case h_drei:
Letter_set(67);
Letter_set(68);
Letter_set(69);
Letter_set(70);
break;

case h_vier:
Letter_set(80);
Letter_set(79);
Letter_set(78);
Letter_set(77);
break;

case h_fuenf:
Letter_set(73);
Letter_set(74);
Letter_set(75);
Letter_set(76);
break;

case h_sechs:
Letter_set(107);
Letter_set(106);
Letter_set(105);
break;

case h_sieben:
Letter_set(60);
Letter_set(59);
Letter_set(58);
Letter_set(57);
Letter_set(56);
break;

case h_acht:
Letter_set(84);
Letter_set(83);
Letter_set(82);
Letter_set(81);
break;

case h_neun:
Letter_set(88);
Letter_set(89);
Letter_set(90);
Letter_set(91);
Letter_set(92);
break;

case h_zehn:
Letter_set(95);
Letter_set(96);
Letter_set(97);
Letter_set(98);
break;

case h_elf:
Letter_set(87);
Letter_set(86);
Letter_set(85);
break;

case h_zwoelf:
Letter_set(49);
Letter_set(50);
Letter_set(51);
Letter_set(52);
Letter_set(53);
Letter_set(54);
break;

default:
break;
};
};
};
2 changes: 1 addition & 1 deletion include/uhr_func.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ bool changes_in_array() {

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

void led_set_Icon(uint8 num_icon, uint8_t brightness = 100,
void led_set_Icon(uint8_t num_icon, uint8_t brightness = 100,
bool rgb_icon = false) {
uint8_t rr, gg, bb, ww;
set_helligkeit(rr, gg, bb, ww, Foreground, brightness);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Wortuhr",
"version": "2.6.0",
"version": "2.6.2",
"description": "For building a german layouted wordclock with an esp8266 module and WS2812/SK2812.",
"license": "BSD-3-Clause",
"contributors": [
Expand Down
Loading

0 comments on commit fa9b7be

Please sign in to comment.