This commit is contained in:
Alexander Alber 2022-07-08 22:23:15 +02:00
commit b63d338e81
15 changed files with 79 additions and 16 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

BIN
firmware/assets/grayout.bin Normal file

Binary file not shown.

BIN
firmware/assets/out.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -29,4 +29,10 @@ struct FackelApp: public App {
void init();
void deinit();
void loop();
};
struct ImageDisplayApp: public App {
void init();
void deinit();
void loop();
};

Binary file not shown.

View File

@ -6,7 +6,7 @@
#include "zauberstab.h"
#undef NUM_LEDS
#define NUM_LEDS 45
#define NUM_LEDS 48
#define SAMPLING_FREQUENCY_BP 40 // number of energy chunks per second
#define SAMPLING_FREQUENCY_CONTROL \
@ -113,7 +113,6 @@ void BeatDetectApp::loop()
if (micros() - last_us_bp > sampling_period_bp)
{
n_samples = 0;
last_us_bp = micros();
// energy_fil += (energy - energy_fil) * 0.01;
@ -132,8 +131,6 @@ void BeatDetectApp::loop()
// y_fil[i] += (abs(y[i]) - y_fil[i]) * 0.005; //linie der
// scheitelpunkte
}
@ -183,16 +180,14 @@ void BeatDetectApp::loop()
for (int i = 0; i < NUM_LEDS; i++)
{
//leds[i].g = get_value(i, pos_target_filtered);
//leds[i].r = get_value(i, pos_target_filtered + 2);
//leds[i].b = get_value(i, pos_target_filtered - 2);
leds[i].g = get_value(i, pos_target_filtered);
leds[i].r = 0; //get_value(i, pos_target_filtered + 2);
leds[i].g = get_value(i, pos_target_filtered + 2);
leds[i].r = 0;//get_value(i, pos_target_filtered + 2);
leds[i].r = get_value(i, pos_target_filtered + 2);
leds[i].b = get_value(i, pos_target_filtered - 2);
//leds[i].g = get_value(i, pos_target_filtered);
//leds[i].g = get_value(i, pos_target_filtered + 2);
//leds[i].b = get_value(i, pos_target_filtered - 2);
}
FastLED.show();
}

View File

@ -95,8 +95,8 @@ void FackelApp::init()
for (int i = 0; i < 128; i++)
{
uint8_t r, g, b;
//hsl_to_rgb(i / 5, 255, i * 2 > 128 ? 128 : i * 2, &r, &g, &b);
hsl_to_rgb(i / 5 + 180, 255, i * 2 > 128 ? 128 : i * 2, &r, &g, &b);
hsl_to_rgb(i / 5, 255, i * 2 > 128 ? 128 : i * 2, &r, &g, &b);
//hsl_to_rgb(i / 5 + 180, 255, i * 2 > 128 ? 128 : i * 2, &r, &g, &b);
g = g == 1 ? 0 : g;
b = b == 1 ? 0 : b;
palette[i].r = r;

Binary file not shown.

View File

@ -0,0 +1,60 @@
#include "app.h"
#include "zauberstab.h"
#define __stringify_1(x) #x
#define __stringify(x) __stringify_1(x)
extern "C"
{
#define BASE_DIR "C:/Users/Binarykitchen/Documents/tom/fusion-zauberstab/firmware/"
asm(
".macro inc_sample name, filename\n\t"
".pushsection .rodata\n\t"
"\\name:\n\t"
".incbin \"\\filename\"\n\t"
"\\name\\()_size:\n\t"
".int \\name\\()_size - \\name\n\t"
".popsection\n\t"
".endm\n\t"
);
#define incbin(label, filename) \
asm("inc_sample " __stringify(label) ", " filename "\n\t"); \
extern const unsigned char label[]; \
extern const unsigned int label##_size; \
incbin(fusion_font, BASE_DIR "assets/fairydust.bin")
}
static CRGB get_pixel(unsigned int x, unsigned int y, unsigned int sx, const unsigned char *data) {
unsigned int idx = (x + y * sx) * 3;
CRGB color{};
color.r = data[idx];
color.g = data[idx + 1];
color.b = data[idx + 2];
return color;
}
void ImageDisplayApp::init() {
}
void ImageDisplayApp::deinit() {
}
void ImageDisplayApp::loop() {
static unsigned int col = 0;
unsigned int sx = fusion_font_size/(3*48);
for (int i = 0; i< NUM_LEDS; i++) {
leds[i] = get_pixel(col, i, sx, fusion_font);
}
col++;
col = col % 218;
FastLED.show();
}

View File

@ -15,11 +15,13 @@ struct FFTTestApp fft_test_app
struct FackelApp fackel_app
{
};
struct ImageDisplayApp image_display {};
std::vector<std::reference_wrapper<App>> apps = {
std::ref<App>(beat_detect_app),
std::ref<App>(fackel_app)
std::ref<App>(fackel_app),
//std::ref<App>(image_display),
};
static unsigned int current_app = 0;

View File

@ -34,8 +34,8 @@ int zauberstab_init()
}
myAcc.setDataRate(ADXL345_DATA_RATE_200);
myAcc.setRange(ADXL345_RANGE_8G);
myAcc.setGeneralTapParameters(ADXL345_XY0, 3.0, 30, 100.0);
myAcc.setRange(ADXL345_RANGE_16G);
myAcc.setGeneralTapParameters(ADXL345_XY0, 5.0, 50, 100.0);
myAcc.setAdditionalDoubleTapParameters(false, 250);
myAcc.setInterrupt(ADXL345_DOUBLE_TAP, INT_PIN_1);
attachInterrupt(digitalPinToInterrupt(4), double_tab_int, RISING);

BIN
inventor/klaue.stl Normal file

Binary file not shown.

BIN
inventor/mutter-halter.stl Normal file

Binary file not shown.