Just defining a function can render another function useless?

Once again I encountered a strange problem, which makes no sense for me.
In the Setup-Routine I'm calling a function which checks a database if its available. No problems with that.
But now I've defined a new function and without actually calling it anywhere, the ckeck-db-function hangs on startup (No compilation error). I've debugged the new function to that point:

Serial.print("...");

If that line is commented out, everything works fine.
Just a reminder: The new function was only defined, not even called anywhere (It is supposed to be called before check-db). How can that be?

How can that be?

Without seeing your code, I'm going to guess that you are running out of memory.

POST YOUR CODE!

Running out of SRAM was my first guess, too.

I've debugged the new function to that point:
Code: [Select]

Serial.print("...");

Didn't you mean Serial.print(F("...")); ?

But now I've defined a new function and without actually calling it anywhere ...

Why did you define a function without calling it? Wasn't that a waste of time?

I've waited for that question :grinning:
Sure I had called the function. But when the sketch didn't work any longer I removed the reference. It still didn't work so I removed the definition too - that finally did it.

POST YOUR CODE!

I will. But I'm currently not at my PC...

Here is the code. It might be a little unstructured but I'm not finished yet...
I'm getting more and more sure that it's really getting out of memory. It must be the EEPROM-crc check.

zks.zip (5.06 KB)

I'm getting more and more sure that it's really getting out of memory.

10 lines into the code, and I am positive:

String myHost, myUser, myDB, myPass;

//Python Einstellungen
const String pyPath = "/usr/bin/python";
const String pyScript = "/skripte/sqlexec.py";

//USB-Device
const String usbDevice = "/dev/input/event1";
const String deviceID = "05f9:2206";
const String usbHub = "058f:6254";

There REALLY is no reason to piss away memory like that. char * will work just as well.

void DisplayText(String Line1, String Line2)

This function REALLY does not need to take Strings.

There should be a means of displaying data that can accommodate the use of the F() macro, so that you can do:
DisplayText(F("Bitte Konfigu-"), F("ration pr\365fen."));

 DisplayText(F("Bitte Konfigu-"    "ration pr\365fen."));

Oh nooooo! Shame on me :-[
That happens when you do your daily business with Visual Basic and C# - No thoughts about limited resources...
Ok I will revise my code with priority on memory usage. Thank you guys :slight_smile:

It happens to everyone that moves from PCs with 1 GB of RAM, to get a shock to find they have 2 KB of it.