alexanderlavrushko / BLE-HUD-navigation-ESP32

Shows navigation instructions received from the phone (e.g. "After 200m turn right")
75 stars 23 forks source link

How can I be compatible with SSD1301 products? #27

Open junhyoung91 opened 7 months ago

junhyoung91 commented 7 months ago

How can I be compatible with SSD1301 products? As far as I know, SSD1351 and SSD1301 have only pixel and color differences. But if you look at the code now, SSD1301 doesn't show anything. Is there any way?

alexanderlavrushko commented 7 months ago

SSD1301 is not supported "out of the box", so the way is to add it yourself, but it's not easy. The biggest problem is that image data is prepared for display of size 128x128 and each pixel is 16-bit, so if your display is smaller and has different data representation, you will have to convert that somehow.

  1. Find a library which you will use for sending images to your SSD1301 display
  2. Take a look at files TFT_TTGO.h and TFT_TTGO.cpp - they contain a class TFT_TTGO, which manages display using special library for TTGO module
  3. You will have to implement your own class for managing display (let's call it MySSD1301, but the name is up to you). Similarly to TFT_TTGO class, your new class MySSD1301 will be derived from IDisplay interface, and implement corresponding virtual methods: Init, GetWidth, GetHeight, SendImage, EnterSleepMode
  4. See how TFT_TTGO instance is created in BLEHUDNaviESP32.ino:30 - similarly, you will have to create an instance of your own class MySSD1301, and comment out declarations of OLED_SSD1351_nolib and TFT_TTGO, like this:
//#include "OLED_SSD1351_nolib.h"
//OLED_SSD1351_nolib selectedDisplay;
//constexpr bool ENABLE_VOLTAGE_MEASUREMENT = false;

//#include "TFT_TTGO.h"
//TFT_TTGO selectedDisplay;
//constexpr bool ENABLE_VOLTAGE_MEASUREMENT = true;

#include "MySSD1301.h"
MySSD1301 selectedDisplay;
constexpr bool ENABLE_VOLTAGE_MEASUREMENT = false;