TFT ST7735: Fixed length bug in drawFastHLine and drawFastVLine #2528
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
I noticed a bug in the ST7735 TFT library in drawFastHLine and drawFastVLine functions. The drawn line is one pixel shorter than it should be. The issue can be reproduced by the following setup function.
Without this commit, the horizontal line (drawn using drawFastHLine) is one pixel shorter than the 45° line.
This is explained by the while (w--) loop preceding the spiwrite call.
With this commit both lines are 2 pixels long.
void setup() {
TFTscreen.begin();
TFTscreen.background(0, 0, 0);
TFTscreen.stroke(255, 0, 0);
TFTscreen.line(0, 0, 1, 1); // 45° line, OK (pixels [0,0] and [1,1] are filled
TFTscreen.line(0, 10, 1, 10); // Horiz. line, NOK (only pixel [0,10] is filled)
}