Esp8266 and tft_espi st7789

hi. i have been having issues with my Wemos d1 mini wired correctly to a 1.3" st7789 240x240 ips display. everything's been going fine so far, I've been following this tutorial so far:hackster io st7789
my issue is that I'm trying to move a simple 20x20 filled rectangle across the image. if you understand TFT displays then you will know that they do not refresh and therefore the square will appear to be smeared out across the screen. to avoid this smear effect, I've made some code that should redraw the area of the background image being covered by the square( this sounds complex, seeing the code might help ) in theory the code should work but when uploaded to the esp8266 wemos d1 mini, the board simply resets itself then throws up errors in serial monitor. my code is below, please attempt to help, thanks :grin:

#include "bitmap.h" //(Bitmap generated with LCD Image Converter)
TFT_eSPI tft = TFT_eSPI();   // Invoke library

void setup(void) {
  Serial.print("ST7789 TFT Bitmap Test");

  tft.begin();     // initialize a ST7789 chip
  tft.setSwapBytes(true); // Swap the byte order for pushImage() - corrects endianness

int y = 1;
void loop() {
  y = y+1;
  int maths = y*240;

Can you draw anything? A single pixel? A single, stationary rectangle? A line? The "mercy" image?

PS: your question would have more appropriately been posted in the...Displays...category of the forum. Displays - Arduino Forum

hi Dave, thanks for telling me, I've moved it to the correct area. yes, I've been able to use all the functions of the tft_eSPI library with my display, the image has shown correctly
the new post: St7789 with esp8266 wemos d1 mini

Please do NOT cross post / duplicate as it wastes peoples time and efforts to have more than one post for a single topic.

Continued cross posting could result in a time out from the forum.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.