The problem I think I have is that I can't edit the library file, where the include to lv_conf.h lives. LVGL usually expects to find this file at the same level as the library directory, not in the directory itself. LVGL is there as part of the standard library includes, but it looks like no-ones actually tried it before (from what I can see searching for help before I tried the forum. LVGL itself is a big beast with quite a deep hierarchy as well. I could paste the entire contents of the lv_conf.h into one of my files and include it in my sketch, but it won't affect the issue with the include.
I'm happy to share ... the actual full sketch is substantial now, but here's the includes, etc. at the beginning.
// lvgl - Version: 8.3.6
#include <lvgl.h>
#include <TFT_eSPI.h>
#include <ui.h>
#include "globals.h"
#include "pitches.h"
#include "myEvents.h"
#include <TouchScreen.h>
#include "pins.h"
#include <WiFiNINA.h>
#include "stringTuple.h"
#include "wifiFunctions.h"
#include "globals.h"
#include "pressureConverter.h"
/*Don't forget to set Sketchbook location in File/Preferencesto the path of your UI project (the parent foder of this INO file)*/
#if LV_USE_LOG != 0
/* Serial debugging */
void my_print(const char *buf) {
Serial.printf(buf);
Serial.flush();
}
#endif
byte macAddress[6];
WiFiServer server(80);
static Placeholder<OneWireNg_CurrentPlatform> ow;
DS18B20Manager sensorManager(ow);
/*Change to your screen resolution*/
static const uint16_t screenWidth = 480;
static const uint16_t screenHeight = 320;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[screenWidth * screenHeight / 10];
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 260);
/* Display flushing */
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p) {
uint32_t w = (area->x2 - area->x1 + 1);
uint32_t h = (area->y2 - area->y1 + 1);
tft.startWrite();
tft.setAddrWindow(area->x1, area->y1, w, h);
tft.pushColors((uint16_t *)&color_p->full, w * h, true);
tft.endWrite();
lv_disp_flush_ready(disp);
}
/*Read the touchpad*/
void my_touchpad_read(lv_indev_drv_t *indev_driver, lv_indev_data_t *data) {
uint16_t touchX = 0, touchY = 0;
//bool touched = false;//tft.getTouch( &touchX, &touchY, 600 );
TSPoint p = ts.getPoint();
bool touched = !(p.z < MINPRESSURE || p.z > MAXPRESSURE);
touchX = map(p.y, TS_MAXX, TS_MINX, 0, screenWidth - 1);
touchY = map(p.x, TS_MINY, TS_MAXY, 0, screenHeight - 1);
if (!touched) {
data->state = LV_INDEV_STATE_REL;
} else {
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = touchX;
data->point.y = touchY;
}
}
void setup() {
debugPrint dp("setup");
pinMode(buzzerPin, OUTPUT);
Serial.begin(115200); /* prepare for possible serial debug */
while (!Serial)
;
if (!sd.begin(chipSelectCard, SD_SCK_MHZ(20))) {
dp.p("Card failed, or not present");
cardStatus = false;
// don't do anything more:
} else {
dp.p("SD card initialized.");
cardStatus = true;
}
new (&ow) OneWireNg_CurrentPlatform(OW_PIN, false);
sensorManager.begin(sd);
sensorManager.populateFromSD();
sensorManagerPtr = &sensorManager;
#ifdef COMMON_RES
/*
* Set common resolution for all sensors.
* Th, Tl (high/low alarm triggers) are set to 0.
*/
drv.writeScratchpadAll(0, 0, COMMON_RES);
/*
* The configuration above is stored in volatile sensors scratchpad
* memory and will be lost after power unplug. Therefore store the
* configuration permanently in sensors EEPROM.
*/
drv.copyScratchpadAll(PARASITE_POWER_ARG);
#endif
String LVGL_Arduino = "LVGL Version ";
LVGL_Arduino += String("V") + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
dp.p(LVGL_Arduino);
// check for the WiFi module:
if (WiFi.status() == WL_NO_MODULE) {
dp.p("Communication with WiFi module failed!");
wifiDown = true;
} else {
wifiDown = false;
WiFi.macAddress(macAddress);
dp.p("Mac Address: ", false);
printMacAddress(macAddress);
String fv = WiFi.firmwareVersion();
if (fv < WIFI_FIRMWARE_LATEST_VERSION) {
dp.p("Please upgrade the firmware");
}
}
dp.p("Setting up time: RTC ", false);
Wire.begin();
if (!rtc.begin()) {
dp.p("Couldn't find RTC");
} else {
dp.p("RTC initialised");
}
sensor.begin(Bme280TwoWireAddress::Primary);
sensor.setSettings(Bme280Settings::indoor());
auto temperature = String(sensor.getTemperature());
dp.p("temp: ", temperature);
if (setupWifi()) {
delay(100);
adjustForBST();
dp.p("NTP: ", false);
displayNTPTime();
dp.p("RTC: ", false);
displayDateTime();
if (checkDrift()) {
dp.p("We have clock drift - adjusting ...");
updateTimeFromNTPtoRTC();
}
} else {
dp.p("can't connect to wifi yet, so not checking drift with NPT");
}
lv_init();
#if LV_USE_LOG != 0
lv_log_register_print_cb(my_print); /* register print function for debugging */
#endif
tft.begin(); /* TFT init */
tft.setRotation(3); /* Landscape orientation, flipped */
lv_disp_draw_buf_init(&draw_buf, buf, NULL, screenWidth * screenHeight / 10);
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register(&disp_drv);
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register(&indev_drv);
ui_init();
Serial.println("Setup done");
}
void loop() {
lv_timer_handler(); /* let the GUI do its work */
delay(5);
}