فهرست منبع

fix: l_mlx90640_draw2lcd应该使用malloc获取绘制所需要的内存块

Wendal Chen 1 سال پیش
والد
کامیت
33c9e7d9a5
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      components/mlx90640-library/luat_lib_mlx90640.c

+ 2 - 2
components/mlx90640-library/luat_lib_mlx90640.c

@@ -446,14 +446,14 @@ static int l_mlx90640_draw2lcd(lua_State *L) {
     int index_data_out_w = RAW_DATA_W*fold;
     int index_data_out_h = RAW_DATA_H*fold;
 
-    luat_color_t line[index_data_out_w];
+    luat_color_t *line = luat_heap_malloc(index_data_out_w * sizeof(luat_color_t));
     for (size_t y = 0; y < index_data_out_h; y++){
         for (size_t x = 0; x < index_data_out_w; x++){
             line[x] = color_swap(camColors[index_data_out[y*index_data_out_w + x]]);
         }
         luat_lcd_draw(lcd_conf, lcd_x, lcd_y+y, lcd_x+index_data_out_w-1, lcd_y+y, line);
     }
-
+    luat_heap_free(line);
     luat_heap_free(index_data_out);
     return 0;
 }