Whitespace stuff. Tabs rule!
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Fabian Schlenz 2019-06-07 06:24:16 +02:00
parent b71faa3bcb
commit c5856a6f7a
41 changed files with 877 additions and 876 deletions

View File

@ -1,34 +1,34 @@
/**
Animations are structured in AnimationData as follows:
Animations are structured in AnimationData as follows:
.colors contains .color_count*3 uint8_t values for R, G and B.
.colors contains .color_count*3 uint8_t values for R, G and B.
.offsets contains the frame start offsets within .data + the length of the data. (So
you can always do something like `for (int i=anim.offsets[i]; i<anim.offsets[i+1]; i++)`.
Accordingly it has a length of .frame_count+1.
.offsets contains the frame start offsets within .data + the length of the data. (So
you can always do something like `for (int i=anim.offsets[i]; i<anim.offsets[i+1]; i++)`.
Accordingly it has a length of .frame_count+1.
.data contains all frames data with a run-length compression with escape char 255.
This data references the index of one or multiple pixels in .colors. It starts at the
top left pixel and walks each row to the right before starting the next row.
To decode it: Start at a frame (indicated by .offsets). Get one byte as x.
If x is <255: This is a single pixel of color x.
if x is 255: Run-length-encoding. The next byte indicates of often the byte after that
will be repeated. So, {255, 4, 10} is equal to {10, 10, 10, 10}.
A special case that may happen in larger GIFs is that there are more than 255 repetitions
of a color. Those will be split, so 355*color #10 will be: {255, 255, 10, 255, 100, 10},
e.g. 255*10 + 100*10. Usually this shouldn't need special handling within a decoder.
Regarding colors in .data:
Color 0 means "keep the color from the previous frame". This color should never appear on frame #0.
Color 1 means "show the background color".
All other color values point to a color in .colors - with an offset of 2.
So if in .data there's a color 3, paint this pixel in .colors[1].
.data contains all frames data with a run-length compression with escape char 255.
This data references the index of one or multiple pixels in .colors. It starts at the
top left pixel and walks each row to the right before starting the next row.
To decode it: Start at a frame (indicated by .offsets). Get one byte as x.
If x is <255: This is a single pixel of color x.
if x is 255: Run-length-encoding. The next byte indicates of often the byte after that
will be repeated. So, {255, 4, 10} is equal to {10, 10, 10, 10}.
A special case that may happen in larger GIFs is that there are more than 255 repetitions
of a color. Those will be split, so 355*color #10 will be: {255, 255, 10, 255, 100, 10},
e.g. 255*10 + 100*10. Usually this shouldn't need special handling within a decoder.
Regarding colors in .data:
Color 0 means "keep the color from the previous frame". This color should never appear on frame #0.
Color 1 means "show the background color".
All other color values point to a color in .colors - with an offset of 2.
So if in .data there's a color 3, paint this pixel in .colors[1].
.individual_delays contains either 1 or .frame_count delays. They are given in ms and
indicate how long the matching frame should be displayed. If all times are equal, then
it contains only one entry and .individual_delays will be false.
.individual_delays contains either 1 or .frame_count delays. They are given in ms and
indicate how long the matching frame should be displayed. If all times are equal, then
it contains only one entry and .individual_delays will be false.
.w and .h contain the dimensions of the image.
**/
.w and .h contain the dimensions of the image.
**/
#pragma once
#include <Arduino.h>
@ -36,7 +36,7 @@
#include "my_fastled.h"
class Animation {
protected:
protected:
AnimationData* data;
unsigned long currentFrameSince;
uint8_t currentFrame = 0;
@ -53,7 +53,7 @@ class Animation {
void drawFrame(uint8_t frame_index);
void drawPixel(int index, CRGB* color);
uint16_t getFrameDelay(int frame);
public:
public:
Animation(AnimationData* d);
void setFgColor(CRGB*);
void setBgColor(CRGB* bg_color);

View File

@ -6,9 +6,9 @@
#include <Arduino.h>
class Effect {
protected:
protected:
Window window = {0, 0, LED_WIDTH, LED_HEIGHT}; // Use a full screen window per default.
public:
public:
virtual void loop() = 0;
boolean supports_window = false;
virtual boolean can_be_shown_with_clock() { return false; };

View File

@ -1,34 +1,34 @@
/**
Animations are structured in AnimationData as follows:
Animations are structured in AnimationData as follows:
.colors contains .color_count*3 uint8_t values for R, G and B.
.colors contains .color_count*3 uint8_t values for R, G and B.
.offsets contains the frame start offsets within .data + the length of the data. (So
you can always do something like `for (int i=anim.offsets[i]; i<anim.offsets[i+1]; i++)`.
Accordingly it has a length of .frame_count+1.
.offsets contains the frame start offsets within .data + the length of the data. (So
you can always do something like `for (int i=anim.offsets[i]; i<anim.offsets[i+1]; i++)`.
Accordingly it has a length of .frame_count+1.
.data contains all frames data with a run-length compression with escape char 255.
This data references the index of one or multiple pixels in .colors. It starts at the
top left pixel and walks each row to the right before starting the next row.
To decode it: Start at a frame (indicated by .offsets). Get one byte as x.
If x is <255: This is a single pixel of color x.
if x is 255: Run-length-encoding. The next byte indicates of often the byte after that
will be repeated. So, {255, 4, 10} is equal to {10, 10, 10, 10}.
A special case that may happen in larger GIFs is that there are more than 255 repetitions
of a color. Those will be split, so 355*color #10 will be: {255, 255, 10, 255, 100, 10},
e.g. 255*10 + 100*10. Usually this shouldn't need special handling within a decoder.
Regarding colors in .data:
Color 0 means "keep the color from the previous frame". This color should never appear on frame #0.
Color 1 means "show the background color".
All other color values point to a color in .colors - with an offset of 2.
So if in .data there's a color 3, paint this pixel in .colors[1].
.data contains all frames data with a run-length compression with escape char 255.
This data references the index of one or multiple pixels in .colors. It starts at the
top left pixel and walks each row to the right before starting the next row.
To decode it: Start at a frame (indicated by .offsets). Get one byte as x.
If x is <255: This is a single pixel of color x.
if x is 255: Run-length-encoding. The next byte indicates of often the byte after that
will be repeated. So, {255, 4, 10} is equal to {10, 10, 10, 10}.
A special case that may happen in larger GIFs is that there are more than 255 repetitions
of a color. Those will be split, so 355*color #10 will be: {255, 255, 10, 255, 100, 10},
e.g. 255*10 + 100*10. Usually this shouldn't need special handling within a decoder.
Regarding colors in .data:
Color 0 means "keep the color from the previous frame". This color should never appear on frame #0.
Color 1 means "show the background color".
All other color values point to a color in .colors - with an offset of 2.
So if in .data there's a color 3, paint this pixel in .colors[1].
.individual_delays contains either 1 or .frame_count delays. They are given in ms and
indicate how long the matching frame should be displayed. If all times are equal, then
it contains only one entry and .individual_delays will be false.
.individual_delays contains either 1 or .frame_count delays. They are given in ms and
indicate how long the matching frame should be displayed. If all times are equal, then
it contains only one entry and .individual_delays will be false.
.w and .h contain the dimensions of the image.
**/
.w and .h contain the dimensions of the image.
**/
#pragma once
#include <Arduino.h>

View File

@ -6,13 +6,13 @@
#include "Animation.h"
class AnimationEffect : public Effect {
private:
private:
Animation *animation;
AnimationData *animation_data;
CRGB *bg_color;
uint16_t xOffset;
uint16_t yOffset;
public:
public:
AnimationEffect(AnimationData* anim) : AnimationEffect(anim, new CRGB(0x000000), 0, 0) {}
AnimationEffect(AnimationData* anim, CRGB* background_color) : AnimationEffect(anim, background_color, 0, 0) {}
AnimationEffect(AnimationData* anim, CRGB* bg_color, int x, int y);

View File

@ -5,11 +5,11 @@
#include "functions.h"
class BellEffect : public Effect {
private:
private:
CRGB color_on = CRGB(0xFFFF00);
CRGB color_off = CRGB(0x000000);
boolean invert = false;
public:
public:
void loop();
};

View File

@ -4,7 +4,7 @@
#include "Effect.h"
class BigClockEffect : public Effect {
private:
private:
CRGB color_h = CRGB(0xFF0000);
CRGB color_m = CRGB(0x00FF00);
CRGB color_colon = CRGB(0xFFFF00);
@ -17,7 +17,7 @@ class BigClockEffect : public Effect {
void drawSprite(const unsigned char* sprite, int xOffset, int yOffset, CRGB color);
public:
public:
void loop();
};

View File

@ -6,10 +6,10 @@
#include <FastLED.h>
class ClockEffect : public Effect {
private:
private:
Window window = {0, LED_HEIGHT - 6, LED_WIDTH, 6};
public:
public:
void loop();
void loop(boolean invert, CRGB fg_color, CRGB bg_color);
};

View File

@ -5,11 +5,11 @@
#include "effects.h"
class CycleEffect : public Effect {
private:
private:
Effect* effect;
uint16_t effect_id = -1;
unsigned long effectSince = 0;
public:
public:
void changeEffect();
void start();
void stop();

View File

@ -3,13 +3,13 @@
#include "config.h"
class SingleDynamicEffect : public Effect {
protected:
protected:
static const int factor = 2;
static const int tile_count = LED_WIDTH/factor * LED_HEIGHT/factor;
CRGB tiles[tile_count];
CRGB old_tiles[tile_count];
uint8_t blend = 0;
public:
public:
SingleDynamicEffect();
void init();
boolean can_be_shown_with_clock();
@ -18,6 +18,6 @@ class SingleDynamicEffect : public Effect {
};
class MultiDynamicEffect : public SingleDynamicEffect {
public:
public:
void loop();
};

View File

@ -3,7 +3,7 @@
#include "my_fastled.h"
class FireEffect : public Effect {
private:
private:
uint8_t* data;
uint8_t spark_temp();
void cooldown();
@ -12,7 +12,7 @@ class FireEffect : public Effect {
void draw();
static CRGBPalette16 palette;
public:
public:
void start();
void stop();
void loop();

View File

@ -8,14 +8,14 @@
#include "my_color_palettes.h"
class MatrixEffectColumn {
private:
private:
int x, y;
int length;
Window* window;
uint16_t speed;
boolean running;
unsigned long last_move = 0;
public:
public:
MatrixEffectColumn();
MatrixEffectColumn(Window* win, int xPos);
@ -29,9 +29,9 @@ class MatrixEffectColumn {
};
class MatrixEffect : public Effect {
private:
private:
MatrixEffectColumn columns[LED_WIDTH];
public:
public:
boolean can_be_shown_with_clock();
MatrixEffect();
void loop();

View File

@ -6,7 +6,7 @@
#include "Effect.h"
class Sinematrix3Effect : public Effect {
private:
private:
double pangle = 0;
double angle = 0;
double sx = 0;
@ -27,7 +27,7 @@ class Sinematrix3Effect : public Effect {
double fy = 1.0 / (LED_HEIGHT / PI);
Matrix rotate;
public:
public:
boolean supports_window = true;
boolean can_be_shown_with_clock();
boolean clock_as_mask();

View File

@ -5,9 +5,9 @@
#include "my_fastled.h"
class StaticEffect : public Effect {
private:
private:
CRGB color;
public:
public:
StaticEffect(CRGB col);
boolean supports_window = true;
void loop();

View File

@ -5,11 +5,11 @@
#include <Arduino.h>
class TwirlEffect : public Effect {
private:
private:
uint8_t angleOffset = 0;
double center_x = 8;
double center_y = 8;
public:
public:
void loop();
};

View File

@ -1,34 +1,34 @@
/**
Animations are structured in AnimationData as follows:
Animations are structured in AnimationData as follows:
.colors contains .color_count*3 uint8_t values for R, G and B.
.colors contains .color_count*3 uint8_t values for R, G and B.
.offsets contains the frame start offsets within .data + the length of the data. (So
you can always do something like `for (int i=anim.offsets[i]; i<anim.offsets[i+1]; i++)`.
Accordingly it has a length of .frame_count+1.
.offsets contains the frame start offsets within .data + the length of the data. (So
you can always do something like `for (int i=anim.offsets[i]; i<anim.offsets[i+1]; i++)`.
Accordingly it has a length of .frame_count+1.
.data contains all frames data with a run-length compression with escape char 255.
This data references the index of one or multiple pixels in .colors. It starts at the
top left pixel and walks each row to the right before starting the next row.
To decode it: Start at a frame (indicated by .offsets). Get one byte as x.
If x is <255: This is a single pixel of color x.
if x is 255: Run-length-encoding. The next byte indicates of often the byte after that
will be repeated. So, {255, 4, 10} is equal to {10, 10, 10, 10}.
A special case that may happen in larger GIFs is that there are more than 255 repetitions
of a color. Those will be split, so 355*color #10 will be: {255, 255, 10, 255, 100, 10},
e.g. 255*10 + 100*10. Usually this shouldn't need special handling within a decoder.
Regarding colors in .data:
Color 0 means "keep the color from the previous frame". This color should never appear on frame #0.
Color 1 means "show the background color".
All other color values point to a color in .colors - with an offset of 2.
So if in .data there's a color 3, paint this pixel in .colors[1].
.data contains all frames data with a run-length compression with escape char 255.
This data references the index of one or multiple pixels in .colors. It starts at the
top left pixel and walks each row to the right before starting the next row.
To decode it: Start at a frame (indicated by .offsets). Get one byte as x.
If x is <255: This is a single pixel of color x.
if x is 255: Run-length-encoding. The next byte indicates of often the byte after that
will be repeated. So, {255, 4, 10} is equal to {10, 10, 10, 10}.
A special case that may happen in larger GIFs is that there are more than 255 repetitions
of a color. Those will be split, so 355*color #10 will be: {255, 255, 10, 255, 100, 10},
e.g. 255*10 + 100*10. Usually this shouldn't need special handling within a decoder.
Regarding colors in .data:
Color 0 means "keep the color from the previous frame". This color should never appear on frame #0.
Color 1 means "show the background color".
All other color values point to a color in .colors - with an offset of 2.
So if in .data there's a color 3, paint this pixel in .colors[1].
.individual_delays contains either 1 or .frame_count delays. They are given in ms and
indicate how long the matching frame should be displayed. If all times are equal, then
it contains only one entry and .individual_delays will be false.
.individual_delays contains either 1 or .frame_count delays. They are given in ms and
indicate how long the matching frame should be displayed. If all times are equal, then
it contains only one entry and .individual_delays will be false.
.w and .h contain the dimensions of the image.
**/
.w and .h contain the dimensions of the image.
**/
#include "Animation.h"
#include "functions.h"

View File

@ -137,4 +137,3 @@ uint8_t animation_weather_icons_data[] PROGMEM = {
uint16_t animation_weather_icons_delays[] = {0};
uint16_t animation_weather_icons_offsets[] = {0,69,210,354,489,621,734,821,925,1061,1216,1359,1479,1627,1772,1841,1954,2060,2166,2308,2421,2551,2681,2763,2845,2927,3009,3093};
AnimationData animation_weather_icons = {&animation_weather_icons_colors[0], &animation_weather_icons_data[0], &animation_weather_icons_offsets[0], &animation_weather_icons_delays[0], false, 15, 27, 16, 16};

View File

@ -2,11 +2,11 @@
__attribute__ ((aligned(4))) extern const TProgmemRGBGradientPalette_byte palette_fire[] FL_PROGMEM = {
0, 0, 0, 0, //black
128, 255, 0, 0, //red
224, 255,255, 0, //bright yellow
255, 255,255,255 }; //full white
128, 255, 0, 0, //red
224, 255,255, 0, //bright yellow
255, 255,255,255 }; //full white
__attribute__ ((aligned(4))) extern const TProgmemRGBGradientPalette_byte palette_matrix[] FL_PROGMEM = {
0, 0, 0, 0, // black
200, 0,255, 0, // green
255, 255,255,255 }; // white
200, 0,255, 0, // green
255, 255,255,255 }; // white

View File

@ -38,6 +38,6 @@ void BigClockEffect::loop() {
/*if (ntpClient.getSeconds() & 1) {
leds[XYsafe(13, 2)] = color_colon;
leds[XYsafe(13, 5)] = color_colon;
}*/
drawNumber(ntpClient.getSeconds(), 8, 8, color_colon);
}*/
drawNumber(ntpClient.getSeconds(), 8, 8, color_colon);
}

View File

@ -2,15 +2,15 @@
#include "config.h"
#ifndef MQTT_ENABLE
#pragma message "MQTT_ENABLE is false. Skipping MQTT."
#pragma message "MQTT_ENABLE is false. Skipping MQTT."
#else
#if defined( ESP8266 )
#include <ESP8266WiFi.h>
#include <ESP8266WiFi.h>
#elif defined( ESP32 )
#include <WiFi.h>
#include <WiFi.h>
#else
#error "Neither ESP32 nor ESP8266 set..."
#error "Neither ESP32 nor ESP8266 set..."
#endif
#include <PubSubClient.h>
#include "EffectEntry.h"

View File

@ -1,4 +1,5 @@
#include <ArduinoOTA.h>
#if defined( ESP8266 )
#include <ESP8266mDNS.h>
#elif defined( ESP32 )
@ -6,6 +7,7 @@
#else
#error Neither ESP32 nor ESP8266 set!
#endif
#include <ArduinoOTA.h>
#include "config.h"