TFT_eSPI.h库问题:GC9A01屏创建全屏精灵失败,高度超230即异常
GC9A01圆形屏TFT_eSPI精灵创建失败问题
我近期收到一块240x240像素的GC9A01圆形显示屏,在使用TFT_eSPI.h库实现精灵滑动效果时遇到问题——参考的教程里是创建与屏幕尺寸一致的精灵作为背景,但我无法创建覆盖全屏的精灵。
以下代码可正常运行:
#include <TFT_eSPI.h> TFT_eSPI tft = TFT_eSPI(); TFT_eSprite background = TFT_eSprite(&tft); void setup() { Serial.begin(9600); tft.init(); tft.fillScreen(TFT_BLACK); background.createSprite(240, 230); // 关键行 } void loop() { background.fillSprite(TFT_BLACK); background.pushSprite(0, 0); Serial.print("Width Sprite: "); Serial.print(background.width()); Serial.print(" Height Sprite: "); Serial.print(background.height()); Serial.print(" Width TFT: "); Serial.print(tft.width()); Serial.print(" Height TFT: "); Serial.println(tft.height()); }
但将background.createSprite(240, 230);修改为background.createSprite(240, 231);后,程序完全无法正常运行,串口监视器显示精灵尺寸为0x0像素。我已修改User_Setup.h文件适配该显示屏,恳请提供技术帮助。
串口监视器输出情况:
- 高度设为231及以上时:精灵尺寸显示为0x0,屏幕尺寸显示为240x240
- 高度设为230时:精灵尺寸显示为240x230,屏幕尺寸显示为240x240
内容的提问来源于stack exchange,提问作者goranovore2.0
相关产品推荐
相关产品推荐

