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

ez.BoxFill one off on the x (maybe y too) #76

Open
JacobChrist opened this issue Apr 13, 2023 · 0 comments
Open

ez.BoxFill one off on the x (maybe y too) #76

JacobChrist opened this issue Apr 13, 2023 · 0 comments
Assignees
Labels
bug Something isn't working Lua

Comments

@JacobChrist
Copy link
Member

JacobChrist commented Apr 13, 2023

Describe the bug
When using a ez.BoxFill the box (at least in the x-axis) doesn't go to the extents specified (maybe by design but if so its not clear in the manual.

The following image erases the trace with a box fill but the last pixel on the right is not erased.
image

A clear and concise description of what the bug is.

To Reproduce
Here is the code that generates the issue:

unction renderOscope(audio, gain)
	local result

	local x_min = 11
	local x_max = ez.Width-x_min
	local y_min = 10
	local y_max = 156
	local y_mid = (y_max - y_min) / 2 + y_min
	local y_max = 156
	local peak_to_peak = y_max - y_min
	local peak = peak_to_peak / 2
	
	-- erase previous scope
	ez.BoxFill(x_min, y_min, x_max, y_max, ez.RGB(0, 0, 40)) -- X1, Y1, X2, Y2, Color

	local index = 1
	for x = x_min, x_max, 1 do
		local left = ez.audio_getLeft(a, index) + .0
		index = index + 1
		left = left / gain * (peak)
		if(left > peak) then left = peak end
		if(left < -peak) then left = -peak end
		ez.Plot( x, math.floor(left + y_mid), ez.RGB(0, 0xff, 0) )
	end
end

Note: this bug was found in unreleased I2S firmware, so the ez.audio_getLeft() will need to be replaced with something equivalent if firmware is unavailable.

@JacobChrist JacobChrist added bug Something isn't working Lua labels Apr 13, 2023
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