diff --git a/firmware/assets/Fairydust.png b/firmware/assets/Fairydust.png new file mode 100644 index 0000000..fb9b795 Binary files /dev/null and b/firmware/assets/Fairydust.png differ diff --git a/firmware/assets/Fusion_Font.png b/firmware/assets/Fusion_Font.png new file mode 100644 index 0000000..85e26e0 Binary files /dev/null and b/firmware/assets/Fusion_Font.png differ diff --git a/firmware/assets/fairydust.bin b/firmware/assets/fairydust.bin new file mode 100644 index 0000000..efa81ee Binary files /dev/null and b/firmware/assets/fairydust.bin differ diff --git a/firmware/assets/grayout.bin b/firmware/assets/grayout.bin new file mode 100644 index 0000000..b6c7033 Binary files /dev/null and b/firmware/assets/grayout.bin differ diff --git a/firmware/assets/out.png b/firmware/assets/out.png new file mode 100644 index 0000000..463c69f Binary files /dev/null and b/firmware/assets/out.png differ diff --git a/firmware/include/app.h b/firmware/include/app.h index afccd90..bfeeb21 100644 --- a/firmware/include/app.h +++ b/firmware/include/app.h @@ -29,4 +29,10 @@ struct FackelApp: public App { void init(); void deinit(); void loop(); +}; + +struct ImageDisplayApp: public App { + void init(); + void deinit(); + void loop(); }; \ No newline at end of file diff --git a/firmware/src/applications/assets/fusion_font.bin b/firmware/src/applications/assets/fusion_font.bin new file mode 100644 index 0000000..7e4fdc8 Binary files /dev/null and b/firmware/src/applications/assets/fusion_font.bin differ diff --git a/firmware/src/applications/beat_detect.cpp b/firmware/src/applications/beat_detect.cpp index 6c76964..80d3732 100644 --- a/firmware/src/applications/beat_detect.cpp +++ b/firmware/src/applications/beat_detect.cpp @@ -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(); } diff --git a/firmware/src/applications/fackel.cpp b/firmware/src/applications/fackel.cpp index 318d843..13c7ed6 100644 --- a/firmware/src/applications/fackel.cpp +++ b/firmware/src/applications/fackel.cpp @@ -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; diff --git a/firmware/src/applications/fusion_font.bin b/firmware/src/applications/fusion_font.bin new file mode 100644 index 0000000..7e4fdc8 Binary files /dev/null and b/firmware/src/applications/fusion_font.bin differ diff --git a/firmware/src/applications/image_display.cpp b/firmware/src/applications/image_display.cpp new file mode 100644 index 0000000..508de66 --- /dev/null +++ b/firmware/src/applications/image_display.cpp @@ -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(); +} \ No newline at end of file diff --git a/firmware/src/main.cpp b/firmware/src/main.cpp index 173594a..af40db5 100644 --- a/firmware/src/main.cpp +++ b/firmware/src/main.cpp @@ -15,11 +15,13 @@ struct FFTTestApp fft_test_app struct FackelApp fackel_app { }; +struct ImageDisplayApp image_display {}; std::vector> apps = { std::ref(beat_detect_app), - std::ref(fackel_app) + std::ref(fackel_app), + //std::ref(image_display), }; static unsigned int current_app = 0; diff --git a/firmware/src/zauberstab.cpp b/firmware/src/zauberstab.cpp index c65e1bb..b54a18d 100644 --- a/firmware/src/zauberstab.cpp +++ b/firmware/src/zauberstab.cpp @@ -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); diff --git a/inventor/klaue.stl b/inventor/klaue.stl new file mode 100644 index 0000000..bc6d28a Binary files /dev/null and b/inventor/klaue.stl differ diff --git a/inventor/mutter-halter.stl b/inventor/mutter-halter.stl new file mode 100644 index 0000000..f817166 Binary files /dev/null and b/inventor/mutter-halter.stl differ