Arduino:M 5 Stack公式ライブラリにカスタムパターンが表示される場合のスクリーンを解決する


M 5 Stackという開発ボードを買って、ちょっと面白いと思いました.本質的にはESP 32の開発ボードですが、約5、6センチ四方の小さなボックスにパッケージされており、充電バッテリー、ディスプレイ、ラッパ、ボタンなどが付いており、非常に美しく実用的です.価格は安くはありませんが、やはりいくつかの痛みを確実に解決したので、この問題は仁見智に見えました.
M 5公式のライブラリをインストールした後、持参したTFTをテストします.Flash_Bitmap、無事通過.しかし、その上でM 5をさらにテストする予定である.Lcd.drawBitmapは、自分のパターンを使用しているときに問題が発生したことを示します.画面の「スクリーン」です.しかし、このスクリーンにはあるべき図案がかすかに見えるが、色システムが完全に乱れている.
カスタムパターンはImageConvert 565を使用して作られており、問題が発生していないため、バイト生成ツールの要因を排除することができます.推測は駆動面を示す要因である.
デフォルトの場所(私のドキュメントArduinolibrariesM 5 Stacksrc)を開くと、M 5 Displayが表示されます.hとM 5 Display.cpp.ざっと分析してみると、これもTFT_eSPIライブラリの、これでやりやすいです.テストの結果、setSwapBytes(true)で問題が発生していることがわかりました.falseを変更するとすべて正常です.
既存の機能に直接影響を及ぼす恐れがあるので、M 5 Displayを開きます.cppは、drawBitmap関数をコピーして貼り付け、自分のリロードを加え、boolパラメータを新たに追加し、本来書かれていたtrueをこのパラメータで制御します.もちろん、M 5 Display.hにもこのいくつかの新しい関数名を貼り付けます.参照コードは次のとおりです.
cpp :
///////////////////////////
void M5Display::drawBitmap(int16_t x0, int16_t y0, int16_t w, int16_t h, const uint16_t *data,bool swapBytes) {
  setSwapBytes(swapBytes);
  pushImage((int32_t)x0, (int32_t)y0, (uint32_t)w, (uint32_t)h, data);
}

void M5Display::drawBitmap(int16_t x0, int16_t y0, int16_t w, int16_t h, uint16_t *data,bool swapBytes) {
  setSwapBytes(swapBytes);
  pushImage((int32_t)x0, (int32_t)y0, (uint32_t)w, (uint32_t)h, data);
}

void M5Display::drawBitmap(int16_t x0, int16_t y0, int16_t w, int16_t h, const uint16_t *data, uint16_t transparent,bool swapBytes) {
  setSwapBytes(swapBytes);
  pushImage((int32_t)x0, (int32_t)y0, (uint32_t)w, (uint32_t)h, data, transparent);
}

void M5Display::drawBitmap(int16_t x0, int16_t y0, int16_t w, int16_t h, const uint8_t *data,bool swapBytes) {
  setSwapBytes(swapBytes);
  pushImage((int32_t)x0, (int32_t)y0, (uint32_t)w, (uint32_t)h, (const uint16_t*)data);
}

void M5Display::drawBitmap(int16_t x0, int16_t y0, int16_t w, int16_t h, uint8_t *data,bool swapBytes) {
  setSwapBytes(swapBytes);
  pushImage((int32_t)x0, (int32_t)y0, (uint32_t)w, (uint32_t)h, (uint16_t*)data);
}
//////////////////////////



 :
void drawBitmap(int16_t x0, int16_t y0, int16_t w, int16_t h, const uint16_t *data ,bool swapBytes);
void drawBitmap(int16_t x0, int16_t y0, int16_t w, int16_t h, const uint8_t *data ,bool swapBytes);
void drawBitmap(int16_t x0, int16_t y0, int16_t w, int16_t h, uint16_t *data ,bool swapBytes);
void drawBitmap(int16_t x0, int16_t y0, int16_t w, int16_t h, uint8_t *data ,bool swapBytes);
void drawBitmap(int16_t x0, int16_t y0, int16_t w, int16_t h, const uint16_t *data, uint16_t transparent ,bool swapBytes);

正式コードでは、例のdrawIconは完全に無視して、オリジナルのdrawImageを直接呼び出せばよい.Info.h略、例を参考に、実際に必要に応じてコードを貼り付けるとよい.
#include 
#include "Info.h"

void setup()
{
  M5.begin();
  M5.Lcd.setBrightness(128);  // 
  M5.Lcd.fillScreen(TFT_BLACK);
  

  // Draw the icons
  // drawIcon 
  //drawIcon(info, 0, 0, infoWidth, infoHeight);
  M5.Lcd.drawBitmap(0,0,infoWidth,infoHeight,info,false);

}

void loop()
{


}

うん、これは娘の大好きなリスのおもちゃです.新しい問題===
もう一つ入っていますが、今回はスクリーンを使わないのですが、表示されている色は反転しています.姉のことは何も考えられない.いずれにしても、画像を作るときはまず反転して、暇があればゆっくり研究します.