secondsun / arduino-tvout

Automatically exported from code.google.com/p/arduino-tvout
0 stars 0 forks source link

Logic error in begin(uint8_t mode, uint8_t x, uint8_t y) #77

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I may misunderstand your intention, or you use some trick i don't see, but i 
believe you have an in line 77 of TVout.cpp, where you check if size of the 
horizontal resolution is divisible by 8.
In the current code, this logic expression should evaluate to true if the x is 
not divisible by 8:

!(x & 0xF8)

However, as far as i can see this only evaluates to true if x has a value in 
the range of 0-7, or some ranges above 255 (fx. 256 is divisible by 8, but this 
resolution may be outside the capabilities of the library?).
I believe the desired effect will be achieved with:

(i & ~0xF8)

This evaluates to true for all values not divisible by 8 in the range of 0-255.

Hope this helps.
If I have misunderstood the logic or your intentions, i'm sorry for wasting 
your time.

Original issue reported on code.google.com by jesper.b...@gmail.com on 29 Nov 2013 at 11:10

GoogleCodeExporter commented 9 years ago
Doh. I of course mean:
(x & ~0xF8)

Copy-pasted from the program I used to test the theory.

Original comment by jesper.b...@gmail.com on 29 Nov 2013 at 11:11