esp32-s无法烧录
#include
#include
#include
#include
#include
TFT_eSPI tft = TFT_eSPI();
TFT_eSprite clk = TFT_eSprite(&tft);
char* ssid = "*****";//wifi名字
char* password = "*****";//wifi密码
char* service_ip = "192.168.2.15";//上位机IP
int httpPort = 7680;//设置上位机端口
WiFiClient client;
uint8_t buff[7000] PROGMEM= {0};
uint8_t img_buff[40000] PROGMEM= {0};
uint16_t size_count= {0};
bool tft_output(int16_t x, int16_t y, uint16_t w, uint16_t h, uint16_t*bitmap)
{
if( y>=tft.height()) return 0;
tft.pushImage(x,y,w,h,bitmap);
return 1;
}
byte loadNum = 6;
void loading(byte dalayTime){
clk.setColorDepth(8);
clk.createSprite(200,50);
clk.fillSprite(0x0000);
clk.drawRoundRect(0,0,200,16,8,0xFFFF);
clk.fillRoundRect(3,3,loadNum,10,5,0xFFFF);
clk.setTextDatum(CC_DATUM);
clk.setTextColor(TFT_GREEN, 0x0000);
clk.drawString("Connecting to WiFi",100,40,2);
clk.pushSprite(20,67);
clk.deleteSprite();
loadNum +=1;
if(loadNum>=195){
loadNum = 195;
}
delay(dalayTime);
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
tft.begin();
tft.setRotation(0);
tft.fillScreen(TFT_WHITE);
tft.setTextColor(TFT_BLACK,TFT_WHITE);
WiFi.begin(ssid,password);
delay(1000);
while(WiFi.status()!=WL_CONNECTED){
for(byte n=0;n<10;n++){
loading(50);
}
}
while(loadNum<195){
loading(3);
}
if(WiFi.status() == WL_CONNECTED)
{
client.connect(service_ip,httpPort);
Serial.println("WiFi is connected");
Serial.println("SSID: ");
Serial.println(WiFi.SSID());
IPAddress ip = WiFi.localIP();
Serial.println("IP Address: ");
Serial.println(ip);
}
TJpgDec.setJpgScale(1);
TJpgDec.setSwapBytes(true);
TJpgDec.setCallback(tft_output);
client.write("ok");
}
uint16_t read_count=0;
uint8_t pack_size[2];
uint16_t frame_size;
float start_time,end_time;
void loop() {
// put your main code here, to run repeatedly:
client.write("no");
while(client.available()){
while(client.available()){
if(read_count==0)
{
start_time=millis();
client.read(pack_size,2);
frame_size=pack_size[0]+(pack_size[1]<<8);
}
read_count=client.read(buff,7000);
memcpy(&img_buff[size_count],buff,read_count);
size_count=size_count+read_count;
if(img_buff[frame_size-3]==0xaa && img_buff[frame_size-2]==0xbb && img_buff[frame_size-1]==0xcc)
{
img_buff[frame_size-3]==0;img_buff[frame_size-2]==0;img_buff[frame_size-1]==0;
TJpgDec.drawJpg(0,0,img_buff, sizeof(img_buff));
size_count=0;
read_count=0;
client.write("ok");
end_time = millis();
Serial.printf("帧大小: %d ",frame_size);Serial.print("MCU当前处理速度: ");Serial.print(1000/ (end_time - start_time),2);Serial.println("Fps/s");
break;
}
}
}
}
警告: SPI 库要求运行在 esp32 架构(),可能与你现在运行在 arduino-esp32-master 架构上的开发板()不兼容。
警告: FS 库要求运行在 esp32 架构(),可能与你现在运行在 arduino-esp32-master 架构上的开发板()不兼容。
警告: SPIFFS 库要求运行在 esp32 架构(),可能与你现在运行在 arduino-esp32-master 架构上的开发板()不兼容。
警告: WiFi 库要求运行在 esp32 架构(),可能与你现在运行在 arduino-esp32-master 架构上的开发板()不兼容。
警告: SD 库要求运行在 esp32 架构(),可能与你现在运行在 arduino-esp32-master 架构上的开发板()不兼容。
d:/arduino/hardware/espressif/arduino-esp32-master/tools/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\TJpg_Decoder\tjpgd.c.o:(.literal.jd_decomp+0x10): undefined reference to BYTECLIP' d:/arduino/hardware/espressif/arduino-esp32-master/tools/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\TJpg_Decoder\tjpgd.c.o: in function
block_idct':
D:\Arduino\libraries\TJpg_Decoder\src/tjpgd.c:1429: undefined reference to BYTECLIP' d:/arduino/hardware/espressif/arduino-esp32-master/tools/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: D:\Arduino\libraries\TJpg_Decoder\src/tjpgd.c:1430: undefined reference to
BYTECLIP'
d:/arduino/hardware/espressif/arduino-esp32-master/tools/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: D:\Arduino\libraries\TJpg_Decoder\src/tjpgd.c:1431: undefined reference to BYTECLIP' d:/arduino/hardware/espressif/arduino-esp32-master/tools/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: D:\Arduino\libraries\TJpg_Decoder\src/tjpgd.c:1432: undefined reference to
BYTECLIP'
d:/arduino/hardware/espressif/arduino-esp32-master/tools/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: libraries\TJpg_Decoder\tjpgd.c.o:D:\Arduino\libraries\TJpg_Decoder\src/tjpgd.c:1433: more undefined references to `BYTECLIP' follow
collect2.exe: error: ld returned 1 exit status
exit status 1
为开发板 ESP32 Dev Module 编译时出错。
我链接了块屏幕想要在其上显示图片
可能是ESP32的开发板支持库没有安装好。不知道你是怎么安装的
试试用这个网页上的方法试试
提供参考实例【Esp32在Arduino IDE的开发环境(问题大全)】,链接:https://blog.csdn.net/Edson_White/article/details/123159818