Rawimage.h and trying to use wifi slows down arduino ide and wio terminal

Hi!
Ive been trying todo a splash-screen in a project ive been working with.
But for some reason, it never shows the splashscreen and first I thought it was a problem with
the sd-filesystem.
But when trying the displayphotos sketch supplied by seeed everything worked as expected.

Then I just tried to include atwifi and multiwifi that i used for wifi and the program hangs with a white screen on the wio terminal.
Now when you try to compile a new sketch the Arduino ide becomes slower than usual and it hangs up on upload sketch. Nothing gets transfered to the wio terminal.

Only way to upload a sketch was to turn off the Wio Terminal (then the arduino ide compiled as fast as ususal again) and try to time it just before the ide switches to uploading sketch, to turn on the Wio Terminal again. After 3 tries it worked :slight_smile:

Seems like there is some sort of conflict between rawimage.h and the wifi-libraries?.
Anyone else got it to work?

Hi @ChrisCross

How big is your image. This may coz of the ram shortage if using too much together. As for wifi library, the bottom layer runs freeRTOS that takes about at least 75kb of ram, and if using a pic to fill the whole screen(.ie 320x240) might overflow.

Yes, the picture is 320x240, so it might be why it will not work then?
I will try another size of image to see if the problem persists.

Yes, let me know how it gets on

No, tried a small image, same fault.
And now Ive tried to upload a new sketch 12 times without succeding. Its like its sending data out from the usb and slowing down the arduino ide aswell cause the compiler of new code gets slow

So now I cant use the Wio Terminal at all :confused:

edit : i was finally able to flash new code into the unit!.
It seems like it hangs up when its going to use the routine to draw the picture on the screen.
cause everything works up until that part.

My code basicly until that part only starts serial port, starts the screen, and connects to wifi… and than starts the sd-card, and after that it hangs when it comes to the draw image

Got you, do you mind sharing the simple version of your code. We will use this to debug :smiley:

ofcourse =)
Maybe I have done something wrong with the code, but its most copy and paste in the begining from other examples.

the libraries used are the latest from your github and pubsubclient is the latest from arduino library manager.

#include <TFT_eSPI.h>
#include <AtWiFi.h>
#include <WiFiMulti.h>
#include <Seeed_FS.h>
#include "RawImage.h"

const char* mqtt_server = "192.168.43.190";

WiFiClient espClient;
PubSubClient client(espClient);
WiFiMulti WiFiMulti;
TFT_eSPI tft;

void setup()
{
pinMode(WIO_5S_PRESS, INPUT_PULLUP);  // for menu
 
Serial.begin(115200);
delay(10);
 
while (!SD.begin(SDCARD_SS_PIN, SDCARD_SPI))
{
delay(1000);
return;
}
 
delay(10);

tft.begin();
tft.setRotation(3);
tft.fillScreen(TFT_BLACK); //Black background
tft.setTextSize(2);

// code stops working here for me...

drawImage<uint16_t>("photos/2.bmp",0,0);

delay(100);
   
WiFiMulti.addAP(myrouter, password :-);
 
Serial.println();
Serial.print("Waiting for WiFi... ");
 

while (WiFiMulti.run() != WL_CONNECTED)
{
    Serial.print(".");
    delay(500);
}  

}


void loop()
{

}

somehow #include <PubSubClient.h> got lost in my copy and paste, but its there in the original code :slight_smile:

I have a similar issue with the “Wio Terminal”.
But I found 2 workarounds:

  1. Try to use an image of type: “uint8_t”
  2. Or just use a smaller size image.

Note: But instead WIFI I used BLE (BlueTooth)
The device hangs on the command:

drawImage<uint16_t>(“hello16.bmp”, 0, 0)

And you can’t update it with another new code, the device can’t be updated with new code anymore.

So Before you “re-Flush it” or try randomly, Off-On etc while compiling and uploading.
(Somewhere there is a point that the device is not frozen, and may accept the new compilation.)

But I found that If I delete all the 16bits images from the SD & don’t refer to them in the code, the device would accept new uploads from the Arduino Studio.

1 Like

I ran into similar issue and followed your suggestion to use 8 bit image along with Wifi and it worked for me. Thanks.