aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2021-11-30 15:29:34 +0100
committerlonkaars <loek@pipeframe.xyz>2021-11-30 15:29:34 +0100
commit687673761e6f8542f8436fb2f0fb633a59978f48 (patch)
tree72670a20953bcd477a8c6a93b9ae3f7fcc9c834f
parentc3c3b5d5ff5de2276e9766c90b7b1c3858a71695 (diff)
animation 2 working
-rw-r--r--readme.md8
-rw-r--r--software/animation.ino19
-rw-r--r--software/effects.ino17
3 files changed, 16 insertions, 28 deletions
diff --git a/readme.md b/readme.md
index f391296..c62ba15 100644
--- a/readme.md
+++ b/readme.md
@@ -46,9 +46,5 @@ software/
└── util.ino gereedschapsfuncties
```
-de code voor de animaties is nog niet compleet af, animatie 1 en 3 doen het
-inmiddels, maar 2 heeft nog wat problemen door de `fill_plane` functie. deze ga
-ik opnieuw implementeren en woensdag testen.
-
-ook het algoritme om lege scanrijen over te slaan is nog niet afgewerkt en
-wordt dus ook op woensdag getest.
+het algoritme om lege scanrijen over te slaan is nog niet afgewerkt en wordt op
+woensdag getest.
diff --git a/software/animation.ino b/software/animation.ino
index dabac0c..1893abe 100644
--- a/software/animation.ino
+++ b/software/animation.ino
@@ -16,21 +16,16 @@ unsigned int zigzag(unsigned int size, int index) {
return mod < size - 1 ? mod : zigzag_size - mod;
}
-const unsigned int weights[3] = {16, 4, 1};
-void fill_plane(unsigned int direction, unsigned int axis3_offset) {
+const unsigned int weights[3] = {1, 4, 16};
+void fill_plane(unsigned int direction, unsigned int offset) {
for(int i = 0; i < 16; i++) {
- unsigned char axis1_offset = i / 4;
- unsigned char axis2_offset = i % 4;
+ unsigned int index = offset * weights[direction];
+ index += (i / 4) * weights[(direction + 1) % 3];
+ index += (i % 4) * weights[(direction + 2) % 3];
- unsigned int axis1_weight = weights[(direction + 1) % 3];
- unsigned int axis2_weight = weights[(direction - 1) % 3];
- unsigned int axis3_weight = weights[direction];
+ Serial.print("xyz"[direction]);
- led_state[led_map[
- (axis1_offset * axis1_weight +
- axis2_offset * axis2_weight +
- axis3_offset * axis3_weight) % 64
- ]] = 1;
+ led_state[led_map[index]] = 1;
}
}
diff --git a/software/effects.ino b/software/effects.ino
index ed4a0b1..b320e8e 100644
--- a/software/effects.ino
+++ b/software/effects.ino
@@ -2,11 +2,10 @@
#include "effects.h"
#include "animation.h"
-// #define FX_LEN_ROUNDABOUT (unsigned long) 5e3
-#define FX_LEN_ROUNDABOUT (unsigned long) 0
+#define FX_LEN_ROUNDABOUT (unsigned long) 5e3
void fx_roundabout (unsigned long relative_time) {
memset(led_state, 0, sizeof(led_state));
- unsigned long tick = relative_time / 300;
+ unsigned long tick = relative_time / 100;
unsigned int roundabout_coordinates[12] = {
0x0, 0x1, 0x2, 0x3, 0x7, 0xb,
0xf, 0xe, 0xd, 0xc, 0x8, 0x4
@@ -20,21 +19,19 @@ void fx_roundabout (unsigned long relative_time) {
return;
}
-#define FX_LEN_WIPEXYZ (unsigned long) 6e3
+#define FX_LEN_WIPEXYZ (unsigned long) 7e3
void fx_wipexyz (unsigned long relative_time) {
memset(led_state, 0, sizeof(led_state));
unsigned long tick = relative_time / 200;
- unsigned int direction = (tick / 6) % 3;
+ unsigned int direction = (tick / 7) % 3;
- fill_plane(direction, zigzag(4, tick));
- // fill_plane(0, 2);
+ fill_plane(direction, zigzag(4, tick % 7));
return;
}
-// #define FX_LEN_RAINFALL (unsigned long) 7e3
-#define FX_LEN_RAINFALL (unsigned long) 0
-#define FX_FPS_RAINFALL (double) 10
+#define FX_LEN_RAINFALL (unsigned long) 8e3
+#define FX_FPS_RAINFALL (double) 15
unsigned long last_frame;
void fx_rainfall (unsigned long relative_time) {
unsigned long frame = get_frame(relative_time, FX_FPS_RAINFALL);