WIP: Strange exceptions in Corner: Crashing when accessing _short_neighbours after a corner is finished animating.

This commit is contained in:
2021-01-04 11:39:46 +01:00
parent 3290c7e794
commit 4092306eb1
7 changed files with 158 additions and 13 deletions

View File

@ -1,3 +1,25 @@
#pragma once
#include <FastLED.h>
#include <list>
#include "edge.h"
class Corner {};
class Corner {
public:
Edge* e1;
Edge* e2;
Corner(Edge* e1, Edge* e2);
std::list<uint16_t> _leds;
std::list<Corner*> _long_neighbours {};
std::list<Corner*> _short_neighbours {nullptr};
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();
void draw();
void blend_to(CRGB color, uint16_t effect_id=0);
void add_led(uint16_t led_id);
void merge_leds(Corner* c);
};

View File

@ -1,3 +1,6 @@
#pragma once
class Edge {};
class Edge {
public:
Edge* neighbour = nullptr;
};

View File

@ -5,10 +5,12 @@
#include "corner.h"
class Node {
private:
uint16_t _number;
public:
Node* neighbours[CORNERS_PER_PART];
Edge* edges[CORNERS_PER_PART];
Corner* corners[CORNERS_PER_PART];
Node();
Node(uint16_t number);
Node* create_neighbour(uint8_t edge);
};