【问题标题】:esp8266 & TFT_eSPI : how can i avoid alignment exception when drawing an image?esp8266 & TFT_eSPI:绘制图像时如何避免对齐异常?
【发布时间】:2018-01-18 04:03:28
【问题描述】:

我正在使用 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
}

【问题讨论】:

    标签: exception alignment esp8266


    【解决方案1】:

    #else
    #endif - 我猜你用它来调试?

    检查图标数组的大小,您尝试阅读icon[i * OLED_BS + j],我想在某些情况下您可能会遇到问题。

    【讨论】:

    • Grmbl,我在计算你的意思,我不相信你。直到我看到我没有在另一个函数中返回分配的数组。谢谢你指点我。
    猜你喜欢
    • 2015-12-11
    • 2017-02-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-29
    • 1970-01-01
    • 2016-09-15
    相关资源
    最近更新 更多