爱编程的小付 发表于 2022-1-23 21:45:57

崩溃

请各位大神看看,为何会报错?

错误:
1610612736

Stack smashing protect failure!

abort() was called at PC 0x400dfde4 on core 1

Backtrace: 0x40088f20:0x3ffb1f10 0x4008914d:0x3ffb1f30 0x400dfde4:0x3ffb1f50 0x400d1235:0x3ffb1f70 0x400d9a7a:0x3ffb1fb0 0x40085095:0x3ffb1fd0

Rebooting...
-1610612736

Stack smashing protect failure!

abort() was called at PC 0x400dfde4 on core 1

Backtrace: 0x40088f20:0x3ffb1f10 0x4008914d:0x3ffb1f30 0x400dfde4:0x3ffb1f50 0x400d1235:0x3ffb1f70 0x400d9a7a:0x3ffb1fb0 0x40085095:0x3ffb1fd0

Rebooting...



返回的速度变成了8位数



代码

#include "DFRobot_BC20.h"
#include <U8g2lib.h>
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
DFRobot_BC20 myBC20;
U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);
void setup() {
/* U8g2 Project: SSD1306 Test Board */
//pinMode(10, OUTPUT);
//pinMode(9, OUTPUT);
//digitalWrite(10, 0);
//digitalWrite(9, 0);
/* U8g2 Project: KS0108 Test Board */
//pinMode(16, OUTPUT);
//digitalWrite(16, 0);
Serial.begin(115200);
u8x8.begin();
u8x8.setPowerSave(0);
while (!myBC20.powerOn()) {
    delay(1000);
}
if (myBC20.getQGNSSC() == OFF) {
    Serial.println("open QGNSSC");
    myBC20.setQGNSSC(ON);
    while (!myBC20.powerOn()) {
      delay(1000);
    }
}
delay(1000);
}

void loop() {
myBC20.getQGNSSRD();
char time1 = {0};
char speed1 = {0};
sprintf(time1, "%d:%d", sCLK.Hour + 8, sCLK.Minute);
sprintf(speed1, "%d", sGGNS.Speed);
u8x8.setFont(u8x8_font_8x13B_1x2_r);
u8x8.setCursor(0, 0); //这里设置显示的坐标
u8x8.print(time1);//输出显示内容
u8x8.refreshDisplay();
u8x8.setFont(u8x8_font_8x13B_1x2_r);
if (sSAT.USE >= 7)
{ u8x8.setCursor(41, 0); //这里设置显示的坐标
    u8x8.print("READY");//输出显示内容
   
}
else{
    u8x8.setCursor(43, 0); //这里设置显示的坐标
    u8x8.print("WAIT");//输出显示内容
   
}
u8x8.setFont(u8x8_font_profont29_2x3_n);
u8x8.drawString(2, 2, speed1);
Serial.println(speed1);

u8x8.refreshDisplay();
}如有回答将不胜感激

hnyzcj 发表于 2022-1-24 08:29:18

问题最好描述清楚点,这样方便大家帮你解决
页: [1]
查看完整版本: 崩溃