Skip to content

Strange Button Y Placement Inconsistency #16

Description

@ramiss

@Bodmer - I've got a weird ghost in the machine going on with buttons and I'm wondering if you could provide any insight?

With the following code, the mode_btn places itself approx 18 pixels lower on the screen than the other (2), even though the Y numbers are identical - and regardless of the order I initiate these buttons. I actually have to use the code in the second snippet to force the buttons to stay in the same vertical position on screen.

The only thing different about these buttons that i can determine is that the mode button is on the far right of the screen. Could this be some weird scaling bug as you get further out? What's odd though is that the other graphics elements (lines, rectangles etc from TFT_eSPI) don't suffer from this, only the buttons.

Edit 1: If I didn't know better, it "feels" like the mode button is using an alternate reference position. Top left instead of mid point, for example, since its almost 1/2 the button height lower. Come to think of it, I had to adjust the X position more left compared to the same code on other hardware, so they might both be affected - only on this button.

Edit 2: - I'm in landscape mode, if you hadn't figured it out :)
320x240 screen: https://www.amazon.com/gp/product/B0BNQBKFCT/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&th=1

up_btn.initButtonUL(40, 220, 75, 35, WHITE, CYAN, BLACK, "VTX+", 1);
down_btn.initButtonUL(120, 220, 75, 35, WHITE, CYAN, BLACK, "VTX-", 1);
mode_btn.initButtonUL(240, 220, 75, 35, WHITE, CYAN, BLACK, "MODE", 1);

Code to force the buttons to line up vertically:

up_btn.initButtonUL(40, 220, 75, 35, WHITE, CYAN, BLACK, "VTX+", 1);
down_btn.initButtonUL(120, 220, 75, 35, WHITE, CYAN, BLACK, "VTX-", 1);
mode_btn.initButtonUL(240, 202, 75, 35, WHITE, CYAN, BLACK, "MODE", 1);

Here are my PlatformIO build flags:

[env:nodemcu-32s]
platform = espressif32
board = nodemcu-32s
framework = arduino
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
lib_deps = 
	bodmer/TFT_eSPI@^2.5.43
	bodmer/TFT_eWidget@^0.0.6
build_flags = 
	;-Os	
	;-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
	-D USER_SETUP_LOADED=1
	-D USER_SETUP_ID=42
	-D ILI9341_DRIVER=1
	-D TFT_MISO=19  ; Same pin for T_DO
	-D TFT_MOSI=23  ; Same pin for T_DIN
	-D TFT_SCLK=16  ; Same pin for T_CLK
	-D TFT_CS=15	; Chip select control pin
	-D TFT_DC=2  	; Data Command control pin
	-D TFT_RST=4  
	-D TFT_LED=12
	-D TOUCH_CS=21  
	-D LOAD_GLCD=1
	-D LOAD_FONT2=1
	-D LOAD_FONT4=1
	-D LOAD_FONT6=1
	-D LOAD_FONT7=1
	-D LOAD_FONT8=1
	-D LOAD_GFXFF=1
	-D SMOOTH_FONT=1
	-D SPI_FREQUENCY=40000000 
	-D SPI_READ_FREQUENCY=16000000
	-D SPI_TOUCH_FREQUENCY=2500000

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions