Problem with smooth graphics #2523
DamirAS2020
started this conversation in
General
Replies: 1 comment 1 reply
-
The functions accept integer angles 0-360 so floating point values will be rounded down. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
#include <TFT_eSPI.h> // Include the graphics library
TFT_eSPI tft = TFT_eSPI(); // Create object "tft"
uint8_t radius = 110;
uint8_t len = 95;
uint16_t centreX = 120, centreY = 120;
void setup() {
tft.init();
tft.setRotation(1);
tft.fillScreen(TFT_BLACK);
pinMode(26, OUTPUT); // lcd light
digitalWrite(26, LOW);
digitalWrite(26, HIGH);
for (float angle = 0; angle < 360; angle += 3.75) {
if (int(angle) != angle)
tft.drawArc(centreX, centreY, radius, len, angle + 0.75, angle - 0.75 + 3.75, TFT_WHITE, TFT_BLACK, 1);
else
tft.drawArc(centreX, centreY, radius, len, angle + 0.75, angle - 0.75 + 3.75, TFT_WHITE, TFT_BLACK, 1);
}
}
void loop() {}

#include <TFT_eSPI.h> // Include the graphics library
TFT_eSPI tft = TFT_eSPI(); // Create object "tft"
uint8_t radius = 110;
uint8_t len = 95;
uint16_t centreX = 120, centreY = 120;
void setup() {
tft.init();
tft.setRotation(1);
tft.fillScreen(TFT_BLACK);
pinMode(26, OUTPUT); // lcd light
digitalWrite(26, LOW);
digitalWrite(26, HIGH);
for (float angle = 0; angle < 360; angle += 3.75) {
if (int(angle) != angle)
tft.drawArc(centreX, centreY, radius, len, angle + 0.75, angle - 0.75 + 3.75, TFT_WHITE, TFT_BLACK, 1);
// else
// tft.drawArc(centreX, centreY, radius, len, angle + 0.75, angle - 0.75 + 3.75, TFT_WHITE, TFT_BLACK, 1);
}
}
After comment 2 lines (else and next) graphics become more or less smooth
What is a problem?
ESP32-WROOM-ESP32 Arduino IDE 2.0.4 ILI9341 2.2" 240x320
Thanks,
Damir Salakhov
Beta Was this translation helpful? Give feedback.
All reactions