Avoid line wrap in i2c SSD1306

I'm trying to make a scrollable text in a SSD1306, because my display is small.

Auto scroll is not usable for my scope because I would need a virtual bigger display but i read that pixels are directly mapped to a ram in the driver.

I tried to implement it using setCursor and for cycles but I can't reach my goal because print and println have an automatic line wrap when the cursor reach the end of the line.

My goal is that when I use

display.print(F("This is a very long sentence in a small screen"));

I only see
"This is a ve"

and not
"This is a ve
ry long sen
tence in a
small screen"

Is it possible?

From Adafruit_GFX.h

  /*!
  @brief  Set whether text that is too long for the screen width should
          automatically wrap around to the next line (else clip right).
  @param  w  true for wrapping, false for clipping
  */
  /**********************************************************************/
  void setTextWrap(bool w) { wrap = w; }

Untested on a SSD1306.

You would normally try to get whole words onto a line. i.e. you don't want to break half-way through a word.

Seriously. You would choose the best short words for a tiny display. Or choose a bigger display in the first place.

David.

If that is your goal then don't print the whole string at once. Instead, print it one character at a time. This will give you control as to how many characters you print allowing you to stop at any time you want

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.