Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printing to the screen the font position pointer does not advance #66

Closed
JacobChrist opened this issue Mar 22, 2023 · 2 comments
Closed
Assignees
Labels
bug Something isn't working Lua

Comments

@JacobChrist
Copy link
Member

Describe the bug
Sometimes when printing to the screen the font position pointer does not advance resulting in two character being printed at the same screen position. This happens maybe once every in ten runs.

This maybe related to the USB enumeration issue #65 because that is about where the screen drawing is taking place when the enumeration process starts.

To Reproduce
This code is the start of a much larger program, but this is the code that runs up to this point where the issue occurs.

function printLine(font_height, line, str) -- Show a title sequence for the program
	local x1, y1, x2, y2, bg
	-- Display Size -> 320x240 

	-- Erase Old Weight
	x1 = 0
	y1 = font_height * line
	x2 = 320
	y2 = font_height * line + font_height

	bg = (8 * line)

	ez.BoxFill(x1,y1, x2,y2, ez.RGB(bg,bg,bg)) -- X, Y, Width, Height, Color

	-- Display Line
	ez.SetColor(ez.RGB(0,0,255))
	ez.SetFtFont(fn, font_height * 0.70) -- Font Number, Height, Width
	ez.SetXY(x1, y1)
	print(str)
	ez.Wait_ms(1000)
end

function titleScreen(fn) -- Show a title sequence for the program
	ez.Cls(ez.RGB(0,0,0))
	printLine(font_height, 0, "Pull Test - MqpQ")
	ez.Wait_ms(500)
end

fn = 14
font_height = 240 / 8 -- = 30

weight = 0
tare = 0
weight_max = 0
pin = 0

-- Main
titleScreen(fn)

result = ez.I2CopenMaster()
printLine(font_height, 5, "I2C Open: " .. tostring(result) )
ez.Wait_ms(250)

Expected behavior
The string "I2C Open: true" should have been printed without overlapping characters.

Screenshots
Red arrow points to offending error.
image

@JacobChrist JacobChrist added bug Something isn't working Lua labels Mar 22, 2023
@microlan
Copy link
Contributor

By design. We don't support CRLF in the print command because customers almost never start their printing at X=0 so we leave any CRLF-like activities up to the customer. This matches the behavior of the EZLCD API and the previous 10x Lua code used by existing customers.

@JacobChrist
Copy link
Member Author

I think you are misunderstanding the issue and this has nothing to do with CRLF. The same code does different things depending on the run. Sometimes it works as expected other times the cursor does not advance when printing.

This issue shouldn't be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Lua
Projects
None yet
Development

No branches or pull requests

2 participants