Open SvarunSoda opened 1 year ago
@SvarunSoda Hi Direct ssd1306 API functions are trade-off of code complexity, speed and flash ram usage. This is described in the documentation:
* Prints text to screen using fixed font.
* @param xpos - horizontal position in pixels
* @param y - vertical position in pixels
* @param ch - NULL-terminated string to print
* @param style - font style (EFontStyle), normal by default.
* @returns number of chars in string
* @see ssd1306_setFixedFont
* @warning ssd1306_printFixed() can output chars at fixed y positions: 0, 8, 16, 24, 32, etc.
* If you specify [10,18], ssd1306_printFixed() will output text starting at [10,16] position.
* @warning Be careful with you flash space! Do not mix too many different functions in single sketch.
* ssd1306_printFixedN() uses much flash: ~396 bytes, ssd1306_printFixed() needs 388 bytes.
* Placing both of these functions to your sketch will consume almost 1KiB.
To get expected results, please use NanoCanvas
. The way to use NanoCanvas
is demostrated in ssd1306_demo example.
I'm attempting to print several rows of text, at certain Y-values, on an SSD1306 128x64 LCD display. I'm doing this using the Arduino IDE, with
ssd1306
by Alexy Dunda, which is supposedly this library (it links here from the Arduino IDE Library Manager).I initially wanted to use the more common LCD libraries out there, such as the Adafruit SSD1306 LCD library, however it unfortunately does not appear I can set custom I2C pins for most such libraries out there, which is required as I'm using a custom board with an ESP32-WROOM-DA chip. Hence, I opted for using this library.
I have the following example code, which prints 6 lines of text:
With which I wish to print out 6 lines of text, each line evenly vertically spaced out by 10 pixels.
Which produces the following output on my LCD:
As you can see, the text rows are not evenly vertically spaced out as I wish them to be, with a large space between the
TEST 4
andTEST 5
strings.After looking at the definition of the
ssd1306_printFixed
function I'm using to print out my text in the example above, it turns out that it can only print rows of text at certain fixed Y-positions:Hence, I also tried using the
ssd1306_print
function (which uses a cursor to delineate it's printing location on the screen), which doesn't have that warning in it's header declaration. I replaced myLCDTextDraw
function with:However, that still produced the exact same output on my LCD, with the same spacing issues.
What is the proper way to print text rows at any Y-value on an SSD1306 LCD with this library?
Thanks for reading my post, any guidance is appreciated.