mirror of
https://github.com/meshtastic/firmware.git
synced 2025-05-07 14:08:51 +00:00
Merge pull request #2174 from meshtastic/SH1107
Sh1107 support (128x128)
This commit is contained in:
commit
8f5338dc85
@ -58,7 +58,7 @@ build_flags = -Wno-missing-field-initializers
|
|||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/meshtastic/esp8266-oled-ssd1306.git#53580644255b48ebb7a737343c6b4e71c7e11cf2 ; ESP8266_SSD1306
|
https://github.com/meshtastic/esp8266-oled-ssd1306.git#da1ede4dfcd91074283b029080759fd744120909 ; ESP8266_SSD1306
|
||||||
mathertel/OneButton@^2.0.3 ; OneButton library for non-blocking button debounce
|
mathertel/OneButton@^2.0.3 ; OneButton library for non-blocking button debounce
|
||||||
https://github.com/meshtastic/arduino-fsm.git#7db3702bf0cfe97b783d6c72595e3f38e0b19159
|
https://github.com/meshtastic/arduino-fsm.git#7db3702bf0cfe97b783d6c72595e3f38e0b19159
|
||||||
https://github.com/meshtastic/TinyGPSPlus.git#127ad674ef85f0201cb68a065879653ed94792c4
|
https://github.com/meshtastic/TinyGPSPlus.git#127ad674ef85f0201cb68a065879653ed94792c4
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
|
||||||
#ifdef USE_EINK
|
#ifdef USE_EINK
|
||||||
#include "main.h"
|
|
||||||
#include "EInkDisplay2.h"
|
#include "EInkDisplay2.h"
|
||||||
#include "SPILock.h"
|
|
||||||
#include <SPI.h>
|
|
||||||
#include "GxEPD2_BW.h"
|
#include "GxEPD2_BW.h"
|
||||||
|
#include "SPILock.h"
|
||||||
|
#include "main.h"
|
||||||
|
#include <SPI.h>
|
||||||
|
|
||||||
#define COLORED GxEPD_BLACK
|
#define COLORED GxEPD_BLACK
|
||||||
#define UNCOLORED GxEPD_WHITE
|
#define UNCOLORED GxEPD_WHITE
|
||||||
@ -14,62 +14,63 @@
|
|||||||
#define TECHO_DISPLAY_MODEL GxEPD2_154_D67
|
#define TECHO_DISPLAY_MODEL GxEPD2_154_D67
|
||||||
#elif defined(RAK4630)
|
#elif defined(RAK4630)
|
||||||
|
|
||||||
//GxEPD2_213_BN - RAK14000 2.13 inch b/w 250x122 - changed from GxEPD2_213_B74 - which was not going to give partial update support
|
// GxEPD2_213_BN - RAK14000 2.13 inch b/w 250x122 - changed from GxEPD2_213_B74 - which was not going to give partial update
|
||||||
|
// support
|
||||||
#define TECHO_DISPLAY_MODEL GxEPD2_213_BN
|
#define TECHO_DISPLAY_MODEL GxEPD2_213_BN
|
||||||
|
|
||||||
//4.2 inch 300x400 - GxEPD2_420_M01
|
// 4.2 inch 300x400 - GxEPD2_420_M01
|
||||||
//#define TECHO_DISPLAY_MODEL GxEPD2_420_M01
|
//#define TECHO_DISPLAY_MODEL GxEPD2_420_M01
|
||||||
|
|
||||||
//2.9 inch 296x128 - GxEPD2_290_T5D
|
// 2.9 inch 296x128 - GxEPD2_290_T5D
|
||||||
//#define TECHO_DISPLAY_MODEL GxEPD2_290_T5D
|
//#define TECHO_DISPLAY_MODEL GxEPD2_290_T5D
|
||||||
|
|
||||||
//1.54 inch 200x200 - GxEPD2_154_M09
|
// 1.54 inch 200x200 - GxEPD2_154_M09
|
||||||
//#define TECHO_DISPLAY_MODEL GxEPD2_154_M09
|
//#define TECHO_DISPLAY_MODEL GxEPD2_154_M09
|
||||||
|
|
||||||
#elif defined(PCA10059)
|
#elif defined(PCA10059)
|
||||||
|
|
||||||
//4.2 inch 300x400 - GxEPD2_420_M01
|
// 4.2 inch 300x400 - GxEPD2_420_M01
|
||||||
#define TECHO_DISPLAY_MODEL GxEPD2_420_M01
|
#define TECHO_DISPLAY_MODEL GxEPD2_420_M01
|
||||||
|
|
||||||
#elif defined(M5_COREINK)
|
#elif defined(M5_COREINK)
|
||||||
//M5Stack CoreInk
|
// M5Stack CoreInk
|
||||||
//1.54 inch 200x200 - GxEPD2_154_M09
|
// 1.54 inch 200x200 - GxEPD2_154_M09
|
||||||
#define TECHO_DISPLAY_MODEL GxEPD2_154_M09
|
#define TECHO_DISPLAY_MODEL GxEPD2_154_M09
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GxEPD2_BW<TECHO_DISPLAY_MODEL, TECHO_DISPLAY_MODEL::HEIGHT> *adafruitDisplay;
|
GxEPD2_BW<TECHO_DISPLAY_MODEL, TECHO_DISPLAY_MODEL::HEIGHT> *adafruitDisplay;
|
||||||
|
|
||||||
EInkDisplay::EInkDisplay(uint8_t address, int sda, int scl)
|
EInkDisplay::EInkDisplay(uint8_t address, int sda, int scl, uint8_t screen_model)
|
||||||
{
|
{
|
||||||
#if defined(TTGO_T_ECHO)
|
#if defined(TTGO_T_ECHO)
|
||||||
setGeometry(GEOMETRY_RAWMODE, TECHO_DISPLAY_MODEL::WIDTH, TECHO_DISPLAY_MODEL::HEIGHT);
|
setGeometry(GEOMETRY_RAWMODE, TECHO_DISPLAY_MODEL::WIDTH, TECHO_DISPLAY_MODEL::HEIGHT);
|
||||||
#elif defined(RAK4630)
|
#elif defined(RAK4630)
|
||||||
|
|
||||||
//GxEPD2_213_BN - RAK14000 2.13 inch b/w 250x122
|
// GxEPD2_213_BN - RAK14000 2.13 inch b/w 250x122
|
||||||
setGeometry(GEOMETRY_RAWMODE, 250, 122);
|
setGeometry(GEOMETRY_RAWMODE, 250, 122);
|
||||||
|
|
||||||
//GxEPD2_420_M01
|
// GxEPD2_420_M01
|
||||||
//setGeometry(GEOMETRY_RAWMODE, 300, 400);
|
// setGeometry(GEOMETRY_RAWMODE, 300, 400);
|
||||||
|
|
||||||
//GxEPD2_290_T5D
|
// GxEPD2_290_T5D
|
||||||
//setGeometry(GEOMETRY_RAWMODE, 296, 128);
|
// setGeometry(GEOMETRY_RAWMODE, 296, 128);
|
||||||
|
|
||||||
//GxEPD2_154_M09
|
// GxEPD2_154_M09
|
||||||
//setGeometry(GEOMETRY_RAWMODE, 200, 200);
|
// setGeometry(GEOMETRY_RAWMODE, 200, 200);
|
||||||
|
|
||||||
#elif defined(PCA10059)
|
#elif defined(PCA10059)
|
||||||
|
|
||||||
//GxEPD2_420_M01
|
// GxEPD2_420_M01
|
||||||
setGeometry(GEOMETRY_RAWMODE, 300, 400);
|
setGeometry(GEOMETRY_RAWMODE, 300, 400);
|
||||||
|
|
||||||
#elif defined(M5_COREINK)
|
#elif defined(M5_COREINK)
|
||||||
|
|
||||||
//M5Stack_CoreInk 200x200
|
// M5Stack_CoreInk 200x200
|
||||||
//1.54 inch 200x200 - GxEPD2_154_M09
|
// 1.54 inch 200x200 - GxEPD2_154_M09
|
||||||
setGeometry(GEOMETRY_RAWMODE, EPD_HEIGHT, EPD_WIDTH);
|
setGeometry(GEOMETRY_RAWMODE, EPD_HEIGHT, EPD_WIDTH);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// setGeometry(GEOMETRY_RAWMODE, 128, 64); // old resolution
|
// setGeometry(GEOMETRY_RAWMODE, 128, 64); // old resolution
|
||||||
// setGeometry(GEOMETRY_128_64); // We originally used this because I wasn't sure if rawmode worked - it does
|
// setGeometry(GEOMETRY_128_64); // We originally used this because I wasn't sure if rawmode worked - it does
|
||||||
}
|
}
|
||||||
@ -105,26 +106,26 @@ bool EInkDisplay::forceDisplay(uint32_t msecLimit)
|
|||||||
|
|
||||||
LOG_DEBUG("Updating E-Paper... ");
|
LOG_DEBUG("Updating E-Paper... ");
|
||||||
|
|
||||||
#if defined(TTGO_T_ECHO)
|
#if defined(TTGO_T_ECHO)
|
||||||
// ePaper.Reset(); // wake the screen from sleep
|
// ePaper.Reset(); // wake the screen from sleep
|
||||||
adafruitDisplay->display(false); // FIXME, use partial update mode
|
adafruitDisplay->display(false); // FIXME, use partial update mode
|
||||||
#elif defined(RAK4630)
|
#elif defined(RAK4630)
|
||||||
|
|
||||||
//RAK14000 2.13 inch b/w 250x122 actually now does support partial updates
|
// RAK14000 2.13 inch b/w 250x122 actually now does support partial updates
|
||||||
|
|
||||||
//Full update mode (slow)
|
// Full update mode (slow)
|
||||||
//adafruitDisplay->display(false); // FIXME, use partial update mode
|
// adafruitDisplay->display(false); // FIXME, use partial update mode
|
||||||
|
|
||||||
//Only enable for e-Paper with support for partial updates and comment out above adafruitDisplay->display(false);
|
// Only enable for e-Paper with support for partial updates and comment out above adafruitDisplay->display(false);
|
||||||
// 1.54 inch 200x200 - GxEPD2_154_M09
|
// 1.54 inch 200x200 - GxEPD2_154_M09
|
||||||
// 2.13 inch 250x122 - GxEPD2_213_BN
|
// 2.13 inch 250x122 - GxEPD2_213_BN
|
||||||
// 2.9 inch 296x128 - GxEPD2_290_T5D
|
// 2.9 inch 296x128 - GxEPD2_290_T5D
|
||||||
// 4.2 inch 300x400 - GxEPD2_420_M01
|
// 4.2 inch 300x400 - GxEPD2_420_M01
|
||||||
adafruitDisplay->nextPage();
|
adafruitDisplay->nextPage();
|
||||||
|
|
||||||
#elif defined(PCA10059) || defined(M5_COREINK)
|
#elif defined(PCA10059) || defined(M5_COREINK)
|
||||||
adafruitDisplay->nextPage();
|
adafruitDisplay->nextPage();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Put screen to sleep to save power (possibly not necessary because we already did poweroff inside of display)
|
// Put screen to sleep to save power (possibly not necessary because we already did poweroff inside of display)
|
||||||
adafruitDisplay->hibernate();
|
adafruitDisplay->hibernate();
|
||||||
@ -175,17 +176,16 @@ bool EInkDisplay::connect()
|
|||||||
pinMode(PIN_EINK_EN, OUTPUT);
|
pinMode(PIN_EINK_EN, OUTPUT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(TTGO_T_ECHO)
|
#if defined(TTGO_T_ECHO)
|
||||||
{
|
{
|
||||||
auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, SPI1);
|
auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY, SPI1);
|
||||||
|
|
||||||
adafruitDisplay = new GxEPD2_BW<TECHO_DISPLAY_MODEL, TECHO_DISPLAY_MODEL::HEIGHT>(*lowLevel);
|
adafruitDisplay = new GxEPD2_BW<TECHO_DISPLAY_MODEL, TECHO_DISPLAY_MODEL::HEIGHT>(*lowLevel);
|
||||||
adafruitDisplay->init();
|
adafruitDisplay->init();
|
||||||
adafruitDisplay->setRotation(3);
|
adafruitDisplay->setRotation(3);
|
||||||
}
|
}
|
||||||
#elif defined(RAK4630)
|
#elif defined(RAK4630)
|
||||||
{
|
{
|
||||||
if (eink_found) {
|
if (eink_found) {
|
||||||
auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY);
|
auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY);
|
||||||
|
|
||||||
@ -193,23 +193,23 @@ bool EInkDisplay::connect()
|
|||||||
|
|
||||||
adafruitDisplay->init(115200, true, 10, false, SPI1, SPISettings(4000000, MSBFIRST, SPI_MODE0));
|
adafruitDisplay->init(115200, true, 10, false, SPI1, SPISettings(4000000, MSBFIRST, SPI_MODE0));
|
||||||
|
|
||||||
//RAK14000 2.13 inch b/w 250x122 does actually now support partial updates
|
// RAK14000 2.13 inch b/w 250x122 does actually now support partial updates
|
||||||
adafruitDisplay->setRotation(3);
|
adafruitDisplay->setRotation(3);
|
||||||
//Partial update support for 1.54, 2.13 RAK14000 b/w , 2.9 and 4.2
|
// Partial update support for 1.54, 2.13 RAK14000 b/w , 2.9 and 4.2
|
||||||
//adafruitDisplay->setRotation(1);
|
// adafruitDisplay->setRotation(1);
|
||||||
adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight);
|
adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight);
|
||||||
} else {
|
} else {
|
||||||
(void)adafruitDisplay;
|
(void)adafruitDisplay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif defined(PCA10059)
|
#elif defined(PCA10059)
|
||||||
{
|
{
|
||||||
auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY);
|
auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY);
|
||||||
adafruitDisplay = new GxEPD2_BW<TECHO_DISPLAY_MODEL, TECHO_DISPLAY_MODEL::HEIGHT>(*lowLevel);
|
adafruitDisplay = new GxEPD2_BW<TECHO_DISPLAY_MODEL, TECHO_DISPLAY_MODEL::HEIGHT>(*lowLevel);
|
||||||
adafruitDisplay->init(115200, true, 10, false, SPI1, SPISettings(4000000, MSBFIRST, SPI_MODE0));
|
adafruitDisplay->init(115200, true, 10, false, SPI1, SPISettings(4000000, MSBFIRST, SPI_MODE0));
|
||||||
adafruitDisplay->setRotation(3);
|
adafruitDisplay->setRotation(3);
|
||||||
adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight);
|
adafruitDisplay->setPartialWindow(0, 0, displayWidth, displayHeight);
|
||||||
}
|
}
|
||||||
#elif defined(M5_COREINK)
|
#elif defined(M5_COREINK)
|
||||||
auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY);
|
auto lowLevel = new TECHO_DISPLAY_MODEL(PIN_EINK_CS, PIN_EINK_DC, PIN_EINK_RES, PIN_EINK_BUSY);
|
||||||
adafruitDisplay = new GxEPD2_BW<TECHO_DISPLAY_MODEL, TECHO_DISPLAY_MODEL::HEIGHT>(*lowLevel);
|
adafruitDisplay = new GxEPD2_BW<TECHO_DISPLAY_MODEL, TECHO_DISPLAY_MODEL::HEIGHT>(*lowLevel);
|
||||||
@ -218,11 +218,10 @@ bool EInkDisplay::connect()
|
|||||||
adafruitDisplay->setPartialWindow(0, 0, EPD_WIDTH, EPD_HEIGHT);
|
adafruitDisplay->setPartialWindow(0, 0, EPD_WIDTH, EPD_HEIGHT);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// adafruitDisplay->setFullWindow();
|
||||||
//adafruitDisplay->setFullWindow();
|
// adafruitDisplay->fillScreen(UNCOLORED);
|
||||||
//adafruitDisplay->fillScreen(UNCOLORED);
|
// adafruitDisplay->drawCircle(100, 100, 20, COLORED);
|
||||||
//adafruitDisplay->drawCircle(100, 100, 20, COLORED);
|
// adafruitDisplay->display(false);
|
||||||
//adafruitDisplay->display(false);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ class EInkDisplay : public OLEDDisplay
|
|||||||
/* constructor
|
/* constructor
|
||||||
FIXME - the parameters are not used, just a temporary hack to keep working like the old displays
|
FIXME - the parameters are not used, just a temporary hack to keep working like the old displays
|
||||||
*/
|
*/
|
||||||
EInkDisplay(uint8_t address, int sda, int scl);
|
EInkDisplay(uint8_t address, int sda, int scl, uint8_t screen_model);
|
||||||
|
|
||||||
// Write the buffer to the display memory (for eink we only do this occasionally)
|
// Write the buffer to the display memory (for eink we only do this occasionally)
|
||||||
virtual void display(void) override;
|
virtual void display(void) override;
|
||||||
@ -50,5 +50,3 @@ class EInkDisplay : public OLEDDisplay
|
|||||||
// Connect to the display
|
// Connect to the display
|
||||||
virtual bool connect() override;
|
virtual bool connect() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -908,7 +908,10 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// #else
|
// #else
|
||||||
Screen::Screen(uint8_t address, int sda, int scl) : OSThread("Screen"), cmdQueue(32), dispdev(address, sda, scl), ui(&dispdev)
|
Screen::Screen(uint8_t address, int sda, int scl)
|
||||||
|
: OSThread("Screen"), cmdQueue(32),
|
||||||
|
dispdev(address, sda, scl, screen_model == Config_DisplayConfig_OledType_OLED_SH1107 ? GEOMETRY_128_128 : GEOMETRY_128_64),
|
||||||
|
ui(&dispdev)
|
||||||
{
|
{
|
||||||
address_found = address;
|
address_found = address;
|
||||||
cmdQueue.setReader(this);
|
cmdQueue.setReader(this);
|
||||||
@ -958,6 +961,8 @@ void Screen::setup()
|
|||||||
useDisplay = true;
|
useDisplay = true;
|
||||||
|
|
||||||
#ifdef AutoOLEDWire_h
|
#ifdef AutoOLEDWire_h
|
||||||
|
if (screen_model == Config_DisplayConfig_OledType_OLED_SH1107)
|
||||||
|
screen_model = Config_DisplayConfig_OledType_OLED_SH1106;
|
||||||
dispdev.setDetected(screen_model);
|
dispdev.setDetected(screen_model);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -10,12 +10,12 @@ namespace graphics
|
|||||||
class Screen
|
class Screen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Screen(char){}
|
explicit Screen(char) {}
|
||||||
void onPress() {}
|
void onPress() {}
|
||||||
void setup() {}
|
void setup() {}
|
||||||
void setOn(bool) {}
|
void setOn(bool) {}
|
||||||
void print(const char*){}
|
void print(const char *) {}
|
||||||
void adjustBrightness(){}
|
void adjustBrightness() {}
|
||||||
void doDeepSleep() {}
|
void doDeepSleep() {}
|
||||||
void forceDisplay() {}
|
void forceDisplay() {}
|
||||||
void startBluetoothPinScreen(uint32_t pin) {}
|
void startBluetoothPinScreen(uint32_t pin) {}
|
||||||
@ -23,7 +23,7 @@ class Screen
|
|||||||
void startRebootScreen() {}
|
void startRebootScreen() {}
|
||||||
void startFirmwareUpdateScreen() {}
|
void startFirmwareUpdateScreen() {}
|
||||||
};
|
};
|
||||||
}
|
} // namespace graphics
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -34,7 +34,7 @@ class Screen
|
|||||||
|
|
||||||
#ifdef USE_ST7567
|
#ifdef USE_ST7567
|
||||||
#include <ST7567Wire.h>
|
#include <ST7567Wire.h>
|
||||||
#elif defined(USE_SH1106)
|
#elif defined(USE_SH1106) || defined(USE_SH1107)
|
||||||
#include <SH1106Wire.h>
|
#include <SH1106Wire.h>
|
||||||
#elif defined(USE_SSD1306)
|
#elif defined(USE_SSD1306)
|
||||||
#include <SSD1306Wire.h>
|
#include <SSD1306Wire.h>
|
||||||
@ -49,9 +49,9 @@ class Screen
|
|||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
#include "concurrency/LockGuard.h"
|
#include "concurrency/LockGuard.h"
|
||||||
#include "concurrency/OSThread.h"
|
#include "concurrency/OSThread.h"
|
||||||
|
#include "mesh/MeshModule.h"
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "mesh/MeshModule.h"
|
|
||||||
|
|
||||||
// 0 to 255, though particular variants might define different defaults
|
// 0 to 255, though particular variants might define different defaults
|
||||||
#ifndef BRIGHTNESS_DEFAULT
|
#ifndef BRIGHTNESS_DEFAULT
|
||||||
@ -132,7 +132,8 @@ class Screen : public concurrency::OSThread
|
|||||||
void setOn(bool on)
|
void setOn(bool on)
|
||||||
{
|
{
|
||||||
if (!on)
|
if (!on)
|
||||||
handleSetOn(false); // We handle off commands immediately, because they might be called because the CPU is shutting down
|
handleSetOn(
|
||||||
|
false); // We handle off commands immediately, because they might be called because the CPU is shutting down
|
||||||
else
|
else
|
||||||
enqueueCmd(ScreenCmd{.cmd = on ? Cmd::SET_ON : Cmd::SET_OFF});
|
enqueueCmd(ScreenCmd{.cmd = on ? Cmd::SET_ON : Cmd::SET_OFF});
|
||||||
}
|
}
|
||||||
@ -232,18 +233,22 @@ class Screen : public concurrency::OSThread
|
|||||||
return (uint8_t)(ch | 0xC0);
|
return (uint8_t)(ch | 0xC0);
|
||||||
}
|
}
|
||||||
// map UTF-8 cyrillic chars to it Windows-1251 (CP-1251) ASCII codes
|
// map UTF-8 cyrillic chars to it Windows-1251 (CP-1251) ASCII codes
|
||||||
// note: in this case we must use compatible font - provided ArialMT_Plain_10/16/24 by 'ThingPulse/esp8266-oled-ssd1306' library
|
// note: in this case we must use compatible font - provided ArialMT_Plain_10/16/24 by 'ThingPulse/esp8266-oled-ssd1306'
|
||||||
// have empty chars for non-latin ASCII symbols
|
// library have empty chars for non-latin ASCII symbols
|
||||||
case 0xD0: {
|
case 0xD0: {
|
||||||
SKIPREST = false;
|
SKIPREST = false;
|
||||||
if (ch == 129) return (uint8_t)(168); // Ё
|
if (ch == 129)
|
||||||
if (ch > 143 && ch < 192) return (uint8_t)(ch + 48);
|
return (uint8_t)(168); // Ё
|
||||||
|
if (ch > 143 && ch < 192)
|
||||||
|
return (uint8_t)(ch + 48);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0xD1: {
|
case 0xD1: {
|
||||||
SKIPREST = false;
|
SKIPREST = false;
|
||||||
if (ch == 145) return (uint8_t)(184); // ё
|
if (ch == 145)
|
||||||
if (ch > 127 && ch < 144) return (uint8_t)(ch + 112);
|
return (uint8_t)(184); // ё
|
||||||
|
if (ch > 127 && ch < 144)
|
||||||
|
return (uint8_t)(ch + 112);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -342,10 +347,7 @@ class Screen : public concurrency::OSThread
|
|||||||
|
|
||||||
/// Display device
|
/// Display device
|
||||||
|
|
||||||
// #ifdef RAK4630
|
#if defined(USE_SH1106) || defined(USE_SH1107)
|
||||||
// EInkDisplay dispdev;
|
|
||||||
// AutoOLEDWire dispdev_oled;
|
|
||||||
#ifdef USE_SH1106
|
|
||||||
SH1106Wire dispdev;
|
SH1106Wire dispdev;
|
||||||
#elif defined(USE_SSD1306)
|
#elif defined(USE_SSD1306)
|
||||||
SSD1306Wire dispdev;
|
SSD1306Wire dispdev;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
static TFT_eSPI tft = TFT_eSPI(); // Invoke library, pins defined in User_Setup.h
|
static TFT_eSPI tft = TFT_eSPI(); // Invoke library, pins defined in User_Setup.h
|
||||||
|
|
||||||
TFTDisplay::TFTDisplay(uint8_t address, int sda, int scl)
|
TFTDisplay::TFTDisplay(uint8_t address, int sda, int scl, uint8_t screen_model)
|
||||||
{
|
{
|
||||||
#ifdef SCREEN_ROTATE
|
#ifdef SCREEN_ROTATE
|
||||||
setGeometry(GEOMETRY_RAWMODE, TFT_HEIGHT, TFT_WIDTH);
|
setGeometry(GEOMETRY_RAWMODE, TFT_HEIGHT, TFT_WIDTH);
|
||||||
@ -22,7 +22,7 @@ void TFTDisplay::display(void)
|
|||||||
{
|
{
|
||||||
concurrency::LockGuard g(spiLock);
|
concurrency::LockGuard g(spiLock);
|
||||||
|
|
||||||
uint16_t x,y;
|
uint16_t x, y;
|
||||||
|
|
||||||
for (y = 0; y < displayHeight; y++) {
|
for (y = 0; y < displayHeight; y++) {
|
||||||
for (x = 0; x < displayWidth; x++) {
|
for (x = 0; x < displayWidth; x++) {
|
||||||
|
@ -18,7 +18,7 @@ class TFTDisplay : public OLEDDisplay
|
|||||||
/* constructor
|
/* constructor
|
||||||
FIXME - the parameters are not used, just a temporary hack to keep working like the old displays
|
FIXME - the parameters are not used, just a temporary hack to keep working like the old displays
|
||||||
*/
|
*/
|
||||||
TFTDisplay(uint8_t address, int sda, int scl);
|
TFTDisplay(uint8_t address, int sda, int scl, uint8_t screen_model);
|
||||||
|
|
||||||
// Write the buffer to the display memory
|
// Write the buffer to the display memory
|
||||||
virtual void display(void) override;
|
virtual void display(void) override;
|
||||||
|
22
src/main.cpp
22
src/main.cpp
@ -3,12 +3,12 @@
|
|||||||
#include "MeshService.h"
|
#include "MeshService.h"
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "PowerFSM.h"
|
#include "PowerFSM.h"
|
||||||
|
#include "ReliableRouter.h"
|
||||||
#include "airtime.h"
|
#include "airtime.h"
|
||||||
#include "buzz.h"
|
#include "buzz.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
#include "ReliableRouter.h"
|
|
||||||
// #include "debug.h"
|
// #include "debug.h"
|
||||||
#include "FSCommon.h"
|
#include "FSCommon.h"
|
||||||
#include "RTC.h"
|
#include "RTC.h"
|
||||||
@ -27,8 +27,8 @@
|
|||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
// #include <driver/rtc_io.h>
|
// #include <driver/rtc_io.h>
|
||||||
|
|
||||||
#include "mesh/http/WiFiAPClient.h"
|
|
||||||
#include "mesh/eth/ethClient.h"
|
#include "mesh/eth/ethClient.h"
|
||||||
|
#include "mesh/http/WiFiAPClient.h"
|
||||||
|
|
||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
#include "mesh/http/WebServer.h"
|
#include "mesh/http/WebServer.h"
|
||||||
@ -98,7 +98,8 @@ uint32_t serialSinceMsec;
|
|||||||
bool pmu_found;
|
bool pmu_found;
|
||||||
|
|
||||||
// Array map of sensor types (as array index) and i2c address as value we'll find in the i2c scan
|
// Array map of sensor types (as array index) and i2c address as value we'll find in the i2c scan
|
||||||
uint8_t nodeTelemetrySensorsMap[_TelemetrySensorType_MAX + 1] = { 0 }; // one is enough, missing elements will be initialized to 0 anyway.
|
uint8_t nodeTelemetrySensorsMap[_TelemetrySensorType_MAX + 1] = {
|
||||||
|
0}; // one is enough, missing elements will be initialized to 0 anyway.
|
||||||
|
|
||||||
Router *router = NULL; // Users of router don't care what sort of subclass implements that API
|
Router *router = NULL; // Users of router don't care what sort of subclass implements that API
|
||||||
|
|
||||||
@ -249,12 +250,11 @@ void setup()
|
|||||||
powerStatus->observe(&power->newStatus);
|
powerStatus->observe(&power->newStatus);
|
||||||
power->setup(); // Must be after status handler is installed, so that handler gets notified of the initial configuration
|
power->setup(); // Must be after status handler is installed, so that handler gets notified of the initial configuration
|
||||||
|
|
||||||
|
|
||||||
#ifdef LILYGO_TBEAM_S3_CORE
|
#ifdef LILYGO_TBEAM_S3_CORE
|
||||||
// In T-Beam-S3-core, the I2C device cannot be scanned before power initialization, otherwise the device will be stuck
|
// In T-Beam-S3-core, the I2C device cannot be scanned before power initialization, otherwise the device will be stuck
|
||||||
// PCF8563 RTC in tbeam-s3 uses Wire1 to share I2C bus
|
// PCF8563 RTC in tbeam-s3 uses Wire1 to share I2C bus
|
||||||
Wire1.beginTransmission(PCF8563_RTC);
|
Wire1.beginTransmission(PCF8563_RTC);
|
||||||
if (Wire1.endTransmission() == 0){
|
if (Wire1.endTransmission() == 0) {
|
||||||
rtc_found = PCF8563_RTC;
|
rtc_found = PCF8563_RTC;
|
||||||
LOG_INFO("PCF8563 RTC found\n");
|
LOG_INFO("PCF8563 RTC found\n");
|
||||||
}
|
}
|
||||||
@ -305,6 +305,10 @@ void setup()
|
|||||||
if (config.display.oled != Config_DisplayConfig_OledType_OLED_AUTO)
|
if (config.display.oled != Config_DisplayConfig_OledType_OLED_AUTO)
|
||||||
screen_model = config.display.oled;
|
screen_model = config.display.oled;
|
||||||
|
|
||||||
|
#if defined(USE_SH1107)
|
||||||
|
screen_model = Config_DisplayConfig_OledType_OLED_SH1107; // set dimension of 128x128
|
||||||
|
#endif
|
||||||
|
|
||||||
// Init our SPI controller (must be before screen and lora)
|
// Init our SPI controller (must be before screen and lora)
|
||||||
initSPI();
|
initSPI();
|
||||||
#ifndef ARCH_ESP32
|
#ifndef ARCH_ESP32
|
||||||
@ -448,18 +452,18 @@ void setup()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check if the radio chip matches the selected region
|
// check if the radio chip matches the selected region
|
||||||
|
|
||||||
if((config.lora.region == Config_LoRaConfig_RegionCode_LORA_24) && (!rIf->wideLora())){
|
if ((config.lora.region == Config_LoRaConfig_RegionCode_LORA_24) && (!rIf->wideLora())) {
|
||||||
LOG_WARN("Radio chip does not support 2.4GHz LoRa. Reverting to unset.\n");
|
LOG_WARN("Radio chip does not support 2.4GHz LoRa. Reverting to unset.\n");
|
||||||
config.lora.region = Config_LoRaConfig_RegionCode_UNSET;
|
config.lora.region = Config_LoRaConfig_RegionCode_UNSET;
|
||||||
nodeDB.saveToDisk(SEGMENT_CONFIG);
|
nodeDB.saveToDisk(SEGMENT_CONFIG);
|
||||||
if(!rIf->reconfigure()) {
|
if (!rIf->reconfigure()) {
|
||||||
LOG_WARN("Reconfigure failed, rebooting\n");
|
LOG_WARN("Reconfigure failed, rebooting\n");
|
||||||
screen->startRebootScreen();
|
screen->startRebootScreen();
|
||||||
rebootAtMsec = millis() + 5000;
|
rebootAtMsec = millis() + 5000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_WIFI || HAS_ETHERNET
|
#if HAS_WIFI || HAS_ETHERNET
|
||||||
mqttInit();
|
mqttInit();
|
||||||
|
Loading…
Reference in New Issue
Block a user