adds initial support for the display on the t-echo

This commit is contained in:
jeremy 2024-09-18 11:13:31 -04:00
parent 41dbdbe8d2
commit a2631b5685
4 changed files with 102 additions and 89 deletions

View File

@ -640,17 +640,17 @@
//#define HAS_EEPROM true
//#define HAS_SD true
#define HAS_DISPLAY true
#define DISPLAY EINK_BW
#define DISPLAY_MODEL GxEPD2_154_D67
//#define HAS_CONSOLE true
//#define HAS_TXCO true
//#define DISPLAY EINK_BW
//#define HAS_BLE true
//#define HAS_PMU true
#define CONFIG_UART_BUFFER_SIZE 40000
#define CONFIG_QUEUE_0_SIZE 6144
#define CONFIG_QUEUE_MAX_LENGTH 200
#define BLE_MANUFACTURER "LilyGO"
#define BLE_MODEL "T-Echo"
//#define BLE_MANUFACTURER "LilyGO"
//#define BLE_MODEL "T-Echo"
#define INTERFACE_COUNT 1
//#define I2C_SDA 26
//#define I2C_SCL 27
@ -689,6 +689,7 @@
const int pin_disp_en = 43;
const int pin_disp_sck = 31;
const int pin_disp_mosi = 29;
const int pin_disp_miso = -1;
const int pin_led_rx = LED_BLUE;

View File

@ -324,7 +324,8 @@ bool device_init() {
}
#else
// Skip hash comparison and checking BT
return true;
device_init_done = true;
return device_init_done;
#endif
}
#endif

179
Display.h
View File

@ -89,6 +89,15 @@ void busyCallback(const void* p) {
#define DISP_ADDR -1
#define DISPLAY_MODEL GxEPD2_213_Z98c
#endif
#elif BOARD_MODEL == BOARD_TECHO
#if DISPLAY == OLED
// todo: add support for OLED board
#elif DISPLAY == EINK_BW
SPIClass displaySPI = SPIClass(NRF_SPIM0, pin_disp_miso, pin_disp_sck, pin_disp_mosi);
#define DISP_W 250
#define DISP_H 122
#define DISP_ADDR -1
#endif
#else
#define DISP_RST -1
#define DISP_ADDR 0x3C
@ -101,31 +110,34 @@ void busyCallback(const void* p) {
#include "Graphics.h"
#if BOARD_MODEL != BOARD_RAK4631
// support for BOARD_RAK4631 OLED not implemented yet
#if DISPLAY == OLED
Adafruit_SSD1306 display(DISP_W, DISP_H, &Wire, DISP_RST);
float disp_target_fps = 7;
#define SCREENSAVER_TIME 500 // ms
uint32_t last_screensaver = 0;
#define SCREENSAVER_INTERVAL 600000 // 10 minutes in ms
bool screensaver_enabled = false;
#endif
#endif
#if BOARD_MODEL == BOARD_RAK4631
#if DISPLAY == EINK_BW
GxEPD2_BW<DISPLAY_MODEL, DISPLAY_MODEL::HEIGHT> display(DISPLAY_MODEL(pin_disp_cs, pin_disp_dc, pin_disp_reset, pin_disp_busy));
float disp_target_fps = 0.2;
uint32_t last_epd_refresh = 0;
#define REFRESH_PERIOD 300000 // 5 minutes in ms
#elif DISPLAY == EINK_3C
GxEPD2_3C<DISPLAY_MODEL, DISPLAY_MODEL::HEIGHT> display(DISPLAY_MODEL(pin_disp_cs, pin_disp_dc, pin_disp_reset, pin_disp_busy));
float disp_target_fps = 0.05; // refresh usually takes longer on 3C, hence this is 4x the BW refresh period
uint32_t last_epd_refresh = 0;
#define REFRESH_PERIOD 600000 // 10 minutes in ms
#endif
#if DISPLAY == EINK_BW
GxEPD2_BW<DISPLAY_MODEL, DISPLAY_MODEL::HEIGHT> display(DISPLAY_MODEL(pin_disp_cs, pin_disp_dc, pin_disp_reset, pin_disp_busy));
float disp_target_fps = 0.2;
uint32_t last_epd_refresh = 0;
#define REFRESH_PERIOD 300000 // 5 minutes in ms
#elif DISPLAY == EINK_3C
GxEPD2_3C<DISPLAY_MODEL, DISPLAY_MODEL::HEIGHT> display(DISPLAY_MODEL(pin_disp_cs, pin_disp_dc, pin_disp_reset, pin_disp_busy));
float disp_target_fps = 0.05; // refresh usually takes longer on 3C, hence this is 4x the BW refresh period
uint32_t last_epd_refresh = 0;
#define REFRESH_PERIOD 600000 // 10 minutes in ms
#endif
#elif BOARD_MODEL == BOARD_TECHO
#if DISPLAY == EINK_BW
GxEPD2_BW<DISPLAY_MODEL, DISPLAY_MODEL::HEIGHT> display(DISPLAY_MODEL(pin_disp_cs, pin_disp_dc, pin_disp_reset, pin_disp_busy));
float disp_target_fps = 0.2;
uint32_t last_epd_refresh = 0;
#define REFRESH_PERIOD 300000 // 5 minutes in ms
#endif
#else
// add more eink compatible boards here
#if DISPLAY == OLED
Adafruit_SSD1306 display(DISP_W, DISP_H, &Wire, DISP_RST);
float disp_target_fps = 7;
#define SCREENSAVER_TIME 500 // ms
uint32_t last_screensaver = 0;
#define SCREENSAVER_INTERVAL 600000 // 10 minutes in ms
bool screensaver_enabled = false;
#endif
#endif
#define DISP_MODE_UNKNOWN 0x00
@ -158,7 +170,7 @@ uint8_t online_interfaces = 0;
#if DISPLAY == OLED
#define WATERFALL_SIZE 46
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#define WATERFALL_SIZE 92
#else
// add more eink compatible boards here
@ -175,7 +187,7 @@ int p_as_y = 0;
#if DISPLAY == OLED
GFXcanvas1 stat_area(64, 64);
GFXcanvas1 disp_area(64, 64);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
GFXcanvas1 stat_area(DISP_H, DISP_W/2);
GFXcanvas1 disp_area(DISP_H, DISP_W/2);
#endif
@ -232,13 +244,10 @@ bool display_init() {
digitalWrite(pin_display_en, HIGH);
Wire.begin(SDA_OLED, SCL_OLED);
#elif BOARD_MODEL == BOARD_TECHO
#if DISPLAY == OLED
#elif DISPLAY == EINK_BW || DISPLAY == EINK_3C
pinMode(pin_disp_en, INPUT_PULLUP);
digitalWrite(pin_disp_en, HIGH);
SPIClass displaySPI();
displaySPI.begin(pin_display_sck, pin_display_miso, pin_display_mosi, pin_display_cs); // SCLK, MISO, MOSI, SS
//displaySPI.begin();
display.init(0, true, 10, false, displaySPI, SPISettings(4000000, MSBFIRST, SPI_MODE0));
display.setPartialWindow(0, 0, DISP_W, DISP_H);
@ -248,7 +257,6 @@ bool display_init() {
// waiting for the display to update, it will poll the serial buffer to
// check for any commands from the host.
display.epd2.setBusyCallback(busyCallback);
#endif
#elif BOARD_MODEL == BOARD_RAK4631
#if DISPLAY == OLED
#elif DISPLAY == EINK_BW || DISPLAY == EINK_3C
@ -280,7 +288,7 @@ bool display_init() {
#if DISPLAY == OLED
if(!display.begin(SSD1306_SWITCHCAPVCC, display_address)) {
#elif DISPLAY == EINK_BW || DISPLAY == EINK_3C
// don't check if display is actually connected
// don't display_ini check if display is actually connected
if(false) {
#endif
return false;
@ -314,6 +322,9 @@ bool display_init() {
#elif DISPLAY == EINK_BW || DISPLAY == EINK_3C
disp_mode = DISP_MODE_PORTRAIT;
#endif
#elif BOARD_MODEL == BOARD_TECHO
disp_mode = DISP_MODE_LANDSCAPE;
display.setRotation(3);
#elif BOARD_MODEL == BOARD_HELTEC32_V3
disp_mode = DISP_MODE_PORTRAIT;
// Antenna conx up
@ -350,13 +361,13 @@ void draw_cable_icon(int px, int py) {
if (cable_state == CABLE_STATE_DISCONNECTED) {
#if DISPLAY == OLED
stat_area.drawBitmap(px, py, bm_cable+0*32, 16, 16, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.drawBitmap(px, py, bm_cable+0*128, 30, 32, GxEPD_WHITE, GxEPD_BLACK);
#endif
} else if (cable_state == CABLE_STATE_CONNECTED) {
#if DISPLAY == OLED
stat_area.drawBitmap(px, py, bm_cable+1*32, 16, 16, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.drawBitmap(px, py, bm_cable+1*128, 30, 32, GxEPD_WHITE, GxEPD_BLACK);
#endif
}
@ -366,31 +377,31 @@ void draw_bt_icon(int px, int py) {
if (bt_state == BT_STATE_OFF) {
#if DISPLAY == OLED
stat_area.drawBitmap(px, py, bm_bt+0*32, 16, 16, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.drawBitmap(px, py, bm_bt+0*128, 30, 32, GxEPD_WHITE, GxEPD_BLACK);
#endif
} else if (bt_state == BT_STATE_ON) {
#if DISPLAY == OLED
stat_area.drawBitmap(px, py, bm_bt+1*32, 16, 16, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.drawBitmap(px, py, bm_bt+1*128, 30, 32, GxEPD_WHITE, GxEPD_BLACK);
#endif
} else if (bt_state == BT_STATE_PAIRING) {
#if DISPLAY == OLED
stat_area.drawBitmap(px, py, bm_bt+2*32, 16, 16, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.drawBitmap(px, py, bm_bt+2*128, 30, 32, GxEPD_WHITE, GxEPD_BLACK);
#endif
} else if (bt_state == BT_STATE_CONNECTED) {
#if DISPLAY == OLED
stat_area.drawBitmap(px, py, bm_bt+3*32, 16, 16, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.drawBitmap(px, py, bm_bt+3*128, 30, 32, GxEPD_WHITE, GxEPD_BLACK);
#endif
} else {
#if DISPLAY == OLED
stat_area.drawBitmap(px, py, bm_bt+0*32, 16, 16, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.drawBitmap(px, py, bm_bt+0*128, 30, 32, GxEPD_WHITE, GxEPD_BLACK);
#endif
}
@ -411,7 +422,7 @@ void draw_lora_icon(RadioInterface* radio, int px, int py) {
} else {
stat_area.drawBitmap(px, py, bm_rf+0*32, 16, 16, SSD1306_WHITE, SSD1306_BLACK);
}
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
if (online_interface_list[interface_page] != radio->getIndex()) {
stat_area.drawBitmap(px - 2, py - 2, bm_dot_sqr, 34, 36, GxEPD_WHITE, GxEPD_BLACK);
@ -427,7 +438,7 @@ void draw_lora_icon(RadioInterface* radio, int px, int py) {
} else {
#if DISPLAY == OLED
stat_area.drawBitmap(px, py, bm_rf+0*32, 16, 16, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.drawBitmap(px, py, bm_rf+0*128, 30, 32, GxEPD_WHITE, GxEPD_BLACK);
#endif
}
@ -438,20 +449,20 @@ void draw_mw_icon(int px, int py) {
if (interface_obj[1]->getRadioOnline()) {
#if DISPLAY == OLED
stat_area.drawBitmap(px, py, bm_rf+3*32, 16, 16, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.drawBitmap(px, py, bm_rf+3*128, 30, 32, GxEPD_WHITE, GxEPD_BLACK);
#endif
} else {
#if DISPLAY == OLED
stat_area.drawBitmap(px, py, bm_rf+2*32, 16, 16, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.drawBitmap(px, py, bm_rf+2*128, 30, 32, GxEPD_WHITE, GxEPD_BLACK);
#endif
}
} else {
#if DISPLAY == OLED
stat_area.drawBitmap(px, py, bm_rf+2*32, 16, 16, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.drawBitmap(px, py, bm_rf+2*128, 30, 32, GxEPD_WHITE, GxEPD_BLACK);
#endif
}
@ -474,7 +485,7 @@ void draw_battery_bars(int px, int py) {
#if DISPLAY == OLED
stat_area.fillRect(px-2, py-2, 18, 7, SSD1306_BLACK);
stat_area.drawBitmap(px-2, py-2, bm_plug, 17, 7, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.fillRect(px-2, py-2, 24, 9, GxEPD_BLACK);
stat_area.drawBitmap(px-2, py-5, bm_plug, 34, 13, GxEPD_WHITE, GxEPD_BLACK);
#endif
@ -483,7 +494,7 @@ void draw_battery_bars(int px, int py) {
#if DISPLAY == OLED
stat_area.fillRect(px-2, py-2, 18, 7, SSD1306_BLACK);
stat_area.drawBitmap(px-2, py-2, bm_plug, 17, 7, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.fillRect(px-2, py-2, 24, 9, GxEPD_BLACK);
stat_area.drawBitmap(px-2, py-5, bm_plug, 34, 13, GxEPD_WHITE, GxEPD_BLACK);
#endif
@ -500,7 +511,7 @@ void draw_battery_bars(int px, int py) {
if (battery_value > 59) stat_area.drawLine(px+4*2, py, px+4*2, py+2, SSD1306_WHITE);
if (battery_value > 72) stat_area.drawLine(px+5*2, py, px+5*2, py+2, SSD1306_WHITE);
if (battery_value > 85) stat_area.drawLine(px+6*2, py, px+6*2, py+2, SSD1306_WHITE);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.fillRect(px, py, 20, 5, GxEPD_BLACK);
stat_area.fillRect(px-2, py-4, 34, 19, GxEPD_BLACK);
stat_area.drawRect(px-2, py-2, 23, 9, GxEPD_WHITE);
@ -522,7 +533,7 @@ void draw_battery_bars(int px, int py) {
#if DISPLAY == OLED
stat_area.fillRect(px-2, py-2, 18, 7, SSD1306_BLACK);
stat_area.drawBitmap(px-2, py-2, bm_plug, 17, 7, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.fillRect(px-2, py-2, 24, 9, GxEPD_BLACK);
stat_area.drawBitmap(px-2, py-5, bm_plug, 34, 13, GxEPD_WHITE, GxEPD_BLACK);
#endif
@ -532,7 +543,7 @@ void draw_battery_bars(int px, int py) {
#if DISPLAY == OLED
stat_area.fillRect(px-2, py-2, 18, 7, SSD1306_BLACK);
stat_area.drawBitmap(px-2, py-2, bm_plug, 17, 7, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.fillRect(px-2, py-2, 24, 9, GxEPD_BLACK);
stat_area.drawBitmap(px-2, py-5, bm_plug, 34, 13, GxEPD_WHITE, GxEPD_BLACK);
#endif
@ -561,7 +572,7 @@ void draw_quality_bars(int px, int py) {
if (quality > 60) stat_area.drawLine(px+4*2, py+7, px+4*2, py+2, SSD1306_WHITE);
if (quality > 75) stat_area.drawLine(px+5*2, py+7, px+5*2, py+1, SSD1306_WHITE);
if (quality > 90) stat_area.drawLine(px+6*2, py+7, px+6*2, py+0, SSD1306_WHITE);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.fillRect(px, py, 26, 14, GxEPD_BLACK);
if (quality > 0) {
stat_area.drawLine(px+0*4, py+14, px+0*4, py+6, GxEPD_WHITE);
@ -616,7 +627,7 @@ void draw_signal_bars(int px, int py) {
if (signal > 33) stat_area.drawLine(px+4*2, py+7, px+4*2, py+4, SSD1306_WHITE);
if (signal > 20) stat_area.drawLine(px+5*2, py+7, px+5*2, py+5, SSD1306_WHITE);
if (signal > 7) stat_area.drawLine(px+6*2, py+7, px+6*2, py+6, SSD1306_WHITE);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.fillRect(px, py, 26, 14, GxEPD_BLACK);
if (signal > 85) {
stat_area.drawLine(px+0*4, py+14, px+0*4, py+0, GxEPD_WHITE);
@ -655,7 +666,7 @@ void draw_signal_bars(int px, int py) {
#define WF_RSSI_SPAN (WF_RSSI_MAX-WF_RSSI_MIN)
#if DISPLAY == OLED
#define WF_PIXEL_WIDTH 10
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#define WF_PIXEL_WIDTH 22
#endif
void draw_waterfall(int px, int py) {
@ -669,7 +680,7 @@ void draw_waterfall(int px, int py) {
#if DISPLAY == OLED
stat_area.fillRect(px,py,WF_PIXEL_WIDTH, WATERFALL_SIZE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.fillRect(px,py,WF_PIXEL_WIDTH, WATERFALL_SIZE, GxEPD_BLACK);
#endif
for (int i = 0; i < WATERFALL_SIZE; i++){
@ -678,7 +689,7 @@ void draw_waterfall(int px, int py) {
if (ws > 0) {
#if DISPLAY == OLED
stat_area.drawLine(px, py+i, px+ws-1, py+i, SSD1306_WHITE);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.drawLine(px, py+i, px+ws-1, py+i, GxEPD_WHITE);
#endif
}
@ -690,7 +701,7 @@ void draw_stat_area() {
if (!stat_area_initialised) {
#if DISPLAY == OLED
stat_area.drawBitmap(0, 0, bm_frame, 64, 64, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.drawBitmap(0, 0, bm_frame, stat_area.width(), stat_area.height(), GxEPD_WHITE, GxEPD_BLACK);
#endif
stat_area_initialised = true;
@ -741,7 +752,7 @@ void draw_stat_area() {
draw_lora_icon(interface_obj[1], 45, 30);
}
draw_battery_bars(4, 58);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
draw_cable_icon(6, 18);
draw_bt_icon(6, 60);
draw_lora_icon(interface_obj[0], 86, 18);
@ -764,7 +775,7 @@ void draw_stat_area() {
draw_quality_bars(28, 56);
draw_signal_bars(44, 56);
draw_waterfall(27, 4);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
draw_quality_bars(53, 109);
draw_signal_bars(83, 109);
draw_waterfall(50, 8);
@ -779,14 +790,14 @@ void update_stat_area() {
if (disp_mode == DISP_MODE_PORTRAIT) {
#if DISPLAY == OLED
display.drawBitmap(p_as_x, p_as_y, stat_area.getBuffer(), stat_area.width(), stat_area.height(), SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
display.drawBitmap(p_as_x, p_as_y, stat_area.getBuffer(), stat_area.width(), stat_area.height(), GxEPD_WHITE, GxEPD_BLACK);
#endif
} else if (disp_mode == DISP_MODE_LANDSCAPE) {
#if DISPLAY == OLED
display.drawBitmap(p_as_x+2, p_as_y, stat_area.getBuffer(), stat_area.width(), stat_area.height(), SSD1306_WHITE, SSD1306_BLACK);
if (device_init_done && !disp_ext_fb) display.drawLine(p_as_x, 0, p_as_x, 64, SSD1306_WHITE);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
display.drawBitmap(p_as_x+2, p_as_y, stat_area.getBuffer(), stat_area.width(), stat_area.height(), GxEPD_WHITE, GxEPD_BLACK);
if (device_init_done && !disp_ext_fb) display.drawLine(p_as_x, 0, p_as_x, DISP_W/2, GxEPD_WHITE);
#endif
@ -796,19 +807,19 @@ void update_stat_area() {
if (firmware_update_mode) {
#if DISPLAY == OLED
display.drawBitmap(p_as_x, p_as_y, bm_updating, stat_area.width(), stat_area.height(), SSD1306_BLACK, SSD1306_WHITE);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
display.drawBitmap(p_as_x, p_as_y, bm_updating, stat_area.width(), stat_area.height(), GxEPD_BLACK, GxEPD_WHITE);
#endif
} else if (console_active && device_init_done) {
#if DISPLAY == OLED
display.drawBitmap(p_as_x, p_as_y, bm_console, stat_area.width(), stat_area.height(), SSD1306_BLACK, SSD1306_WHITE);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
display.drawBitmap(p_as_x, p_as_y, bm_console, stat_area.width(), stat_area.height(), GxEPD_BLACK, GxEPD_WHITE);
#endif
if (disp_mode == DISP_MODE_LANDSCAPE) {
#if DISPLAY == OLED
display.drawLine(p_as_x, 0, p_as_x, 64, SSD1306_WHITE);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
display.drawLine(p_as_x, 0, p_as_x, DISP_W/2, GxEPD_WHITE);
#endif
}
@ -823,14 +834,14 @@ void draw_disp_area() {
p_by = 18;
#if DISPLAY == OLED
disp_area.fillRect(0, 0, disp_area.width(), disp_area.height(), SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
disp_area.fillRect(0, 0, disp_area.width(), disp_area.height(), GxEPD_BLACK);
#endif
}
#if DISPLAY == OLED
if (!device_init_done) disp_area.drawBitmap(0, p_by, bm_boot, disp_area.width(), 27, SSD1306_WHITE, SSD1306_BLACK);
if (firmware_update_mode) disp_area.drawBitmap(0, p_by, bm_fw_update, disp_area.width(), 27, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
if (!device_init_done) disp_area.drawBitmap(0, p_by, bm_boot, disp_area.width(), 54, GxEPD_WHITE);
if (firmware_update_mode) disp_area.drawBitmap(0, p_by, bm_fw_update, disp_area.width(), 54, GxEPD_WHITE, GxEPD_BLACK);
#endif
@ -893,7 +904,7 @@ void draw_disp_area() {
}
disp_area.drawBitmap(32+2, 50, bm_hg_high, 5, 9, SSD1306_BLACK, SSD1306_WHITE);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
selected_radio = interface_obj[online_interface_list[interface_page]];
disp_area.fillRect(0,12,disp_area.width(),57, GxEPD_BLACK); disp_area.fillRect(0,69,disp_area.width(),56, GxEPD_WHITE);
disp_area.setFont(SMALL_FONT); disp_area.setTextWrap(false); disp_area.setTextColor(GxEPD_WHITE);
@ -954,13 +965,13 @@ void draw_disp_area() {
if (device_signatures_ok()) {
#if DISPLAY == OLED
disp_area.drawBitmap(0, 0, bm_def_lc, disp_area.width(), 37, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
disp_area.drawBitmap(0, 0, bm_def_lc, disp_area.width(), 71, GxEPD_WHITE, GxEPD_BLACK);
#endif
} else {
#if DISPLAY == OLED
disp_area.drawBitmap(0, 0, bm_def, disp_area.width(), 37, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
disp_area.drawBitmap(0, 0, bm_def, disp_area.width(), 71, GxEPD_WHITE, GxEPD_BLACK);
#endif
}
@ -970,20 +981,20 @@ void draw_disp_area() {
if (!device_firmware_ok()) {
#if DISPLAY == OLED
disp_area.drawBitmap(0, 37, bm_fw_corrupt, disp_area.width(), 27, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
disp_area.drawBitmap(0, 71, bm_fw_corrupt, disp_area.width(), 54, GxEPD_WHITE, GxEPD_BLACK);
#endif
} else {
if (!modems_installed) {
#if DISPLAY == OLED
disp_area.drawBitmap(0, 37, bm_no_radio, disp_area.width(), 27, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
disp_area.drawBitmap(0, 71, bm_no_radio, disp_area.width(), 54, GxEPD_WHITE, GxEPD_BLACK);
#endif
} else {
#if DISPLAY == OLED
disp_area.drawBitmap(0, 37, bm_hwfail, disp_area.width(), 27, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
disp_area.drawBitmap(0, 71, bm_hwfail, disp_area.width(), 54, GxEPD_WHITE, GxEPD_BLACK);
#endif
}
@ -994,7 +1005,7 @@ void draw_disp_area() {
#if DISPLAY == OLED
disp_area.drawBitmap(0, 37, bm_pairing, disp_area.width(), 27, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
disp_area.drawBitmap(0, 71, bm_pairing, disp_area.width(), 54, GxEPD_WHITE, GxEPD_BLACK);
#endif
for (int i = 0; i < DISP_PIN_SIZE; i++) {
@ -1002,7 +1013,7 @@ void draw_disp_area() {
#if DISPLAY == OLED
uint8_t offset = numeric*5;
disp_area.drawBitmap(7+9*i, 37+16, bm_n_uh+offset, 8, 5, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
uint8_t offset = numeric*20;
disp_area.drawBitmap(14+17*i, 71+32, bm_n_uh+offset, 10, 10, GxEPD_WHITE, GxEPD_BLACK);
#endif
@ -1019,7 +1030,7 @@ void draw_disp_area() {
if (!display_diagnostics) {
#if DISPLAY == OLED
disp_area.drawBitmap(0, 37, bm_online, disp_area.width(), 27, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
disp_area.drawBitmap(0, 71, bm_online, disp_area.width(), 54, GxEPD_WHITE, GxEPD_BLACK);
#endif
}
@ -1028,13 +1039,13 @@ void draw_disp_area() {
if (true || device_signatures_ok()) {
#if DISPLAY == OLED
disp_area.drawBitmap(0, 37, bm_checks, disp_area.width(), 27, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
disp_area.drawBitmap(0, 71, bm_checks, disp_area.width(), 54, GxEPD_WHITE, GxEPD_BLACK);
#endif
} else {
#if DISPLAY == OLED
disp_area.drawBitmap(0, 37, bm_nfr, disp_area.width(), 27, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
disp_area.drawBitmap(0, 71, bm_nfr, disp_area.width(), 54, GxEPD_WHITE, GxEPD_BLACK);
#endif
}
@ -1042,20 +1053,20 @@ void draw_disp_area() {
if (!console_active) {
#if DISPLAY == OLED
disp_area.drawBitmap(0, 37, bm_hwok, disp_area.width(), 27, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
disp_area.drawBitmap(0, 71, bm_hwok, disp_area.width(), 54, GxEPD_WHITE, GxEPD_BLACK);
#endif
} else {
#if DISPLAY == OLED
disp_area.drawBitmap(0, 37, bm_console_active, disp_area.width(), 27, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
disp_area.drawBitmap(0, 71, bm_console_active, disp_area.width(), 54, GxEPD_WHITE, GxEPD_BLACK);
#endif
}
} else if (disp_page == 2) {
#if DISPLAY == OLED
disp_area.drawBitmap(0, 37, bm_version, disp_area.width(), 27, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
disp_area.drawBitmap(0, 71, bm_version, disp_area.width(), 54, GxEPD_WHITE, GxEPD_BLACK);
#endif
char *v_str = (char*)malloc(3+1);
@ -1065,7 +1076,7 @@ void draw_disp_area() {
uint8_t dxp = 20;
uint8_t numeric = v_str[i]-48; uint8_t bm_offset = numeric*5;
if (i == 2) dxp += 9*2+4;
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
uint8_t dxp = 43;
uint8_t numeric = v_str[i]-48; uint8_t bm_offset = numeric*20;
if (i == 2) dxp += 9*2+6;
@ -1073,7 +1084,7 @@ void draw_disp_area() {
if (i == 1) dxp += 9*1+4;
#if DISPLAY == OLED
disp_area.drawBitmap(dxp, 37+16, bm_n_uh+bm_offset, 8, 5, SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
// add gap manually rather than oversizing bitmap, as the gfx lib fills in the extra space with black
disp_area.drawBitmap(dxp, 71+32, bm_n_uh+bm_offset, 10, 10, GxEPD_WHITE, GxEPD_BLACK);
#endif
@ -1082,7 +1093,7 @@ void draw_disp_area() {
#if DISPLAY == OLED
disp_area.drawLine(27, 37+19, 28, 37+19, SSD1306_BLACK);
disp_area.drawLine(27, 37+19, 28, 37+19, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
disp_area.drawLine(27, 37+20, 28, 37+20, GxEPD_BLACK);
disp_area.drawLine(27, 37+20, 28, 37+20, GxEPD_BLACK);
#endif
@ -1092,7 +1103,7 @@ void draw_disp_area() {
} else {
#if DISPLAY == OLED
disp_area.drawBitmap(0, 0, fb, disp_area.width(), disp_area.height(), SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
disp_area.drawBitmap(0, 0, fb, disp_area.width(), disp_area.height(), GxEPD_WHITE, GxEPD_BLACK);
#endif
}
@ -1103,14 +1114,14 @@ void update_disp_area() {
draw_disp_area();
#if DISPLAY == OLED
display.drawBitmap(p_ad_x, p_ad_y, disp_area.getBuffer(), disp_area.width(), disp_area.height(), SSD1306_WHITE, SSD1306_BLACK);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
display.drawBitmap(p_ad_x, p_ad_y, disp_area.getBuffer(), disp_area.width(), disp_area.height(), GxEPD_WHITE, GxEPD_BLACK);
#endif
if (disp_mode == DISP_MODE_LANDSCAPE) {
if (device_init_done && !firmware_update_mode && !disp_ext_fb) {
#if DISPLAY == OLED
display.drawLine(0, 0, 0, 63, SSD1306_WHITE);
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
display.drawLine(0, 0, 0, 63, GxEPD_WHITE);
#endif
}
@ -1152,7 +1163,7 @@ void update_display(bool blank = false) {
display.invertDisplay(1);
screensaver_enabled = true;
}
#elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
display.setFullWindow();
display.fillScreen(GxEPD_WHITE);
update_stat_area();

View File

@ -408,7 +408,7 @@ const unsigned char bm_dot_sqr [] PROGMEM = {
0x80, 0x00, 0x40, 0x00, 0x00, 0x00, 0xaa, 0xd5, 0x40
};
#elif (DISP_H == 122 || DISP_H == 200)
#elif ((DISP_H == 122 || DISP_H == 200) || DISP_H == 200)
// use 122px wide graphics
const unsigned char bm_bt [] PROGMEM = {