The project is a Google photo clock and is supposed to be a slightlymodified version of this. for now ive disabled wdt and ntp protocol to diagnose the issue. using a esp32devkit v1 board and ili9341 display and isnt initializing file system. tried different programs to check if there was a fault with esp32 but no errors with read or write. This is the code
<code>/*******************************************************************************
* Google Photo Clock
* This is a simple IoT photo frame sample
******************************************************************************/
/* WiFi settings */
#define SSID_NAME "______"
#define SSID_PASSWORD "___________"
/* Google Photo settings */
#define PHOTO_LIMIT 20 // read first 10 photos to the list, ESP32 can add more
#define PHOTO_ID_SIZE 159 // the photo ID should be 158 charaters long and then add a zero-tail
/* NTP settings */
#if defined(ESP32)
#define GMT_OFFSET_SEC 19800L // Timezone +5.5 India
#define DAYLIGHT_OFFSET_SEC 0L // no daylight saving
#endif
/*******************************************************************************
* Start of Arduino_GFX setting
******************************************************************************/
#include <Arduino_GFX_Library.h>
#define TFT_RST 33
#define TFT_BL 22
/* 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 = create_default_Arduino_DataBus();
/* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */
Arduino_GFX *gfx = new Arduino_ILI9341(bus, TFT_RST, 0 /* rotation */, false /* IPS */);
#endif /* !defined(DISPLAY_DEV_KIT) */
/*******************************************************************************
* End of Arduino_GFX setting
******************************************************************************/
/* file system */
#if defined(ESP32)
#include <FFat.h>
// #include <LittleFS.h>
#elif defined(ESP32)
#include <LittleFS.h>
#endif
/* time library */
#include <time.h>
static time_t now;
/* variables */
static int w, h, timeX, timeY, photoCount;
static uint8_t textSize;
static unsigned long next_show_millis = 0;
static bool shownPhoto = false;
void ntpGetTime()
{
// Initialize NTP settings
#if defined(ESP32)
configTime(GMT_OFFSET_SEC, DAYLIGHT_OFFSET_SEC, NTP_SERVER);
#endif
gfx->setTextColor(GREEN);
gfx->print(F("Waiting for NTP time sync: "));
Serial.print(F("Waiting for NTP time sync: "));
time_t nowSecs = time(nullptr);
while (nowSecs < 8 * 3600 * 2)
{
delay(500);
Serial.print('.');
gfx->print('.');
yield();
nowSecs = time(nullptr);
}
gfx->println(F(" done."));
Serial.println(F(" done."));
gfx->setTextColor(BLUE);
gfx->println(asctime(localtime(&nowSecs)));
Serial.println(asctime(localtime(&nowSecs)));
}
void printTime()
{
now = time(nullptr);
const tm *tm = localtime(&now);
int hour = tm->tm_hour;
int min = tm->tm_min;
// set text size with pixel margin
gfx->setTextSize(textSize, textSize, 2);
if (!shownPhoto)
{
// print time with black background
gfx->setCursor(timeX, timeY);
gfx->setTextColor(WHITE, BLACK);
gfx->printf("%02d:%02d", hour, min);
}
else
{
// print time with border
gfx->setCursor(timeX - 1, timeY - 1);
gfx->setTextColor(DARKGREY);
gfx->printf("%02d:%02d", hour, min);
gfx->setCursor(timeX + 2, timeY + 2);
gfx->setTextColor(BLACK);
gfx->printf("%02d:%02d", hour, min);
gfx->setCursor(timeX, timeY);
gfx->setTextColor(WHITE);
gfx->printf("%02d:%02d", hour, min);
}
}
void setup()
{
Serial.begin(115200);
// init display
gfx->begin();
gfx->fillScreen(BLACK);
#ifdef TFT_BL
// turn on display backlight
pinMode(TFT_BL, OUTPUT);
digitalWrite(TFT_BL, HIGH);
#endif
w = gfx->width();
h = gfx->height();
textSize = w / 6 / 5;
timeX = (w - (textSize * 5 * 6)) / 2;
timeY = h - (textSize * 8) - 10;
gfx->setTextSize(1);
gfx->setCursor(0, 0);
gfx->setTextColor(RED);
gfx->println(F("Google Photo Clock"));
Serial.println(F("Google Photo Clock"));
gfx->setTextColor(ORANGE);
gfx->print(F("Screen: "));
Serial.print(F("Screen: "));
gfx->print(w);
Serial.print(w);
gfx->print('x');
Serial.print('x');
gfx->println(h);
Serial.println(h);
gfx->setTextColor(YELLOW);
gfx->print(F("Clock text size: "));
Serial.print(F("Clock text size: "));
gfx->println(textSize);
Serial.println(textSize);
// init file system
#if defined(ESP32)
if (!FFat.begin(true))
// if (!LittleFS.begin())
#elif defined(ESP32)
if (!LittleFS.begin())
#endif
{
gfx->print(F("File system init failed!"));
Serial.print(F("File system init failed!"));
}
else
{
gfx->print(F("File system init success."));
Serial.print(F("File system init success."));
}
// init time
ntpGetTime();
// print time on black screen before down load image
printTime();
}
void loop()
{
delay(1000);
// overlay current time on the photo
printTime();
}
</code>
<code>/*******************************************************************************
* Google Photo Clock
* This is a simple IoT photo frame sample
******************************************************************************/
/* WiFi settings */
#define SSID_NAME "______"
#define SSID_PASSWORD "___________"
/* Google Photo settings */
#define PHOTO_LIMIT 20 // read first 10 photos to the list, ESP32 can add more
#define PHOTO_ID_SIZE 159 // the photo ID should be 158 charaters long and then add a zero-tail
/* NTP settings */
#if defined(ESP32)
#define GMT_OFFSET_SEC 19800L // Timezone +5.5 India
#define DAYLIGHT_OFFSET_SEC 0L // no daylight saving
#endif
/*******************************************************************************
* Start of Arduino_GFX setting
******************************************************************************/
#include <Arduino_GFX_Library.h>
#define TFT_RST 33
#define TFT_BL 22
/* 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 = create_default_Arduino_DataBus();
/* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */
Arduino_GFX *gfx = new Arduino_ILI9341(bus, TFT_RST, 0 /* rotation */, false /* IPS */);
#endif /* !defined(DISPLAY_DEV_KIT) */
/*******************************************************************************
* End of Arduino_GFX setting
******************************************************************************/
/* file system */
#if defined(ESP32)
#include <FFat.h>
// #include <LittleFS.h>
#elif defined(ESP32)
#include <LittleFS.h>
#endif
/* time library */
#include <time.h>
static time_t now;
/* variables */
static int w, h, timeX, timeY, photoCount;
static uint8_t textSize;
static unsigned long next_show_millis = 0;
static bool shownPhoto = false;
void ntpGetTime()
{
// Initialize NTP settings
#if defined(ESP32)
configTime(GMT_OFFSET_SEC, DAYLIGHT_OFFSET_SEC, NTP_SERVER);
#endif
gfx->setTextColor(GREEN);
gfx->print(F("Waiting for NTP time sync: "));
Serial.print(F("Waiting for NTP time sync: "));
time_t nowSecs = time(nullptr);
while (nowSecs < 8 * 3600 * 2)
{
delay(500);
Serial.print('.');
gfx->print('.');
yield();
nowSecs = time(nullptr);
}
gfx->println(F(" done."));
Serial.println(F(" done."));
gfx->setTextColor(BLUE);
gfx->println(asctime(localtime(&nowSecs)));
Serial.println(asctime(localtime(&nowSecs)));
}
void printTime()
{
now = time(nullptr);
const tm *tm = localtime(&now);
int hour = tm->tm_hour;
int min = tm->tm_min;
// set text size with pixel margin
gfx->setTextSize(textSize, textSize, 2);
if (!shownPhoto)
{
// print time with black background
gfx->setCursor(timeX, timeY);
gfx->setTextColor(WHITE, BLACK);
gfx->printf("%02d:%02d", hour, min);
}
else
{
// print time with border
gfx->setCursor(timeX - 1, timeY - 1);
gfx->setTextColor(DARKGREY);
gfx->printf("%02d:%02d", hour, min);
gfx->setCursor(timeX + 2, timeY + 2);
gfx->setTextColor(BLACK);
gfx->printf("%02d:%02d", hour, min);
gfx->setCursor(timeX, timeY);
gfx->setTextColor(WHITE);
gfx->printf("%02d:%02d", hour, min);
}
}
void setup()
{
Serial.begin(115200);
// init display
gfx->begin();
gfx->fillScreen(BLACK);
#ifdef TFT_BL
// turn on display backlight
pinMode(TFT_BL, OUTPUT);
digitalWrite(TFT_BL, HIGH);
#endif
w = gfx->width();
h = gfx->height();
textSize = w / 6 / 5;
timeX = (w - (textSize * 5 * 6)) / 2;
timeY = h - (textSize * 8) - 10;
gfx->setTextSize(1);
gfx->setCursor(0, 0);
gfx->setTextColor(RED);
gfx->println(F("Google Photo Clock"));
Serial.println(F("Google Photo Clock"));
gfx->setTextColor(ORANGE);
gfx->print(F("Screen: "));
Serial.print(F("Screen: "));
gfx->print(w);
Serial.print(w);
gfx->print('x');
Serial.print('x');
gfx->println(h);
Serial.println(h);
gfx->setTextColor(YELLOW);
gfx->print(F("Clock text size: "));
Serial.print(F("Clock text size: "));
gfx->println(textSize);
Serial.println(textSize);
// init file system
#if defined(ESP32)
if (!FFat.begin(true))
// if (!LittleFS.begin())
#elif defined(ESP32)
if (!LittleFS.begin())
#endif
{
gfx->print(F("File system init failed!"));
Serial.print(F("File system init failed!"));
}
else
{
gfx->print(F("File system init success."));
Serial.print(F("File system init success."));
}
// init time
ntpGetTime();
// print time on black screen before down load image
printTime();
}
void loop()
{
delay(1000);
// overlay current time on the photo
printTime();
}
</code>
/*******************************************************************************
* Google Photo Clock
* This is a simple IoT photo frame sample
******************************************************************************/
/* WiFi settings */
#define SSID_NAME "______"
#define SSID_PASSWORD "___________"
/* Google Photo settings */
#define PHOTO_LIMIT 20 // read first 10 photos to the list, ESP32 can add more
#define PHOTO_ID_SIZE 159 // the photo ID should be 158 charaters long and then add a zero-tail
/* NTP settings */
#if defined(ESP32)
#define GMT_OFFSET_SEC 19800L // Timezone +5.5 India
#define DAYLIGHT_OFFSET_SEC 0L // no daylight saving
#endif
/*******************************************************************************
* Start of Arduino_GFX setting
******************************************************************************/
#include <Arduino_GFX_Library.h>
#define TFT_RST 33
#define TFT_BL 22
/* 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 = create_default_Arduino_DataBus();
/* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */
Arduino_GFX *gfx = new Arduino_ILI9341(bus, TFT_RST, 0 /* rotation */, false /* IPS */);
#endif /* !defined(DISPLAY_DEV_KIT) */
/*******************************************************************************
* End of Arduino_GFX setting
******************************************************************************/
/* file system */
#if defined(ESP32)
#include <FFat.h>
// #include <LittleFS.h>
#elif defined(ESP32)
#include <LittleFS.h>
#endif
/* time library */
#include <time.h>
static time_t now;
/* variables */
static int w, h, timeX, timeY, photoCount;
static uint8_t textSize;
static unsigned long next_show_millis = 0;
static bool shownPhoto = false;
void ntpGetTime()
{
// Initialize NTP settings
#if defined(ESP32)
configTime(GMT_OFFSET_SEC, DAYLIGHT_OFFSET_SEC, NTP_SERVER);
#endif
gfx->setTextColor(GREEN);
gfx->print(F("Waiting for NTP time sync: "));
Serial.print(F("Waiting for NTP time sync: "));
time_t nowSecs = time(nullptr);
while (nowSecs < 8 * 3600 * 2)
{
delay(500);
Serial.print('.');
gfx->print('.');
yield();
nowSecs = time(nullptr);
}
gfx->println(F(" done."));
Serial.println(F(" done."));
gfx->setTextColor(BLUE);
gfx->println(asctime(localtime(&nowSecs)));
Serial.println(asctime(localtime(&nowSecs)));
}
void printTime()
{
now = time(nullptr);
const tm *tm = localtime(&now);
int hour = tm->tm_hour;
int min = tm->tm_min;
// set text size with pixel margin
gfx->setTextSize(textSize, textSize, 2);
if (!shownPhoto)
{
// print time with black background
gfx->setCursor(timeX, timeY);
gfx->setTextColor(WHITE, BLACK);
gfx->printf("%02d:%02d", hour, min);
}
else
{
// print time with border
gfx->setCursor(timeX - 1, timeY - 1);
gfx->setTextColor(DARKGREY);
gfx->printf("%02d:%02d", hour, min);
gfx->setCursor(timeX + 2, timeY + 2);
gfx->setTextColor(BLACK);
gfx->printf("%02d:%02d", hour, min);
gfx->setCursor(timeX, timeY);
gfx->setTextColor(WHITE);
gfx->printf("%02d:%02d", hour, min);
}
}
void setup()
{
Serial.begin(115200);
// init display
gfx->begin();
gfx->fillScreen(BLACK);
#ifdef TFT_BL
// turn on display backlight
pinMode(TFT_BL, OUTPUT);
digitalWrite(TFT_BL, HIGH);
#endif
w = gfx->width();
h = gfx->height();
textSize = w / 6 / 5;
timeX = (w - (textSize * 5 * 6)) / 2;
timeY = h - (textSize * 8) - 10;
gfx->setTextSize(1);
gfx->setCursor(0, 0);
gfx->setTextColor(RED);
gfx->println(F("Google Photo Clock"));
Serial.println(F("Google Photo Clock"));
gfx->setTextColor(ORANGE);
gfx->print(F("Screen: "));
Serial.print(F("Screen: "));
gfx->print(w);
Serial.print(w);
gfx->print('x');
Serial.print('x');
gfx->println(h);
Serial.println(h);
gfx->setTextColor(YELLOW);
gfx->print(F("Clock text size: "));
Serial.print(F("Clock text size: "));
gfx->println(textSize);
Serial.println(textSize);
// init file system
#if defined(ESP32)
if (!FFat.begin(true))
// if (!LittleFS.begin())
#elif defined(ESP32)
if (!LittleFS.begin())
#endif
{
gfx->print(F("File system init failed!"));
Serial.print(F("File system init failed!"));
}
else
{
gfx->print(F("File system init success."));
Serial.print(F("File system init success."));
}
// init time
ntpGetTime();
// print time on black screen before down load image
printTime();
}
void loop()
{
delay(1000);
// overlay current time on the photo
printTime();
}
this is what i got on the serial monitor
<code>ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13864
load:0x40080400,len:3608
entry 0x400805f0
Google Photo Clock
Screen: 240x320
Clock text size: 8
Connecting to WiFi: done.
File system init failed!
</code>
<code>ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13864
load:0x40080400,len:3608
entry 0x400805f0
Google Photo Clock
Screen: 240x320
Clock text size: 8
Connecting to WiFi: done.
File system init failed!
</code>
ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13864
load:0x40080400,len:3608
entry 0x400805f0
Google Photo Clock
Screen: 240x320
Clock text size: 8
Connecting to WiFi: done.
File system init failed!
New contributor
Cheetohzzz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.