我正在使用Bodmer TFT_eSPI库。显示位图绘制的示例(TFT_Flash_Bitmap),但在我的应用程序中集成该代码始终产生ESP异常9:内存对齐异常。
注释掉pushColors()或pushColor()调用可以避免崩溃,所以我怀疑它发生在那里。
我认为错误全是我的。任何人都可以帮我找到原因/解决方案吗?
谢谢,
丹尼
Exception (9):
epc1=0x402071fc epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000001 depc=0x00000000
/*
* Note the Bodmer version of drawIcon is for FLASH memory. No such thing here.
* See TFT_eSPI/examples/320 x 240/TFT_Flash_Bitmap , moved from example to class method here.
*/
void Oled::drawIcon(const uint16_t *icon, int16_t x, int16_t y, uint16_t width, uint16_t height) {
#if 0
uint16_t pixbuf[OLED_BS];
setWindow(x, y, x + width - 1, y + height - 1);
// How many whole buffers to send ?
uint16_t nb = ((uint16_t)height * width) / OLED_BS;
// Fill and send that many buffers to TFT
for (int i = 0; i < nb; i++) {
for (int j = 0; j < OLED_BS; j++) {
pixbuf[j] = icon[i * OLED_BS + j];
}
// pushColors(pixbuf, OLED_BS);
}
// How many pixels not yet sent ?
uint16_t np = ((uint16_t)height * width) % OLED_BS;
// Send any partial buffer left over
if (np) {
for (int i = 0; i < np; i++)
pixbuf[i] = icon[nb * OLED_BS + i];
// pushColors(pixbuf, np);
}
#else
setWindow(x, y, x + width - 1, y + height - 1);
for (int i = 0; i < width * height; i++)
; // pushColor(icon[i]);
#endif
}
答案 0 :(得分:0)
#else
#endif
- 我想你用它来进行调试?
检查图标数组的大小,您尝试阅读icon[i * OLED_BS + j]
,我猜在某些情况下您可能会遇到问题。