Compare commits
No commits in common. "521e5f735d681f847d2254b6b9688425a2cbe5e6" and "47812de4057439feded5340d80996d5833d3fd8e" have entirely different histories.
521e5f735d
...
47812de405
@ -10,7 +10,7 @@ protected:
|
|||||||
Window* window = new Window(0, LED_HEIGHT - 6, LED_WIDTH, 6);
|
Window* window = new Window(0, LED_HEIGHT - 6, LED_WIDTH, 6);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~ClockEffect();
|
~ClockEffect();
|
||||||
virtual void loop(uint16_t ms);
|
virtual void loop(uint16_t ms);
|
||||||
String get_name() override { return "clock"; }
|
String get_name() override { return "clock"; }
|
||||||
void loop_with_invert(bool invert);
|
void loop_with_invert(bool invert);
|
||||||
@ -20,6 +20,5 @@ public:
|
|||||||
class NightClockEffect : public ClockEffect {
|
class NightClockEffect : public ClockEffect {
|
||||||
public:
|
public:
|
||||||
NightClockEffect();
|
NightClockEffect();
|
||||||
~NightClockEffect();
|
|
||||||
void loop(uint16_t ms) override;
|
void loop(uint16_t ms) override;
|
||||||
};
|
};
|
||||||
|
@ -48,15 +48,6 @@ public:
|
|||||||
RandomMatrixEffectColumn(Window* win, uint8_t dir, bool rnd=false) : MatrixEffectColumn(win, dir, rnd) {};
|
RandomMatrixEffectColumn(Window* win, uint8_t dir, bool rnd=false) : MatrixEffectColumn(win, dir, rnd) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
class ColumnMatrixEffectColumn : public MatrixEffectColumn {
|
|
||||||
protected:
|
|
||||||
uint8_t _hue;
|
|
||||||
CRGB _getColor(uint8_t height) override;
|
|
||||||
void restart(bool completely_random) override;
|
|
||||||
public:
|
|
||||||
ColumnMatrixEffectColumn(Window* win, uint8_t dir, bool rnd=false) : MatrixEffectColumn(win, dir, rnd) {};
|
|
||||||
};
|
|
||||||
|
|
||||||
class MatrixEffectBase : public Effect {
|
class MatrixEffectBase : public Effect {
|
||||||
protected:
|
protected:
|
||||||
MatrixEffectColumn** _columns;
|
MatrixEffectColumn** _columns;
|
||||||
@ -95,11 +86,3 @@ public:
|
|||||||
RandomMatrixEffect();
|
RandomMatrixEffect();
|
||||||
String get_name() override { return "random_matrix"; }
|
String get_name() override { return "random_matrix"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class ColumnMatrixEffect : public MatrixEffectBase {
|
|
||||||
protected:
|
|
||||||
void _create() override;
|
|
||||||
public:
|
|
||||||
ColumnMatrixEffect();
|
|
||||||
String get_name() override { return "column_matrix"; }
|
|
||||||
};
|
|
@ -2,7 +2,6 @@
|
|||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
|
||||||
extern Font font_numbers3x5;
|
extern Font font_numbers3x5;
|
||||||
extern Font font_numbers3x3;
|
|
||||||
extern Font font_numbers3x5_blocky;
|
extern Font font_numbers3x5_blocky;
|
||||||
extern Font font_numbers4x7;
|
extern Font font_numbers4x7;
|
||||||
extern Font font5x7;
|
extern Font font5x7;
|
||||||
|
@ -19,7 +19,7 @@ lib_deps =
|
|||||||
https://github.com/me-no-dev/ESPAsyncWebServer.git
|
https://github.com/me-no-dev/ESPAsyncWebServer.git
|
||||||
|
|
||||||
[env:ota]
|
[env:ota]
|
||||||
upload_port = 10.10.2.78 ; .78=prod, .80=dev
|
upload_port = 10.10.2.80
|
||||||
upload_protocol = espota
|
upload_protocol = espota
|
||||||
platform = espressif8266
|
platform = espressif8266
|
||||||
board = esp07
|
board = esp07
|
||||||
|
@ -66,7 +66,3 @@ void ClockEffect::loop(boolean invert, CRGB fg_color, CRGB bg_color, uint8_t yPo
|
|||||||
ClockEffect::~ClockEffect() {
|
ClockEffect::~ClockEffect() {
|
||||||
delete window;
|
delete window;
|
||||||
}
|
}
|
||||||
|
|
||||||
NightClockEffect::~NightClockEffect() {
|
|
||||||
delete window;
|
|
||||||
}
|
|
@ -47,7 +47,7 @@ void LightspeedEffectStar::_init() {
|
|||||||
_start = 0;
|
_start = 0;
|
||||||
_speed = random16(128, 2<<8);
|
_speed = random16(128, 2<<8);
|
||||||
_target = random16(25<<8, 35<<8);
|
_target = random16(25<<8, 35<<8);
|
||||||
_saturation = random8(100);
|
_saturation = random8(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightspeedEffectStar::loop(Window* win) {
|
void LightspeedEffectStar::loop(Window* win) {
|
||||||
|
@ -127,18 +127,6 @@ void RandomMatrixEffectColumn::restart(bool completely_random) {
|
|||||||
_hue = random8();
|
_hue = random8();
|
||||||
}
|
}
|
||||||
|
|
||||||
CRGB ColumnMatrixEffectColumn::_getColor(uint8_t i) {
|
|
||||||
CRGB color;
|
|
||||||
uint8_t dist = abs(length / 2 - i);
|
|
||||||
color = CHSV(_hue, 255, 255 - dist * 5);
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ColumnMatrixEffectColumn::restart(bool completely_random) {
|
|
||||||
MatrixEffectColumn::restart(completely_random);
|
|
||||||
_hue = random8();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -186,15 +174,6 @@ void RainbowMatrixEffect::_create() {
|
|||||||
for (int i=0; i<_count; i++) _columns[i] = new RainbowMatrixEffectColumn(window, MatrixEffectColumn::DIR_SOUTH);
|
for (int i=0; i<_count; i++) _columns[i] = new RainbowMatrixEffectColumn(window, MatrixEffectColumn::DIR_SOUTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnMatrixEffect::ColumnMatrixEffect() {
|
|
||||||
_init();
|
|
||||||
_create();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ColumnMatrixEffect::_create() {
|
|
||||||
for (int i=0; i<_count; i++) _columns[i] = new ColumnMatrixEffectColumn(window, MatrixEffectColumn::DIR_NORTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
MatrixEffectBase::~MatrixEffectBase() {
|
MatrixEffectBase::~MatrixEffectBase() {
|
||||||
_delete();
|
_delete();
|
||||||
}
|
}
|
||||||
|
@ -16,22 +16,6 @@ bool font_numbers3x5_check(const char c) { return c>='0' && c<='9'; }
|
|||||||
uint16_t font_numbers3x5_get(const char c) { return c - '0'; }
|
uint16_t font_numbers3x5_get(const char c) { return c - '0'; }
|
||||||
Font font_numbers3x5 = {3, 5, &font_numbers3x5_data[0], font_numbers3x5_check, font_numbers3x5_get};
|
Font font_numbers3x5 = {3, 5, &font_numbers3x5_data[0], font_numbers3x5_check, font_numbers3x5_get};
|
||||||
|
|
||||||
const uint8_t font_numbers3x3_data[] PROGMEM = {
|
|
||||||
B111, B101, B111, // 0
|
|
||||||
B101, B111, B001, // 1
|
|
||||||
B100, B111, B001, // 2
|
|
||||||
B101, B111, B111, // 3
|
|
||||||
B110, B010, B111, // 4
|
|
||||||
B001, B111, B100, // 5
|
|
||||||
B111, B011, B011, // 6
|
|
||||||
B100, B100, B111, // 7
|
|
||||||
B011, B111, B111, // 8
|
|
||||||
B110, B110, B111, // 9
|
|
||||||
};
|
|
||||||
bool font_numbers3x3_check(const char c) { return c>='0' && c<='9'; }
|
|
||||||
uint16_t font_numbers3x3_get(const char c) { return c - '0'; }
|
|
||||||
Font font_numbers3x3 = {3, 3, &font_numbers3x3_data[0], font_numbers3x3_check, font_numbers3x3_get};
|
|
||||||
|
|
||||||
const uint8_t font_numbers3x5_blocky_data[] PROGMEM = {
|
const uint8_t font_numbers3x5_blocky_data[] PROGMEM = {
|
||||||
B11111, B10001, B11111, // 0
|
B11111, B10001, B11111, // 0
|
||||||
B00000, B11111, B00000, // 1
|
B00000, B11111, B00000, // 1
|
||||||
@ -166,6 +150,12 @@ const uint8_t font5x7_data[] PROGMEM = {
|
|||||||
0x08, 0x08, 0x2A, 0x1C, 0x08, // ->
|
0x08, 0x08, 0x2A, 0x1C, 0x08, // ->
|
||||||
0x08, 0x1C, 0x2A, 0x08, 0x08, // <-
|
0x08, 0x1C, 0x2A, 0x08, 0x08, // <-
|
||||||
};
|
};
|
||||||
|
|
||||||
bool font5x7_check(const char c) { return c>=' ' && c<='}'; }
|
bool font5x7_check(const char c) { return c>=' ' && c<='}'; }
|
||||||
|
|
||||||
uint16_t font5x7_get(const char c) { return c - ' '; }
|
uint16_t font5x7_get(const char c) { return c - ' '; }
|
||||||
|
|
||||||
Font font5x7 = {5, 7, &font5x7_data[0], font5x7_check, font5x7_get};
|
Font font5x7 = {5, 7, &font5x7_data[0], font5x7_check, font5x7_get};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -201,9 +201,9 @@ void http_server_setup() {
|
|||||||
});
|
});
|
||||||
http_server.on("/effects", HTTP_GET, [&](AsyncWebServerRequest* request) {
|
http_server.on("/effects", HTTP_GET, [&](AsyncWebServerRequest* request) {
|
||||||
String message = F("<html><head><title>Pitrix effects</title></head><body><h1>Pitrix settings</h1><a href='/'>Back to main page</a><table>");
|
String message = F("<html><head><title>Pitrix effects</title></head><body><h1>Pitrix settings</h1><a href='/'>Back to main page</a><table>");
|
||||||
char buffer[500];
|
char buffer[150];
|
||||||
for (int i=0; i<effects_size; i++) {
|
for (int i=0; i<effects_size; i++) {
|
||||||
snprintf_P(buffer, 500, PSTR("<tr><td>%s</td><td><form method='post' action='/effects'><input type='hidden' name='name' value='%s'><input type='hidden' name='redir' value='1'><input type='submit' value='Select'></form></td></tr>"), effects[i].name, effects[i].name);
|
snprintf_P(buffer, 150, PSTR("<tr><td>%s</td><td><form method='post' action='/effects'><input type='hidden' name='name' value='%s'><input type='hidden' name='redir' value='1'><input type='submit' value='Select'></form></td></tr>"), effects[i].name, effects[i].name);
|
||||||
message += buffer;
|
message += buffer;
|
||||||
}
|
}
|
||||||
message += F("</table></body></html>");
|
message += F("</table></body></html>");
|
||||||
|
Loading…
Reference in New Issue
Block a user