Hello all
Im trying to send an image from a server to the pico2w board whcih is connected to a waveshare 7in5 b pico epaper display, the problem is that the server sends the image to the pico2w, it receives the image, sends the buffer to the display and the display shows the image but the pico2w goes into *** PANIC *** and gets stuck, i have tried troubleshooting a lot with no avail
i have some screens that show some tex with instructions which work fine but images from the server causes ** PANIC **
the full code is here - https://github.com/seedoh55/fp2
DISCLOSURE / i barely know how to program, all this was generated by claude. Go ahead and lambast me for that but would appreciate any help
This is the relevant code i think
Serial monitor output is as follows
Received more image data: total 96000 bytes
Connection closed by server
Processing received image data (96000 bytes)
Processing received image data (96000 bytes)
Copying 48000 bytes to black buffer...
Copying 48000 bytes to red buffer...
Updating display...
Sending 96000 bytes to display...
*** PANIC ***
Im trying to send an image from a server to the pico2w board whcih is connected to a waveshare 7in5 b pico epaper display, the problem is that the server sends the image to the pico2w, it receives the image, sends the buffer to the display and the display shows the image but the pico2w goes into *** PANIC *** and gets stuck, i have tried troubleshooting a lot with no avail
i have some screens that show some tex with instructions which work fine but images from the server causes ** PANIC **
the full code is here - https://github.com/seedoh55/fp2
DISCLOSURE / i barely know how to program, all this was generated by claude. Go ahead and lambast me for that but would appreciate any help
This is the relevant code i think
Code:
static void process_received_image(void) { printf("Processing received image data (%d bytes)\n", http_client.receive_length); // Validate buffer pointers before using them uint8_t* black_buffer = display_get_black_buffer(); uint8_t* red_buffer = display_get_red_buffer(); if (!black_buffer || !red_buffer) { printf("ERROR: Invalid display buffer pointers\n"); return; } // Check that we have enough data if (http_client.receive_length < DISPLAY_BUFFER_SIZE * 2) { printf("ERROR: Not enough image data (need %d bytes, got %d)\n", DISPLAY_BUFFER_SIZE * 2, http_client.receive_length); return; } printf("Copying %d bytes to black buffer...\n", DISPLAY_BUFFER_SIZE); memcpy(black_buffer, http_client.receive_buffer, DISPLAY_BUFFER_SIZE); printf("Copying %d bytes to red buffer...\n", DISPLAY_BUFFER_SIZE); memcpy(red_buffer, http_client.receive_buffer + DISPLAY_BUFFER_SIZE, DISPLAY_BUFFER_SIZE); printf("Updating display...\n"); display_update(); printf("Display updated successfully\n"); // Reset client data - avoids potential memory corruption http_client.receiving_image = false; // Update the last update time for adaptive checking last_update_time = get_system_time_ms(); printf("Updated last_update_time to %lu\n", last_update_time);}
Code:
// Update the display with current buffer contentsbool display_update(void) { // Make sure we have valid buffers if (!black_buffer || !red_buffer) { printf("ERROR: Display buffers not initialized\n"); return false; } // Add memory usage monitoring printf("Sending %d bytes to display...\n", DISPLAY_BUFFER_SIZE * 2); // Call the display function EPD_7IN5B_V2_Display(black_buffer, red_buffer); printf("Display update completed successfully\n"); // Since EPD_7IN5B_V2_Display doesn't have error reporting, // we assume success if it returns return true;}
Code:
/******************************************************************************function :Sends the image buffer in RAM to e-Paper and displaysparameter:******************************************************************************/void EPD_7IN5B_V2_Display(const UBYTE *blackimage, const UBYTE *ryimage){ UDOUBLE Width, Height; Width =(EPD_7IN5B_V2_WIDTH % 8 == 0)?(EPD_7IN5B_V2_WIDTH / 8 ):(EPD_7IN5B_V2_WIDTH / 8 + 1); Height = EPD_7IN5B_V2_HEIGHT; //send black data EPD_7IN5B_V2_SendCommand(0x10); for (UDOUBLE j = 0; j < Height; j++) { for (UDOUBLE i = 0; i < Width; i++) { EPD_7IN5B_V2_SendData(blackimage[i + j * Width]); } } //send red data EPD_7IN5B_V2_SendCommand(0x13); for (UDOUBLE j = 0; j < Height; j++) { for (UDOUBLE i = 0; i < Width; i++) { EPD_7IN5B_V2_SendData(~ryimage[i + j * Width]); } } EPD_7IN5B_V2_TurnOnDisplay();}
Serial monitor output is as follows
Received more image data: total 96000 bytes
Connection closed by server
Processing received image data (96000 bytes)
Processing received image data (96000 bytes)
Copying 48000 bytes to black buffer...
Copying 48000 bytes to red buffer...
Updating display...
Sending 96000 bytes to display...
*** PANIC ***
Statistics: Posted by robotseed55 — Mon Mar 03, 2025 12:57 pm — Replies 0 — Views 57