Giter Club home page Giter Club logo

Comments (6)

chauens avatar chauens commented on June 27, 2024

I need to add: the option to define SDA and SCL pins is not an issue. Just connect the OLED where Adafruit wants it. But I want to be able to use the "screen saver" which Adafruit does not seem to have.

from u8g2.

olikraus avatar olikraus commented on June 27, 2024

The reference position for the string is the lower left corner of the glyphs (baseline) as you can see in the example image here: https://github.com/olikraus/u8g2/wiki/u8g2reference#drawstr

This can be change with the font-position functions: https://github.com/olikraus/u8g2/wiki/u8g2reference#setfontpostop

Wrap around effects can be avoided by putting u8g2 into 16 bit mode (see FAQ https://github.com/olikraus/u8g2/blob/master/doc/faq.txt). 16 Bit mode is automatically activated with ESP32.

from u8g2.

chauens avatar chauens commented on June 27, 2024

from u8g2.

chauens avatar chauens commented on June 27, 2024

Using the Adafruit_SH110X.h and Adafruit_GFX.h libraries provides the solution to the problem as well as a "screen saver" as I just found out. So I wil go this route.
I leave this open for now for you to decide wether this can be fixed. I don't think I'm doing anything wrong or missed something. See my previous comment. Thank you

from u8g2.

xray-bit avatar xray-bit commented on June 27, 2024

Hi, @chauens, I got the same problem.

the default display config for sh1107_128x128 has a big x offset (check L519-520):

u8g2/csrc/u8x8_d_sh1107.c

Lines 501 to 523 in 3e86287

static const u8x8_display_info_t u8x8_sh1107_128x128_display_info =
{
/* chip_enable_level = */ 0,
/* chip_disable_level = */ 1,
/* post_chip_enable_wait_ns = */ 20,
/* pre_chip_disable_wait_ns = */ 10,
/* reset_pulse_width_ms = */ 100, /* */
/* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */
/* sda_setup_time_ns = */ 100, /* cycle time is 100ns, so use 100/2 */
/* sck_pulse_width_ns = */ 100, /* cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */
/* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */
/* spi_mode = */ 0, /* active high, rising edge */
/* i2c_bus_clock_100kHz = */ 4,
/* data_setup_time_ns = */ 40,
/* write_pulse_width_ns = */ 150, /* sh1107: cycle time is 300ns, so use 300/2 = 150 */
/* tile_width = */ 16,
/* tile_height = */ 16,
/* default_x_offset = */ 96,
/* flipmode_x_offset = */ 96,
/* pixel_width = */ 128,
/* pixel_height = */ 128
};

you can try to use pimoroni's config or seeed's config :

u8g2/csrc/u8x8_d_sh1107.c

Lines 600 to 622 in 3e86287

static const u8x8_display_info_t u8x8_sh1107_pimoroni_128x128_display_info =
{
/* chip_enable_level = */ 0,
/* chip_disable_level = */ 1,
/* post_chip_enable_wait_ns = */ 20,
/* pre_chip_disable_wait_ns = */ 10,
/* reset_pulse_width_ms = */ 100, /* */
/* post_reset_wait_ms = */ 100, /* far east OLEDs need much longer setup time */
/* sda_setup_time_ns = */ 100, /* cycle time is 100ns, so use 100/2 */
/* sck_pulse_width_ns = */ 100, /* cycle time is 100ns, so use 100/2, AVR: below 70: 8 MHz, >= 70 --> 4MHz clock */
/* sck_clock_hz = */ 4000000UL, /* since Arduino 1.6.0, the SPI bus speed in Hz. Should be 1000000000/sck_pulse_width_ns */
/* spi_mode = */ 0, /* active high, rising edge */
/* i2c_bus_clock_100kHz = */ 4,
/* data_setup_time_ns = */ 40,
/* write_pulse_width_ns = */ 150, /* sh1107: cycle time is 300ns, so use 300/2 = 150 */
/* tile_width = */ 16,
/* tile_height = */ 16,
/* default_x_offset = */ 0,
/* flipmode_x_offset = */ 0,
/* pixel_width = */ 128,
/* pixel_height = */ 128
};

I don't use Arduino, but I think you can try to use U8G2_SH1107_PIMORONI_128X128_F_HW_I2C instead of U8G2_SH1107_128X128_F_HW_I2C for initialization

from u8g2.

chauens avatar chauens commented on June 27, 2024

Hi, thank you for the tip, that appears to be very helpful. I will try that.
Meanwhile I went back to using a 128x64 display because it actually is physically wider. I would need to use a smaller font to display the same number of characters per line on the 128x128 OLED... at least on the one I got, making it harder to read.
So it may take some time until I get around to do another test with 128x128 OLED.

from u8g2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.