STarted reorganizing files into proper .h and .cpp files.

This commit is contained in:
Fabian Schlenz 2019-05-28 05:46:25 +02:00
parent ce0c834326
commit 2cbb981eea
4 changed files with 29 additions and 16 deletions

View File

@ -30,19 +30,10 @@
.w and .h contain the dimensions of the image.
**/
typedef struct {
uint8_t *colors;
uint8_t *data;
uint16_t *offsets;
uint16_t *delays;
boolean individual_delays;
int color_count;
int frame_count;
int w;
int h;
} AnimationData;
#ifndef Animations_H
#define Animations_H
#include <Arduino.h>
#include "prototypes.h"
uint8_t animation_koopa_colors[] PROGMEM = {182, 154, 17, 0, 0, 0, 48, 48, 48, 142, 4, 6, 254, 252, 255, 3, 1, 138, 17, 239, 18};
uint8_t animation_koopa_data[] PROGMEM = {
@ -159,3 +150,5 @@ uint8_t animation_heart_data[] PROGMEM = {
uint16_t animation_heart_delays[] = {100, 100, 100, 100, 100, 100, 100, 400, 100, 100, 100, 100, 100, 100, 200};
uint16_t animation_heart_offsets[] = {0, 190, 344, 608, 875, 1025, 1291, 1588, 1790, 1944, 2208, 2473, 2627, 2893, 3190, 3392};
AnimationData animation_heart = {&animation_heart_colors[0], &animation_heart_data[0], &animation_heart_offsets[0], &animation_heart_delays[0], false, 4, 15, 32, 32};
#endif

16
include/prototypes.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef prototypes_H
#define prototypes_H
typedef struct {
uint8_t *colors;
uint8_t *data;
uint16_t *offsets;
uint16_t *delays;
boolean individual_delays;
int color_count;
int frame_count;
int w;
int h;
} AnimationData;
#endif

View File

@ -1,3 +1,7 @@
#include <Arduino.h>
#include <FastLED.h>
#include "prototypes.h"
struct EffectEntry {
char* name;
Effect* effect;
@ -285,12 +289,12 @@ class SingleDynamic : public Effect {
}
boolean can_be_shown_with_clock() { return true; }
virtual void loop() {
EVERY_N_MILLISECONDS(getLoopTime()) {
EVERY_N_MILLISECONDS(getLoopTime()) {
memcpy(old_tiles, tiles, tile_count*sizeof(CRGB));
blend = 0;
update();
}
for (int x=0; x<window.w; x++) for (int y=0; y<window.h; y++) {
int index = y/2 * window.w/2 + x/2;
setPixel(window, x, y, nblend(old_tiles[index], tiles[index], blend));

View File

@ -11,6 +11,7 @@
#include "ntp.h"
#include "config.h"
#include "animations.h"
CRGB leds[LED_COUNT];
WiFiClient wifi;
WiFiUDP ntpUDP;
@ -47,7 +48,6 @@ class Effect {
#include "functions.h"
#include "text.h"
#include "sprites.h"
#include "animations.h"
#include "tools.h"
SimpleList<Effect*>* cycle_effects;