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 -
This is the relevant code i think
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 display with current buffer contents
bool display_update(void) {
// Make sure we have valid buffers
if (!black_buffer || !red_buffer) { printf("ERROR: Display buffers not initialized\n"); return 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);
}```
// 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;
}
// Update the display with current buffer contents
bool 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;
}
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 ***
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745063474a4609109.html
评论列表(0条)