graph stuff working - DEBUG WRITES EVERY 3 SECONDS NOW

This commit is contained in:
DeltaLima 2025-04-11 00:46:03 +02:00
parent 76bcc36a2f
commit 0c5dda9ac2
3 changed files with 23 additions and 8 deletions

View file

@ -522,7 +522,7 @@ char* Char_Timestamp_yyyymmdd(const unsigned long timestamp) {
char tmp_month[3];
char tmp_day[3];
char tmp_minute[3];
static char tmp_timestamp[12];
if(month(timestamp) < 10) {
@ -537,14 +537,20 @@ char* Char_Timestamp_yyyymmdd(const unsigned long timestamp) {
snprintf(tmp_day, sizeof(tmp_day), "%d", day(timestamp));
}
//if(minute(timestamp) < 10) {
//snprintf(tmp_minute, sizeof(tmp_minute), "0%d", minute(timestamp));
//} else {
//snprintf(tmp_minute, sizeof(tmp_minute), "%d", minute(timestamp));
//}
snprintf(tmp_timestamp, sizeof(tmp_timestamp), "%d%s%s", year(), tmp_month, tmp_day);
#if defined(DEBUG)
char tmp_minute[3];
if(minute(timestamp) < 10) {
snprintf(tmp_minute, sizeof(tmp_minute), "0%d", minute(timestamp));
} else {
snprintf(tmp_minute, sizeof(tmp_minute), "%d", minute(timestamp));
}
#endif
#if defined(DEBUG)
snprintf(tmp_timestamp, sizeof(tmp_timestamp), "%d%s%s%s", year(), tmp_month, tmp_day, tmp_minute);
#else
snprintf(tmp_timestamp, sizeof(tmp_timestamp), "%d%s%s", year(), tmp_month, tmp_day;
#endif
return tmp_timestamp;
}

View file

@ -811,7 +811,11 @@ void LFS_Chart_Rotate_Data(const byte chartId) {
/* timestamp of the oldest file allowed. Anything older gets deleted. convert to unsigned long */
#if defined(DEBUG)
unsigned long timestampOldest = strtoul(Char_Timestamp_yyyymmdd(now() - (5 * Timescale(TIMESCALE_MINUTE))), NULL, 0);
#else
unsigned long timestampOldest = strtoul(Char_Timestamp_yyyymmdd(now() - (5 * Timescale(TIMESCALE_DAY))), NULL, 0);
#endif
char chartDirPath[10];
snprintf(chartDirPath, sizeof(chartDirPath), "%s%d", CHART_BASE_PATH, chartId);

View file

@ -63,6 +63,11 @@ void TimeR_Init() {
timer.setInterval(1000, Timer_Output);
timer.setInterval(1000, Timer_Sensor);
timer.setInterval(100, Timer_Control);
#if defined(DEBUG)
timer.setInterval(3*1000, Timer_3s);
#else
timer.setInterval(15*60*1000, Timer_3s);
#endif
}