From 22ee547b4bd1250102f81afde80da259e89abe71 Mon Sep 17 00:00:00 2001 From: Thomas Ballmann Date: Fri, 1 May 2020 18:08:13 +0200 Subject: [PATCH] #7 do some clean up stuff at the end --- src/imageJPEG.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/imageJPEG.cpp b/src/imageJPEG.cpp index 3040507..97bef59 100644 --- a/src/imageJPEG.cpp +++ b/src/imageJPEG.cpp @@ -151,18 +151,22 @@ void jpegFlushFramebuffer() // initialise the decoder to give access to image information int ret = JpegDec.decodeFile("/tmp.jpeg"); - Serial.print("decodeFile ret = "); - Serial.println(ret); + if (ret == 1) { + Serial.print("decodeFile ret = "); + Serial.println(ret); - // print information about the image to the serial port - jpegInfo(); + // print information about the image to the serial port + jpegInfo(); - // render the image onto the screen at coordinate 0,0 - if (JpegDec.width > 0 && JpegDec.height) { + // render the image onto the screen at coordinate 0,0 renderJPEG(0, 0); + } else { Serial.println("!!!! unkown jpeg format !!!!"); } + + // reset decoder + JpegDec.abort(); } }