From 2e91f929a5a46c262083acab7916c38a6d5f6c0e Mon Sep 17 00:00:00 2001 From: Antoine Doussaud Date: Wed, 31 May 2023 17:55:06 +0200 Subject: [PATCH] add proto bard + fix bug --- platformio.ini | 69 +++++++++++++++++++++++++++++++++++++++++++++++++- src/main.cpp | 11 +++++--- 2 files changed, 75 insertions(+), 5 deletions(-) diff --git a/platformio.ini b/platformio.ini index 26e8a2e..1c2b289 100644 --- a/platformio.ini +++ b/platformio.ini @@ -587,7 +587,6 @@ lib_deps = ; jfturcot/SimpleTimer@0.0.0-alpha+e2FTPServer - [env:Banane_V1] extends = env:esp32 @@ -656,4 +655,72 @@ lib_deps = ; jfturcot/SimpleTimer@0.0.0-alpha+e2FTPServer + +[env:Banane_V1_proto] + +extends = env:esp32 +; board_build.partitions = min_spiffs.csv + +build_flags = + -D HOSTNAME='"Spectre Banane V1"' + ; -D BOARD_HAS_PSRAM + ; -mfix-esp32-psram-cache-issue + + ; -D USE_WIFI_MANAGER + -D USE_BLE + ; -D USE_AP + ; -D USE_WIFI + ; -D USE_FTP + -D USE_ANIM + ; -D USE_OTA + + ; -D PRINT_FPS + -D USE_SPIFFS + ; -D USE_SD + + ; -D USE_UDP + -D USE_ZLIB + ; -D MINIZ_USE_PSRAM + + -D LED_TOTAL=2048 + -D NUM_STRIPS=1 + -D LED_SIZE=3 + + -D USE_HUB75 + -D NO_GFX + + -D PIXEL_COLOR_DEPTH_BITS=5 + + -D R1_PIN=25 + -D G1_PIN=26 + -D B1_PIN=27 + -D R2_PIN=14 + -D G2_PIN=12 + -D B2_PIN=13 + -D A_PIN=23 + -D B_PIN=19 + -D C_PIN=5 + -D D_PIN=17 + -D E_PIN=-1 + -D CLK_PIN=16 + -D LAT_PIN=4 + -D OE_PIN=15 + + -D BRIGHTNESS=50 + + -D MATRIX_W=64 + -D MATRIX_H=32 + -D MATRIX_CHAIN=1 + -D MATRIX_LATCH_BLANK=1 + + -D DMA_DOUBLE_BUFF=1 + +lib_deps = + https://github.com/spectrenoir06/artnet.git + https://github.com/spectrenoir06/AsyncUDP.git + https://github.com/mrfaptastic/ESP32-HUB75-MatrixPanel-I2S-DMA + https://github.com/tzapu/WiFiManager.git + h2zero/NimBLE-Arduino@^1.3.7 + ; jfturcot/SimpleTimer@0.0.0-alpha+e2FTPServer + \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index d1792a6..c28a65d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -272,7 +272,7 @@ void set_all_pixel(uint8_t r, uint8_t g, uint8_t b, uint8_t w) { // Serial.print(rxValue[i]); // Serial.println(); - if (rxValue.length() > 0 && rxValue[0] == '!') { + if (rxValue.length() > 0 && rxValue[0] == '!' && !image_receive_mode) { switch (rxValue[1]) { case 'B': switch (rxValue[2]) { @@ -326,15 +326,18 @@ void set_all_pixel(uint8_t r, uint8_t g, uint8_t b, uint8_t w) { } } - if (byte_to_store >= (img_receive_width * img_receive_height * (img_receive_color_depth/8))) { + if (image_receive_mode) { + Serial.printf("Byte receive: %d, wait: %d\n", byte_to_store, (img_receive_width * img_receive_height * (img_receive_color_depth / 8) - byte_to_store)); + } + + if (image_receive_mode && byte_to_store >= (img_receive_width * img_receive_height * (img_receive_color_depth / 8))) { Serial.printf("Image complete\n"); display->fillScreenRGB888(0, 0, 0); for (int i = 0; i < (img_receive_width * img_receive_height); i++) { if (img_receive_color_depth == 16) display->drawPixel((i) % img_receive_width, (i) / img_receive_width, leds[i * 2] + (leds[i * 2 + 1] << 8)); - else { + else display->drawPixelRGB888((i) % img_receive_width, (i) / img_receive_width, leds[i*3], leds[i*3+1], leds[i*3+2]); - } } flip_matrix(); image_receive_mode = false;