Thanks for the hint, but it freezes with that code too...
i do think it´s the code itself - anywhere else... i do change a bit of code anywhere and it gets freezed. At nearly 1000 lines of code, do you have any tip where to search first?
void LoggingValues() // check if values have to be written to history
{
DateTime now = RTC.now();
int LastTimeSavedVal= 0; // now.hour() of last time logging
int PoolTempSavePosVal = 0; // containing save position of ring logging buffer (value 0 to 8 = 9 values for logging - then reset)
int iTempVal;
unsigned int MinAddr = 0; // calc memory position for writing actual Timestamp
LastTimeSavedVal = EEPROM.read(LastTimeSaved);
PoolTempSavePosVal = EEPROM.read(PoolTempSavePos);
MinAddr = EEPROM_MIN_ADDR + PoolTempSavePosVal*BytesPerTempVal;
for (iTempVal = 0; iTempVal < ValuesToLog; iTempVal++)
{
if (now.hour() >= (WakeUpTime + iTempVal*ValueLoggingIntervall) && LastTimeSavedVal < (WakeUpTime + iTempVal*ValueLoggingIntervall)) //calc if value has to be stored
{
getMedianTemps(); // reading temps from DS1820
dtostrf(PoolTemp, 4, 1, TempBuf); // convert float temperature for character operations
PoolTempSavePosVal++;
if (PoolTempSavePosVal > 8) // ring buffer reset
{
PoolTempSavePosVal = 0;
//Serial.println("PoolTempSavePos Reset");
}
char myBuffer1[11];
sprintf(myBuffer1,"%02i/%02i %4s", now.day(), now.month(), TempBuf);
//Serial.println(myBuffer1);
char myBuffer2[7];
sprintf(myBuffer2," %02i:%02i", now.hour(), now.minute());
//Serial.println(myBuffer2);
StringTemp = String(myBuffer1) + String(myBuffer2);
StringTemp.toCharArray(TempChar, 18);
Serial.print("DEBUG WERT: ");
Serial.println(TempChar);
...
Strings are bad, and + is a very expensive operator on Strings.
And I don't see the definition of TempChar...
What about just throwing that part away?
If you use it just for the Serial.println, either use the commented println's above instead, or setup your debug message in one sprintf() into a char array of sufficient size directly...
I am open of throwing it away
What i do want to get is a string / char array like:
06/01 12:00 26.4
which i could write to flash. (for example 3 times a day).
That + operation was trying a workaround because of the freezing when putting together all in one char array / a string. I will put it together char by char in one char array as u mentioned.