Text disappearing after using progmem F() macro

Hi,

as I ran into into memory problems (only 76% left) I decided to use some progmem. I used the F() macro everywhere possible.

After a reboot everything seems to work fine, but after working on the arduino for some time, texts start disappearing) I see the same behaviour every time on the same words.

I uploaded 3 pictures for better understanding(i added links - they are too big sorry)

not working - startscreen
not working PowerScreen

working PowerScreen

Here is the full code:
https://github.com/NatroNx/Aquaduino2_full

while most of the "drawing on the lcd" with the f() macro happens in the _2Draw.ino

The first word, that dissapears can be found in lin 187 of _2Draw.ino

 updateHomeScreen();

  myGLCD.setColor(255, 255, 255);
  // lightmode
  myFiles.load(LightUp[0], LightUp[1], 48, 48, "48up.raw");
  myFiles.load(LightDown[0], LightDown[1], 48, 48, "48down.raw");
  //myFiles.load(90, 85, 120, 102, "1therm.raw");
  //draw the fertilizer
  myGLCD.drawLine(30, 570, 450, 570); //3rd line
    myFiles.load(21, 615, 438, 96, "DockNew.raw");
  myGLCD.setFont(BigFont);
  myGLCD.print(F("Home"), 37, 720);
  myGLCD.print(F("Feed"), 149, 720);
  myGLCD.print(F("Power"), 256, 720);
  myGLCD.print(F("Setting"), 357, 720);  //that line disappears



  //footer starts here
  myGLCD.setColor(col_white.r, col_white.g, col_white.b);
  myGLCD.drawLine(30, 770, 196, 770);
  myGLCD.drawLine(284, 770, 450, 770);
    myFiles.load(216, 746, 48, 48, "ResetF.raw");



}

Any ideas?

Have you actually done an A/B test? Where you try the exact same code, with only one line changed?

ok I reverted back to "normal" code. Only changing a few lines to F() - no problems with those lines so far. Did some more changes.

Whole Powerscreen (about 15 String), HomeScreen (4 Strings) and some more. Saved about 250bytes.

So far I did not notice any troubles.

after working on the arduino for some time, texts start disappearing

Maybe get rid of the String class. You may have heap fragmentation.

  if (Aquaduino)

{ Aquaduino.println("Initialisation complete - Aquaduino up and running");
    Aquaduino.println("Date;Time;Temperature;PH;PWM;pump2Value;light230Value;light1Value=true;light2Value;co2Value;heaterValue;dPump1Value;dPump2Value;dPump3Value;coolValue;");
    Aquaduino.close();
  }

If you are worried about RAM, why not use the F() macro there too? eg.

  if (Aquaduino)
  { Aquaduino.println(F("Initialisation complete - Aquaduino up and running"));
    Aquaduino.println(F("Date;Time;Temperature;PH;PWM;pump2Value;light230Value;light1Value=true;light2Value;co2Value;heaterValue;dPump1Value;dPump2Value;dPump3Value;coolValue;"));
    Aquaduino.close();
  }

hi guys and thanks for your replies.

What I did is to test where the problem occurs. I uploaded code about 50 times. :slight_smile: Every time with some more f() and the problem didn't occur. Ok I'm still not using the great f() for every string, but I saved already a ton of space... space for new ideas.

My fish tank has now internet access! :smiley: Websockets and ESP8266 are great. :slight_smile:

@ Nick: GREAT find. That long string will save a ton of space.