This is the code that produces the error. It's identical to the one I posted before, except at the beginning of void.loop() this line has only one *.
lv_obj_t *ui_Arc_pointer;
The error is the same with the * adjacent to the t, to the u, or beween spaces.
Sorry I haven't found out a way to paste code with line numbers
/*******************************************************************************
* LVGL Hello World
* This is a simple example for LVGL - Light and Versatile Graphics Library
* import from: https://github.com/lvgl/lv_demos.git
*
* Dependent libraries:
* LVGL: https://github.com/lvgl/lvgl.git
*
* LVGL Configuration file:
* Copy your_arduino_path/libraries/lvgl/lv_conf_template.h
* to your_arduino_path/libraries/lv_conf.h
*
* In lv_conf.h around line 15, enable config file:
* #if 1 // Set it to "1" to enable content
*
* Then find and set:
* #define LV_COLOR_DEPTH 16
* #define LV_TICK_CUSTOM 1
*
* For SPI/parallel 8 display set color swap can be faster, parallel 16/RGB screen don't swap!
* #define LV_COLOR_16_SWAP 1 // for SPI and parallel 8
* #define LV_COLOR_16_SWAP 0 // for parallel 16 and RGB
******************************************************************************/
#include <lvgl.h>
#include "ui.h"
#include <Wire.h> // AGGIUNTO
#include "pcf8563.h" // AGGIUNTO
PCF8563_Class rtc; // AGGIUNTO
#include <Arduino_GFX_Library.h>
#define GFX_BL 21 // default backlight pin, you may replace DF_GFX_BL to actual backlight pin
/* More dev device declaration: https://github.com/moononournation/Arduino_GFX/wiki/Dev-Device-Declaration */
#if defined(DISPLAY_DEV_KIT)
Arduino_GFX *gfx = create_default_Arduino_GFX();
#else /* !defined(DISPLAY_DEV_KIT) */
/* More data bus class: https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class */
Arduino_DataBus *bus = new Arduino_ESP32SPI(19 /* DC */, 15 /* CS */, 14 /* SCK */, 13 /* MOSI */, GFX_NOT_DEFINED /* MISO */);
/* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */
Arduino_GFX *gfx = new Arduino_GC9A01(bus, 27 /* RST */, 0 /* rotation */, true /* IPS */);
#endif /* !defined(DISPLAY_DEV_KIT) */
/*******************************************************************************
* End of Arduino_GFX setting
******************************************************************************/
/* Change to your screen resolution */
static uint32_t screenWidth;
static uint32_t screenHeight;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t *disp_draw_buf;
static lv_disp_drv_t disp_drv;
/* 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);
#if (LV_COLOR_16_SWAP != 0)
gfx->draw16bitBeRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h);
#else
gfx->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h);
#endif
lv_disp_flush_ready(disp);
}
long go_buzz_1; // AGGIUNTO
long end_buzz_1; // AGGIUNTO
long go_buzz_2; // AGGIUNTO
long end_buzz_2; // AGGIUNTO
long go_buzz_3; // AGGIUNTO
long end_buzz_3; // AGGIUNTO
long go_buzz_4; // AGGIUNTO
long end_buzz_4; // AGGIUNTO
long delta; // AGGIUNTO
long start_time; // AGGIUNTO
long timer; // AGGIUNTO
// convert time in seconds
int32_t secondsFromHoursMinutes(const char* from) {
return (atoi(from) * 60L + atoi(from + 3)) * 60;
}
void setup()
{
Serial.begin(115200);
#ifdef GFX_EXTRA_PRE_INIT
GFX_EXTRA_PRE_INIT();
#endif
// Init Display
if (!gfx->begin())
{
Serial.println("gfx->begin() failed!");
}
gfx->fillScreen(BLACK);
#ifdef GFX_BL
pinMode(GFX_BL, OUTPUT);
digitalWrite(GFX_BL, HIGH);
#endif
lv_init();
screenWidth = gfx->width();
screenHeight = gfx->height();
#ifdef ESP32
disp_draw_buf = (lv_color_t *)heap_caps_malloc(sizeof(lv_color_t) * screenWidth * 40, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
#else
disp_draw_buf = (lv_color_t *)malloc(sizeof(lv_color_t) * screenWidth * 40);
#endif
if (!disp_draw_buf)
{
Serial.println("LVGL disp_draw_buf allocate failed!");
}
else
{
lv_disp_draw_buf_init(&draw_buf, disp_draw_buf, NULL, screenWidth * 40);
/* Initialize the display */
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;
lv_indev_drv_register(&indev_drv);
}
/* initialize Squareline Studio UI */
ui_init();
Serial.println("Setup done");
/* INITIALIZE RTC */
Wire.begin(26, 25);
rtc.begin();
// rtc.setDateTime(2023, 8, 16, 02, 49, 00); // commented out to hold time
/* SETTA IL PIN DEL MOTORE COME OUTPUT e btn2 come input */
pinMode(4, OUTPUT);
pinMode(35, INPUT_PULLUP);
/* SETTA RANDOM TIMER */
randomSeed(analogRead(17)); // DA PINOUT IL 17 SEMBRA NON USATO
go_buzz_1 = random(1000, 801000);
end_buzz_1 = go_buzz_1 + 2000;
go_buzz_2 = go_buzz_1 + 4000;
end_buzz_2 = go_buzz_1 + 6000;
go_buzz_3 = go_buzz_1 + 4000;
end_buzz_3 = go_buzz_1 + 4300;
go_buzz_4 = go_buzz_1 + 6000;
end_buzz_4 = go_buzz_1 + 6300;
delta = 900000 - (end_buzz_4 + 90000);
start_time = millis(); // definisce start time come il tempo attuale
Serial.println(go_buzz_1);
Serial.println(end_buzz_1);
Serial.println(go_buzz_2);
Serial.println(end_buzz_2);
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay(5);
Serial.println(rtc.formatDateTime(PCF_TIMEFORMAT_YYYY_MM_DD_H_M_S));
delay(1000);
lv_label_set_text(ui_Label14, rtc.formatDateTime(PCF_TIMEFORMAT_HM));
/* POINTER TO LVGL ARC WIDGET */
lv_obj_t *ui_Arc_pointer;
int32_t time_seconds = secondsFromHoursMinutes(rtc.formatDateTime(PCF_TIMEFORMAT_HM));
Serial.println("prove:");
Serial.println(rtc.formatDateTime(PCF_TIMEFORMAT_HM));
Serial.println(atoi(rtc.formatDateTime(PCF_TIMEFORMAT_HM))); // TO CHECK TIME CONVERSION TO SEC
Serial.println(atoi(rtc.formatDateTime(PCF_TIMEFORMAT_HM + 3))); // TO CHECK TIME CONVERSION TO SEC
Serial.println(time_seconds); // TO CHECK TIME CONVERSION TO SEC
if (time_seconds >= 12*60*60) time_seconds = (time_seconds-12*60*60); // convert time to 12h
if (time_seconds >= 0 && time_seconds < 15*60) ui_Arc_pointer=&ui_Arc2; // store ui_Arc2 address into pointer
else if (time_seconds >= 15*60 && time_seconds < 30*60) ui_Arc_pointer=&ui_Arc1;
else if (time_seconds >= 30*60 && time_seconds < 45*60) ui_Arc_pointer=&ui_Arc3;
else if (time_seconds >= 45*60 && time_seconds < 60*60) ui_Arc_pointer=&ui_Arc4;
else if (time_seconds >= 60*60 && time_seconds < 75*60) ui_Arc_pointer=&ui_Arc5;
else if (time_seconds >= 75*60 && time_seconds < 90*60) ui_Arc_pointer=&ui_Arc6;
else if (time_seconds >= 90*60 && time_seconds < 105*60) ui_Arc_pointer=&ui_Arc7;
else if (time_seconds >= 105*60 && time_seconds < 120*60) ui_Arc_pointer=&ui_Arc8;
else if (time_seconds >= 120*60 && time_seconds < 135*60) ui_Arc_pointer=&ui_Arc9;
else if (time_seconds >= 135*60 && time_seconds < 150*60) ui_Arc_pointer=&ui_Arc10;
else if (time_seconds >= 150*60 && time_seconds < 165*60) ui_Arc_pointer=&ui_Arc11;
else if (time_seconds >= 165*60 && time_seconds < 180*60) ui_Arc_pointer=&ui_Arc12;
else if (time_seconds >= 180*60 && time_seconds < 195*60) ui_Arc_pointer=&ui_Arc13;
else if (time_seconds >= 195*60 && time_seconds < 210*60) ui_Arc_pointer=&ui_Arc14;
else if (time_seconds >= 210*60 && time_seconds < 225*60) ui_Arc_pointer=&ui_Arc15;
else if (time_seconds >= 225*60 && time_seconds < 240*60) ui_Arc_pointer=&ui_Arc16;
else if (time_seconds >= 240*60 && time_seconds < 255*60) ui_Arc_pointer=&ui_Arc17;
else if (time_seconds >= 255*60 && time_seconds < 270*60) ui_Arc_pointer=&ui_Arc18;
else if (time_seconds >= 270*60 && time_seconds < 285*60) ui_Arc_pointer=&ui_Arc19;
else if (time_seconds >= 285*60 && time_seconds < 300*60) ui_Arc_pointer=&ui_Arc20;
else if (time_seconds >= 300*60 && time_seconds < 315*60) ui_Arc_pointer=&ui_Arc21;
else if (time_seconds >= 315*60 && time_seconds < 330*60) ui_Arc_pointer=&ui_Arc22;
else if (time_seconds >= 330*60 && time_seconds < 345*60) ui_Arc_pointer=&ui_Arc23;
else if (time_seconds >= 345*60 && time_seconds < 360*60) ui_Arc_pointer=&ui_Arc24;
else if (time_seconds >= 360*60 && time_seconds < 375*60) ui_Arc_pointer=&ui_Arc25;
else if (time_seconds >= 375*60 && time_seconds < 390*60) ui_Arc_pointer=&ui_Arc26;
else if (time_seconds >= 390*60 && time_seconds < 405*60) ui_Arc_pointer=&ui_Arc27;
else if (time_seconds >= 390*60 && time_seconds < 405*60) ui_Arc_pointer=&ui_Arc27;
else if (time_seconds >= 405*60 && time_seconds < 420*60) ui_Arc_pointer=&ui_Arc28;
else if (time_seconds >= 420*60 && time_seconds < 435*60) ui_Arc_pointer=&ui_Arc29;
else if (time_seconds >= 435*60 && time_seconds < 450*60) ui_Arc_pointer=&ui_Arc30;
else if (time_seconds >= 450*60 && time_seconds < 465*60) ui_Arc_pointer=&ui_Arc31;
else if (time_seconds >= 465*60 && time_seconds < 480*60) ui_Arc_pointer=&ui_Arc32;
else if (time_seconds >= 480*60 && time_seconds < 495*60) ui_Arc_pointer=&ui_Arc33;
else if (time_seconds >= 495*60 && time_seconds < 510*60) ui_Arc_pointer=&ui_Arc34;
else if (time_seconds >= 510*60 && time_seconds < 525*60) ui_Arc_pointer=&ui_Arc35;
else if (time_seconds >= 525*60 && time_seconds < 540*60) ui_Arc_pointer=&ui_Arc36;
else if (time_seconds >= 540*60 && time_seconds < 555*60) ui_Arc_pointer=&ui_Arc37;
else if (time_seconds >= 555*60 && time_seconds < 570*60) ui_Arc_pointer=&ui_Arc38;
else if (time_seconds >= 570*60 && time_seconds < 585*60) ui_Arc_pointer=&ui_Arc39;
else if (time_seconds >= 585*60 && time_seconds < 600*60) ui_Arc_pointer=&ui_Arc40;
else if (time_seconds >= 600*60 && time_seconds < 615*60) ui_Arc_pointer=&ui_Arc41;
else if (time_seconds >= 615*60 && time_seconds < 630*60) ui_Arc_pointer=&ui_Arc42;
else if (time_seconds >= 630*60 && time_seconds < 645*60) ui_Arc_pointer=&ui_Arc43;
else if (time_seconds >= 645*60 && time_seconds < 660*60) ui_Arc_pointer=&ui_Arc44;
else if (time_seconds >= 660*60 && time_seconds < 675*60) ui_Arc_pointer=&ui_Arc45;
else if (time_seconds >= 675*60 && time_seconds < 690*60) ui_Arc_pointer=&ui_Arc46;
else if (time_seconds >= 690*60 && time_seconds < 705*60) ui_Arc_pointer=&ui_Arc47;
else if (time_seconds >= 705*60 && time_seconds < 720*60) ui_Arc_pointer=&ui_Arc48;
timer = millis() - start_time;
if (timer >= go_buzz_1 && timer < end_buzz_1)
{
digitalWrite(4, HIGH);
Serial.println("buzz on 1");
}
else if (timer >= end_buzz_1 && timer < go_buzz_2)
{
digitalWrite(4, LOW);
Serial.println("buzz off 1");
}
else if (timer >= go_buzz_2 && timer < end_buzz_2)
{
digitalWrite(4, HIGH);
Serial.println("buzz on 2");
}
else if (timer >= end_buzz_2 && timer < end_buzz_2 + 90000)
{
digitalWrite(4, LOW);
Serial.println("buzz off 2");
if (digitalRead(35) == LOW) // if button pressed once set the arc color to green (still need to add the case of button pressed twice)
{
lv_obj_set_style_arc_color(*ui_Arc_pointer, lv_color_hex(0x40FF4B), LV_PART_MAIN);
}
}
else if (timer >= 900000) // after 15 minutes reset and restart
{
start_time = millis();
go_buzz_1 = random(1000, 801000);
end_buzz_1 = go_buzz_1 + 2000;
go_buzz_2 = go_buzz_1 + 4000;
end_buzz_2 = go_buzz_1 + 6000;
Serial.println(go_buzz_1);
Serial.println(end_buzz_1);
Serial.println(go_buzz_2);
Serial.println(end_buzz_2);
}
}