It's working now! And looks quite nice.

This commit is contained in:
2021-01-04 12:44:41 +01:00
parent 4092306eb1
commit 43916c3b78
6 changed files with 74 additions and 36 deletions

View File

@ -1,5 +1,6 @@
#pragma once
#include <FastLED.h>
#include <vector>
#include <list>
#include "edge.h"
@ -9,17 +10,20 @@ class Corner {
Edge* e2;
Corner(Edge* e1, Edge* e2);
std::list<uint16_t> _leds;
std::list<Corner*> _long_neighbours {};
std::list<Corner*> _short_neighbours {nullptr};
std::vector<Corner*> _long_neighbours {};
std::vector<Corner*> _short_neighbours {};
CRGB color = CRGB(0x000000);
CRGB source_color;
CRGB target_color;
bool effect_running = false;
uint8_t color_blend_state = 255;
uint16_t effect_id;
void loop();
bool loop();
void draw();
void blend_to(CRGB color, uint16_t effect_id=0);
void add_led(uint16_t led_id);
void merge_leds(Corner* c);
private:
void infect(std::vector<Corner*>* neighbours);
};

View File

@ -10,7 +10,7 @@ class Node {
public:
Node* neighbours[CORNERS_PER_PART];
Edge* edges[CORNERS_PER_PART];
Corner* corners[CORNERS_PER_PART];
Corner* _corners[CORNERS_PER_PART];
Node(uint16_t number);
Node* create_neighbour(uint8_t edge);
};

View File

@ -1,6 +1,7 @@
#pragma once
#include <FastLED.h>
#include <list>
#include <vector>
#include "config.h"
#include "node.h"
#include "edge.h"
@ -9,6 +10,6 @@
extern std::list<Node*> nodes;
extern std::list<Edge*> edges;
extern std::list<Corner*> corners;
extern std::vector<Corner*> corners;
extern CRGB leds[LED_COUNT];