when i send the command "line 0,0,400,300,BLACK" from my pic-controler all looks fine (screensize = 480 x 320). But when i send the command "0,0,600,300,nx_black" (line bigger than screensize) the line is drawn to the right of the screen, then draw some pixels down, and then it starts again at the left side. Is it suppose to work this way or is there some way within the Nextionscreen to trim the line at the edges of the screen?
This is more of a coding question than it is a bug.
Rather than overdrawing
- which would be more related to a overflow
coding such to not overdraw but draw until the edge
You have the dimensions of screen 480x320
- therefore valid x range of 0 to 479
- therefore valid y range of 0 to 319
You have your origin 0,0
You have your destination 600,300
- is indeed out of bounds, and as such is without purpose.
Reducing the ratio, your slope of angle is 2:1
therefore x at 479 is y of 239.
Nextion side you have both system variables and component variables to assist in your calculations, and on the MCU freedom to define local variables at will
Oke. I am writing a library for Mikroelektronika MikroBASIC. I wil put the calculations in my code.
any kind of
- value out of range
- range overflow
can give unexpected results. To handle such is users responsibility in general ...