WIP: T-ECHO DISPLAY

This commit is contained in:
jeremy 2024-09-25 21:23:24 -04:00
parent 5c764e6f50
commit 7dde795cd7
5 changed files with 22 additions and 7 deletions

View File

@ -632,6 +632,7 @@
#elif MCU_VARIANT == MCU_NRF52 #elif MCU_VARIANT == MCU_NRF52
#if BOARD_MODEL == BOARD_TECHO #if BOARD_MODEL == BOARD_TECHO
#define VALIDATE_FIRMWARE false #define VALIDATE_FIRMWARE false
#define HAS_INPUT true
//#define GPS_BAUD_RATE 115200 //#define GPS_BAUD_RATE 115200
//#define PIN_GPS_TX 41 //#define PIN_GPS_TX 41
//#define PIN_GPS_RX 40 //#define PIN_GPS_RX 40
@ -691,6 +692,9 @@
const int pin_disp_mosi = 29; const int pin_disp_mosi = 29;
const int pin_disp_miso = -1; const int pin_disp_miso = -1;
#define HAS_BACKLIGHT true
const int pin_btn_usr1 = 42;
const int pin_backlight = 43;
const int pin_led_rx = LED_BLUE; const int pin_led_rx = LED_BLUE;
const int pin_led_tx = LED_RED; const int pin_led_tx = LED_RED;

View File

@ -94,7 +94,7 @@ void busyCallback(const void* p) {
// todo: add support for OLED board // todo: add support for OLED board
#elif DISPLAY == EINK_BW #elif DISPLAY == EINK_BW
SPIClass displaySPI = SPIClass(NRF_SPIM0, pin_disp_miso, pin_disp_sck, pin_disp_mosi); SPIClass displaySPI = SPIClass(NRF_SPIM0, pin_disp_miso, pin_disp_sck, pin_disp_mosi);
#define DISP_W 250 #define DISP_W 200
#define DISP_H 122 #define DISP_H 122
#define DISP_ADDR -1 #define DISP_ADDR -1
#endif #endif
@ -170,9 +170,10 @@ uint8_t online_interfaces = 0;
#if DISPLAY == OLED #if DISPLAY == OLED
#define WATERFALL_SIZE 46 #define WATERFALL_SIZE 46
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C) #elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
#define WATERFALL_SIZE 92 #define WATERFALL_SIZE 92
#else #else
#define WATERFALL_SIZE int(DISP_H * 0.75) // default to 75% of the display height
// add more eink compatible boards here // add more eink compatible boards here
#endif #endif
@ -190,6 +191,9 @@ GFXcanvas1 disp_area(64, 64);
#elif (DISP_H == 122 || DISP_H == 200) && (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 stat_area(DISP_H, DISP_W/2);
GFXcanvas1 disp_area(DISP_H, DISP_W/2); GFXcanvas1 disp_area(DISP_H, DISP_W/2);
#else
GFXcanvas1 stat_area(DISP_H, DISP_W/2);
GFXcanvas1 disp_area(DISP_H, DISP_W/2);
#endif #endif
void update_area_positions() { void update_area_positions() {
@ -361,8 +365,10 @@ void draw_cable_icon(int px, int py) {
if (cable_state == CABLE_STATE_DISCONNECTED) { if (cable_state == CABLE_STATE_DISCONNECTED) {
#if DISPLAY == OLED #if DISPLAY == OLED
stat_area.drawBitmap(px, py, bm_cable+0*32, 16, 16, SSD1306_WHITE, SSD1306_BLACK); stat_area.drawBitmap(px, py, bm_cable+0*32, 16, 16, SSD1306_WHITE, SSD1306_BLACK);
#elif (DISP_H == 122 || DISP_H == 200) && (DISPLAY == EINK_BW || DISPLAY == EINK_3C) #elif DISP_H == 122 && (DISPLAY == EINK_BW || DISPLAY == EINK_3C)
stat_area.drawBitmap(px, py, bm_cable+0*128, 30, 32, GxEPD_WHITE, GxEPD_BLACK); stat_area.drawBitmap(px, py, bm_cable+0*128, 30, 32, GxEPD_WHITE, GxEPD_BLACK);
#else
stat_area.drawBitmap(px, py, bm_cable+0*128, 16, 16, GxEPD_WHITE, GxEPD_BLACK);
#endif #endif
} else if (cable_state == CABLE_STATE_CONNECTED) { } else if (cable_state == CABLE_STATE_CONNECTED) {
#if DISPLAY == OLED #if DISPLAY == OLED
@ -1147,7 +1153,7 @@ void update_display(bool blank = false) {
} }
display.clearDisplay(); display.clearDisplay();
update_stat_area(); update_stat_area();
update_disp_area(); //update_disp_area();
display.display(); display.display();
uint32_t current = millis(); uint32_t current = millis();

View File

@ -13,7 +13,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#if DISP_H == UNSCALED_MAX #if DISP_H == UNSCALED_MAX || DISP_H == 200
// use 64px wide graphics // use 64px wide graphics
const unsigned char bm_cable [] PROGMEM = { const unsigned char bm_cable [] PROGMEM = {
@ -408,7 +408,7 @@ const unsigned char bm_dot_sqr [] PROGMEM = {
0x80, 0x00, 0x40, 0x00, 0x00, 0x00, 0xaa, 0xd5, 0x40 0x80, 0x00, 0x40, 0x00, 0x00, 0x00, 0xaa, 0xd5, 0x40
}; };
#elif (DISP_H == 122 || DISP_H == 200) #elif DISP_H == 122
// use 122px wide graphics // use 122px wide graphics
const unsigned char bm_bt [] PROGMEM = { const unsigned char bm_bt [] PROGMEM = {

View File

@ -1297,6 +1297,11 @@ void loop() {
#if HAS_INPUT #if HAS_INPUT
input_read(); input_read();
#if HAS_BACKLIGHT
if (button_pressed()) {
digitalWrite(pin_backlight, !digitalRead(pin_backlight));
}
#endif
#endif #endif
} }

View File

@ -1537,4 +1537,4 @@ void unlock_rom() {
eeprom_erase(); eeprom_erase();
} }
#include "src/misc/FIFOBuffer.h" #include "src/misc/FIFOBuffer.h"