0

Adafruit ESP8266 WiFi Weather Station - Upgrade to 3.5" 320x
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adafruit ESP8266 WiFi Weather Station - Upgrade to 3.5" 320x

by zelthian on Tue Apr 27, 2021 6:51 pm

I'm currently trying to adapt the code of the Adafruit ESP8266 WiFi Weather Station (https://learn.adafruit.com/wifi-weather ... ft-display) from the 2.4" 320x480 featherwing display in the guide to the 3.5" 320x480 featherwing display.

I've had limited success. While the 3.5" display is used with the Adafruit HX8397 library, it does work with the Mini Grafx ILI9341_SPI library used in the project simply by changing the necessary pins indicated in the code. I can even initialize the touch screen, and the graphics do display on the screen.

The issue is that the graphics are displayed on a smaller portion of the screen (assumed to be the original 240x320 area), and no matter what I do, I can't get the display to extend to the entire 320x480 area of the new screen. I've gone so far as to change the width and height settings in the ILI9341_SPI.h file, no to avail.

Any suggestions would be greatly appreciated.

zelthian
 
Posts: 13
Joined: Sun Dec 26, 2010 12:15 am
Location: Denver Metro

Re: Adafruit ESP8266 WiFi Weather Station - Upgrade to 3.5"

by mikeysklar on Wed Apr 28, 2021 5:30 pm

Have you changed these two values in the sketch:

Code: Select all | TOGGLE FULL SIZE
$ grep SCREEN_ esp8266-weather-station-color.ino
int SCREEN_WIDTH = 240;
int SCREEN_HEIGHT = 320;

mikeysklar
 
Posts: 4508
Joined: Mon Aug 01, 2016 8:10 pm

Re: Adafruit ESP8266 WiFi Weather Station - Upgrade to 3.5"

by zelthian on Wed Apr 28, 2021 5:55 pm

mikeysklar wrote:Have you changed these two values in the sketch:

Code: Select all | TOGGLE FULL SIZE
$ grep SCREEN_ esp8266-weather-station-color.ino
int SCREEN_WIDTH = 240;
int SCREEN_HEIGHT = 320;


Yes. Those were the first values I changed.

zelthian
 
Posts: 13
Joined: Sun Dec 26, 2010 12:15 am
Location: Denver Metro

Re: Adafruit ESP8266 WiFi Weather Station - Upgrade to 3.5"

by mikeysklar on Thu Apr 29, 2021 1:04 pm

Looking closer at the those SCREEN_WIDTH and SCREEN_HEIGHT variables it does not look as though any of the code references those variables.

I did see some manual 320 x 240 settings in the example Weather Station (master.zip) you might want to take a closer look at a few places where 320 and 240 are explitictely being set into the graphics drawing.

Code: Select all | TOGGLE FULL SIZE
 $ find . -type f -exec grep 240 {} /dev/null \;
./esp8266-weather-station-color.ino:int SCREEN_WIDTH = 240;
./esp8266-weather-station-color.ino:Carousel carousel(&gfx, 0, 0, 240, 100);
./esp8266-weather-station-color.ino:  gfx.drawRect(10, 168, 240 - 20, 15);
./esp8266-weather-station-color.ino:  gfx.drawStringMaxWidth(15, 200, 240 - 2 * 15, forecasts[0].forecastText);*/
./esp8266-weather-station-color.ino:  gfx.drawStringMaxWidth(15, 265, 240 - 2 * 15, ESP.getResetInfo());
./TouchControllerWS.cpp:        dx = 240.0 / abs(p1.y - p2.y);
./moonphases.h:  0x3B, 0x88, 0x73, 0x19,  // 199:15240
./moonphases.h:  0x4A, 0xDA, 0x63, 0x16,  // 240:19162
./moonphases.h:  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x80,0x3F,0x00,0x00,0x0E,0xE0,0xFF,0x01,0x00,0x4E,0xF0,0xFF,0x03,0x00,0xEE,0xF8,0xFF,0x07,0x00,0x7E,0xFC,0xC0,0x0F,0x00,0x3C,0x3C,0x00,0x0F,0x00,0x1C,0x1E,0x00,0x1E,0x00,0x3C,0x0E,0x00,0x1C,0x00,0x3E,0x0E,0x00,0x1C,0x00,0x7F,0x0E,0x00,0x1C,0x80,0xF3,0x0F,0x00,0x1C,0x00,0xE1,0x1F,0x00,0x1E,0x00,0xC0,0x1F,0x00,0x0F,0x00,0x80,0x7F,0xC0,0x0F,0x00,0x00,0xFF,0xFF,0x07,0x00,0x00,0xFE,0xFF,0x03,0x00,0x00,0xF8,0xFF,0x01,0x00,0x00,0xC0,0x3F, // 240
./ArialRounded.h:  0x09, 0x61, 0x0A, 0x05,  // 180:2401
./ArialRounded.h:  0x0E, 0xC4, 0x17, 0x08,  // 240:3780
./ArialRounded.h:  0x00,0x0E,0x00,0x00,0x1F,0x00,0xE0,0x31,0x00,0xB0,0x20,0x00,0xF0,0x20,0x00,0xF0,0x31,0x00,0xC0,0x1F,0x00,0x00,0x0F, // 240
./ArialRounded.h:  0x33, 0xB8, 0x6A, 0x15,  // 187:13240
./ArialRounded.h:  0x3B, 0x88, 0x89, 0x18,  // 200:15240
./ArialRounded.h:  0x4E, 0x39, 0x7C, 0x16,  // 240:20025
./ArialRounded.h:  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x1F,0x00,0x00,0x00,0x00,0xF0,0x7F,0x00,0x00,0x00,0x00,0xF8,0xFF,0x00,0x00,0x00,0x00,0xFC,0xFF,0x01,0x00,0x00,0x00,0xFE,0xFF,0x03,0x00,0x00,0x60,0x7E,0xF0,0x03,0x00,0x00,0x74,0x1F,0xC0,0x03,0x00,0x00,0x7E,0x1F,0xC0,0x07,0x00,0x00,0x3E,0x0F,0x80,0x07,0x00,0x00,0x3E,0x0F,0x80,0x07,0x00,0x00,0x7C,0x0F,0x80,0x07,0x00,0x00,0xFC,0x0F,0x80,0x07,0x00,0x00,0xFE,0x1F,0xC0,0x07,0x00,0x00,0xFE,0x1F,0xC0,0x03,0x00,0x00,0xE6,0x7F,0xF0,0x03,0x00,0x00,0xC0,0xFF,0xFF,0x03,0x00,0x00,0x80,0xFF,0xFF,0x01,0x00,0x00,0x00,0xFE,0xFF,0x00,0x00,0x00,0x00,0xF8,0x7F,0x00,0x00,0x00,0x00,0xC0,0x1F,  // 240
./README.md:ESP8266 Weather Station Color using ILI9341 240x320 TFT display
./README.md:The code in this project supports an ILI9341 240x320 TFT display with code running on an ESP8266. To get you up and running in no time we created a kit which contains all the necessary parts including a custom PCB to connect display and WiFi chip:
pi@pidev:~/Downloads/ada/esp8266-weather-station-color-master $ find . -type f -exec grep 320 {} /dev/null \;
./esp8266-weather-station-color.ino:int SCREEN_HEIGHT = 320;
./esp8266-weather-station-color.ino:    if (y > 320) {
./TouchControllerWS.cpp:        dy = 320.0 / abs(p1.x - p2.x);
./TouchControllerWS.cpp:    int y = 320 - (p.x - ay) * dy;
./moonphases.h:  0x2C, 0x38, 0x68, 0x17,  // 126:11320
./moonphases.h:  0x33, 0x91, 0x3F, 0x0F,  // 178:13201
./ArialRounded.h:  0x0C, 0x84, 0x1D, 0x0B,  // 214:3204
./README.md:ESP8266 Weather Station Color using ILI9341 240x320 TFT display
./README.md:The code in this project supports an ILI9341 240x320 TFT display with code running on an ESP8266. To get you up and running in no time we created a kit which contains all the necessary parts including a custom PCB to connect display and WiFi chip:

mikeysklar
 
Posts: 4508
Joined: Mon Aug 01, 2016 8:10 pm

Re: Adafruit ESP8266 WiFi Weather Station - Upgrade to 3.5"

by zelthian on Thu Apr 29, 2021 6:34 pm

mikeysklar wrote:I did see some manual 320 x 240 settings in the example Weather Station (master.zip) you might want to take a closer look at a few places where 320 and 240 are explitictely being set into the graphics drawing.


Did this too. Changed all assumed-relevant references to 320 to 480, then went back and changed 240 to 320.

I also found references in the base libraries, notable the the ILI9341_SPI.h file in the Mini Grafx library which has ILI9341_TFTWIDTH and ILI9341_TFTHEIGHT variables that I changed.

.... Or at least I THOUGHT I did. I may have edited the Adafruit version instead of the Mini Grafx version. The good news is that it looks like the screen is being activated now (not sure that's the right word, the whole screen clears instead of being "snowy" outside the 240x320 area), but the graphics drawn on the screen still conform to a 240x320 area. Looks like I'll need to comb through the code to reposition everything. Bleh.

zelthian
 
Posts: 13
Joined: Sun Dec 26, 2010 12:15 am
Location: Denver Metro

Re: Adafruit ESP8266 WiFi Weather Station - Upgrade to 3.5"

by mikeysklar on Fri Apr 30, 2021 11:46 am

Yeah, sadly it appears things are heavily hardcoded to the smaller 2.4" TFT resolution.

Good job getting rid of the snow. Let us know if you figure out what changes needed to be made to make this all go on the 3.5" TFT at full resolution.

mikeysklar
 
Posts: 4508
Joined: Mon Aug 01, 2016 8:10 pm

Re: Adafruit ESP8266 WiFi Weather Station - Upgrade to 3.5"

by zelthian on Fri Apr 30, 2021 11:58 am

mikeysklar wrote:Let us know if you figure out what changes needed to be made to make this all go on the 3.5" TFT at full resolution.


Changing the width/height settings in the main codeblock (int SCREEN_WIDTH = 240 / int SCREEN_HEIGHT = 320) and the related variables in the Mini Grafx ILI9341_SPI.h file did the trick for having the entire screen available.

Once that's done, you then have to go through all the code and manually reposition everything... stretch the progress bars, reposition/recenter the text, reposition the touchscreen calibration dots, etc etc etc.

Once THAT's done, you then have to go and recreate the font header (AriealRounded.h) because the size of the text is defined by this file. That's my next step.

Lots of work. I didn't realize what I was getting into when I started this project, but I'm determined to finish it. :)

zelthian
 
Posts: 13
Joined: Sun Dec 26, 2010 12:15 am
Location: Denver Metro

Please be positive and constructive with your questions and comments.