以下是我的代码,是仿照https://platformio.org/lib/show/1559/TFT_eSPI/examples改写的代码,显示图片正常,但是一到载入字体,tft.loadFont(fileName, SD); 就报错重启
void setup()
{
Serial.begin(9600);
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_BLACK);
delay(500);
if (TFT_BL > 0) { // TFT_BL has been set in the TFT_eSPI library in the User Setup file TTGO_T_Display.h
pinMode(TFT_BL, OUTPUT); // Set backlight pin to output mode
digitalWrite(TFT_BL, HIGH);
// digitalWrite(TFT_BL, TFT_BACKLIGHT_ON); // Turn backlight on. TFT_BACKLIGHT_ON has been set in the TFT_eSPI library in the User Setup file TTGO_T_Display.h
}
//挂载文件系统
sdSPI.begin(SD_SCLK, SD_MISO, SD_MOSI, SD_CS);
if (!SD.begin(SD_CS, sdSPI))
{
DebugPrintln("存储卡挂载失败");
return;
}
tft.setTextWrap(true, true);
// Name of font file (library adds leading / and .vlw)
String fileName = "MicrosoftYaHeiUI-16";
tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.loadFont(fileName, SD); // Use font stored on SD
tft.setCursor(0, 0);
tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.println("测试!");
tft.unloadFont();
}
///////////////////////////////////////////////////错误信息
18:25:59.330 -> Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled.
18:25:59.424 -> Core 1 register dump:
18:25:59.424 -> PC : 0x400d51cb PS : 0x00060b30 A0 : 0x800d58b8 A1 : 0x3ffb1ed0
18:25:59.517 -> A2 : 0x3ffbfea4 A3 : 0x00000000 A4 : 0x0008f1a4 A5 : 0x00000000
18:25:59.611 -> A6 : 0x00000004 A7 : 0x00000008 A8 : 0x00000002 A9 : 0x3ffd1ed0
18:25:59.704 -> A10 : 0xfffffffc A11 : 0x00000000 A12 : 0x00000006 A13 : 0x3f40b6f0
18:25:59.847 -> A14 : 0x3ffb8b84 A15 : 0xff000000 SAR : 0x0000001b EXCCAUSE: 0x0000001d
18:25:59.894 -> EXCVADDR: 0x00000000 LBEG : 0x4000c28c LEND : 0x4000c296 LCOUNT : 0x00000000
18:25:59.990 ->
18:25:59.990 -> ELF file SHA256: 0000000000000000
18:26:00.037 ->
18:26:00.037 -> Backtrace: 0x400d51cb:0x3ffb1ed0 0x400d58b5:0x3ffb1ef0 0x400d5921:0x3ffb1f40 0x400d0f91:0x3ffb1f70 0x400d7325:0x3ffb1fb0 0x400862b1:0x3ffb1fd0
18:26:00.177 ->
18:26:00.177 -> Rebooting...
|