LilyGo T5 4.7" ESP32 S3编译报错:int*转int32_t*无效
编译报错:invalid conversion from 'int*' to 'int32_t*' {aka 'long int*'} [-fpermissive]
我购买了一款搭载ESP32 S3的LilyGo T5 4.7"新一代墨水屏,已安装必要的库和板管理器,并按照步骤配置Arduino IDE,但无论如何操作,编译始终报错:
compilation error: invalid conversion from 'int*' to 'int32_t*' {aka 'long int*'} [-fpermissive]
在另一台电脑上按相同步骤操作可正常编译,附上我的代码如下:
#ifndef BOARD_HAS_PSRAM #error "Please enable PSRAM !!!" #endif #include <Arduino.h> #include "epd_driver.h" #include "font/firasans.h" #include "esp_adc_cal.h" #include <FS.h> #include <SPI.h> #include <SD.h> #include "image/logo.h" #include "pins.h" #if defined(T5_47_PLUS) #include "pcf8563.h" #include <Wire.h> #endif #if defined(T5_47_PLUS) PCF8563_Class rtc; #endif int vref = 1100; void setup() { Serial.begin(115200); delay(1000); char buf[128]; /** * SD Card test * Only as a test SdCard hardware, use example reference */ SPI.begin(SD_SCLK, SD_MISO, SD_MOSI, SD_CS); bool rlst = SD.begin(SD_CS, SPI); if (!rlst) { Serial.println("SD init failed"); snprintf(buf, 128, "➸ No detected SdCard"); } else { Serial.println("SD init success"); snprintf(buf, 128, "➸ Detected SdCard insert:%.2f GB", SD.cardSize() / 1024.0 / 1024.0 / 1024.0 ); } // Correct the ADC reference voltage esp_adc_cal_characteristics_t adc_chars; #if defined(T5_47) esp_adc_cal_value_t val_type = esp_adc_cal_characterize( ADC_UNIT_1, ADC_ATTEN_DB_11, ADC_WIDTH_BIT_12, 1100, &adc_chars ); #else esp_adc_cal_value_t val_type = esp_adc_cal_characterize( ADC_UNIT_2, ADC_ATTEN_DB_11, ADC_WIDTH_BIT_12, 1100, &adc_chars ); #endif if (val_type == ESP_ADC_CAL_VAL_EFUSE_VREF) { Serial.printf("eFuse Vref: %umV\r\n", adc_chars.vref); vref = adc_chars.vref; } #if defined(T5_47_PLUS) Wire.begin(TOUCH_SDA, TOUCH_SCL); rtc.begin(); rtc.setDateTime(2022, 6, 30, 0, 0, 0); #endif epd_init(); Rect_t area = { .x = 230, .y = 20, .width = logo_width, .height = logo_height, }; epd_poweron(); epd_clear(); epd_draw_image(area, (uint8_t *)logo_data, BLACK_ON_WHITE); epd_poweroff(); int cursor_x = 200; int cursor_y = 250; const char *string1 = "➸ 16 color grayscale 😀 \n"; const char *string2 = "➸ Use with 4.7\" EPDs 😍 \n"; const char *string3 = "➸ High-quality font rendering ✎🙋"; const char *string4 = "➸ ~630ms for full frame draw 🚀\n"; epd_poweron(); writeln((GFXfont *)&FiraSans, buf, &cursor_x, &cursor_y, NULL); delay(500); cursor_x = 200; cursor_y += 50; writeln((GFXfont *)&FiraSans, string1, &cursor_x, &cursor_y, NULL); delay(500); cursor_x = 200; cursor_y += 50; writeln((GFXfont *)&FiraSans, string2, &cursor_x, &cursor_y, NULL); delay(500); cursor_x = 200; cursor_y += 50; writeln((GFXfont *)&FiraSans, string3, &cursor_x, &cursor_y, NULL); delay(500); cursor_x = 200; cursor_y += 50; writeln((GFXfont *)&FiraSans, string4, &cursor_x, &cursor_y, NULL); delay(500); epd_poweroff(); } void loop() { // When reading the battery voltage, POWER_EN must be turned on epd_poweron(); delay(10); // Make adc measurement more accurate uint16_t v = analogRead(BATT_PIN); float battery_voltage = ((float)v / 4095.0) * 2.0 * 3.3 * (vref / 1000.0); String voltage = "➸ Voltage: " + String(battery_voltage) + "V"; #if defined(T5_47_PLUS) voltage = voltage + String(" (") + rtc.formatDateTime(PCF_TIMEFORMAT_YYYY_MM_DD_H_M_S) + String(")"); #endif Serial.println(voltage); Rect_t area = { .x = 200, .y = 460, #if defined(T5_47_PLUS) .width = 700, #else .width = 320, #endif .height = 50, }; int cursor_x = 200; int cursor_y = 500; epd_clear_area(area); writeln((GFXfont *)&FiraSans, (char *)voltage.c_str(), &cursor_x, &cursor_y, NULL); // Turn off the power of the entire POWER_EN control and also turn off the blue LED light epd_poweroff_all(); delay(5000); }
请问有人能帮我解决这个问题吗?谢谢大家!
内容的提问来源于stack exchange,提问作者Jonathan Klein
相关产品推荐
相关产品推荐

