vitotai / BrewPiLess

Use an ESP8266 to replace RPI and Arduino. Running BrewPi without Pi, therefore, BrewPi-Less
357 stars 134 forks source link

Help to use a 2.8 Inch 240x320 2.8" TFT LCD ILI9341 240*320 SPI #348

Open Hwerow opened 3 years ago

Hwerow commented 3 years ago

Hi Vito, What I would like to do is to customize and use a different display like a colour 2.8 Inch 240x320 2.8" TFT LCD Touch Screen Module ILI9341 240*320 SPI rather than the 1306 SSD OLED used in the program. From a hardware perspective, the 30 pin ESP32, that I have, has enough spare SPI pins and I think, the bodmer/TFT_eSPI library might be an option. My fundamental problem is that I don’t understand the C++ structure of BrewPiLess and my last foray into programming was BASIC. In the BrewPiLess software there are lots of .cpp and .h files and I think these presumably sub programs interact using #include in some way. Specifically; How would you suggest that I structure and write some code to be inserted into the existing program, to get at the data and display it on the alternate TFT screen. How would I go about finding the temperature, time, gravity and pressure values etc for the display? I have made minor modifications to the BrewPiLess software using Visual Studio Code, and modified the platformio.ini file, and am reasonably comfortable in using that program, and from looking at YouTube videos, I think I can work out the screen formatting Please could you share your advice.

Cheers Peter

vitotai commented 3 years ago

DisplayLcd.h/cpp are for displaying, including strings, position, and etc. You will have to modify it for none standard 20x4 displays. Take IicOledLcd.h/cpp as an example of Lcd drivers. However, the LCD "driver" is used by DisplayLcd.cpp, you might define your own driver instead of using the standard 20x4 LCD ones.

Hwerow commented 2 years ago

Hi Vito, Over the last few weeks I have been trying to get the TFT display to work with ESP32 and BPL. I used 4.2pre downloaded 8 Jan 2022 with VSCODE WIN10, and unmodified this works OK. Also I think that the wiring to the TFT is OK as I have tested it with a simple weather sketch that works. The steps that I have done are; 1 Added the TFT_eSP settings to platformio (see the attached file) 2 In Config.h set #define MORE_PINS_CONFIGURATION false //tft to remove pin conflict 3 In BrewPiLess.cpp I have taken it that this file is equivalent to main.cpp? Added at line 37 //tft

include

include

//tft Line 42 ish TFT_eSPI tft = TFT_eSPI(); // Invoke custom library Added manually an ‘include’ directory to clear an error message, with the header files for the fonts Then added to platformio.ini -I "d:/003a_Brewery_Upgrade/001_Production_versions/220108 4.2 pre/BPL4.2pre_TFT/220108_4.2_TFT/include" ; include directory for tft 4 BPL worked OK 5 In BrewPiLess.cpp Added tft.init(); //tft line ~1931 void setup(void){ tft.init(); //tft tft.fillScreen(TFT_RED);

if SerialDebug == true

Builds and uploads with no errors BUT BPL is not working, can't connect to web page and the OLED freezes. No TFT colour change. I have tried placing the tft.init in several places in the BrewPiless.cpp file but it still doesn't work.

Now I am stuck! It looks as if the tft.init() under the void setup(void){, while compiling, upsets BPL operation. I don’t know enough about programming or the structure of BPL to know how to solve this problem. Please could you help me and advise how I can resolve this problem. Thanks platformio.pdf

vitotai commented 2 years ago

One thing I can think of is that the assigned flash for program is near the limit. It is 97.4% (used 1595098 bytes from 1638400 bytes) when debug logging is turned on.

I suspect that TFT library might be too big to fit.

On Sat, Jan 8, 2022 at 10:39 AM Hwerow @.***> wrote:

Hi Vito, Over the last few weeks I have been trying to get the TFT display to work with ESP32 and BPL. I used 4.2pre downloaded 8 Jan 2022 with VSCODE WIN10, and unmodified this works OK. Also I think that the wiring to the TFT is OK as I have tested it with a simple weather sketch that works. The steps that I have done are; 1 Added the TFT_eSP settings to platformio (see the attached file) 2 In Config.h set #define MORE_PINS_CONFIGURATION false //tft to remove pin conflict 3 In BrewPiLess.cpp I have taken it that this file is equivalent to main.cpp? Added at line 37 //tft

include

include

//tft Line 42 ish TFT_eSPI tft = TFT_eSPI(); // Invoke custom library Added manually an ‘include’ directory to clear an error message, with the header files for the fonts Then added to platformio.ini -I "d:/003a_Brewery_Upgrade/001_Production_versions/220108 4.2 pre/BPL4.2pre_TFT/220108_4.2_TFT/include" ; include directory for tft 4 BPL worked OK 5 In BrewPiLess.cpp Added tft.init(); //tft line ~1931 void setup(void){ tft.init(); //tft tft.fillScreen(TFT_RED);

if SerialDebug == true

Builds and uploads with no errors BUT BPL is not working, can't connect to web page and the OLED freezes. No TFT colour change. I have tried placing the tft.init in several places in the BrewPiless.cpp file but it still doesn't work.

Now I am stuck! It looks as if the tft.init() under the void setup(void){, while compiling, upsets BPL operation. I don’t know enough about programming or the structure of BPL to know how to solve this problem. Please could you help me and advise how I can resolve this problem. Thanks platformio.pdf https://github.com/vitotai/BrewPiLess/files/7832443/platformio.pdf

— Reply to this email directly, view it on GitHub https://github.com/vitotai/BrewPiLess/issues/348#issuecomment-1007871245, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADZW2PIKN5FXXBQB6LS2VYLUU6PXZANCNFSM5GWGVS3Q . You are receiving this because you commented.Message ID: @.***>

Hwerow commented 2 years ago

I didn't think I had debugging turned on, I was using env:esp32. Anyway - What can I turn off to save flash memory? Use different partition settings?

Hwerow commented 2 years ago

I have changed the partition.csv to no_ota.csv https://github.com/espressif/arduino-esp32/blob/master/tools/partitions/no_ota.csv Now the OLED displays most of the time and it connects. However, when I have tft_init() anywhere in the BrewPiLess.cpp file the WiFi appears to continually cycle and try to initialise but not connect and no TFT display. Thoughts?

Hwerow commented 2 years ago

Progress - sort of - because I am using the SPI HSPI port I found a note in the TFT-ESPI User_Setup.h
// The ESP32 has 2 free SPI ports i.e. VSPI and HSPI, the VSPI is the default. // If the VSPI port is in use and pins are not accessible (e.g. TTGO T-Beam) [BPL in my case] // then uncomment the following line:

define USE_HSPI_PORT

Which I have now done and tft_init() in BrewPiLess no longer stuffs up the OLED display, WiFi, and the browser. But I can't get anything to display on the TFT display