From 302a23b6e655f4b9994f03bad408c3b8d7bb16fc Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Fri, 13 Nov 2020 16:01:46 +0000 Subject: [PATCH] Add M17 to the OLED display. --- OLED.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- OLED.h | 3 +++ 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/OLED.cpp b/OLED.cpp index c83c714..6adaddf 100644 --- a/OLED.cpp +++ b/OLED.cpp @@ -148,6 +148,28 @@ const unsigned char logo_NXDN_bmp [] = 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; +// Logo M17_sm, 128x16px +// XXX FIXME This is the NXDN logo, it needs replacing with the M17 logo +const unsigned char logo_M17_bmp [] = +{ +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xf0, 0x1f, 0xf8, 0x0f, 0x00, 0xff, 0x80, 0x7c, 0x00, 0x0f, 0xff, 0x80, 0x7f, 0xe0, 0x7f, +0xff, 0xe0, 0x0f, 0xf0, 0x1f, 0x80, 0x7e, 0x01, 0xf8, 0x00, 0x00, 0x7f, 0x00, 0x3f, 0xc0, 0x7f, +0xff, 0xc0, 0x07, 0xe0, 0x3f, 0x80, 0x38, 0x07, 0xf0, 0x00, 0x00, 0x3e, 0x00, 0x3f, 0x80, 0xff, +0xff, 0x80, 0x03, 0xc0, 0x3f, 0xc0, 0x00, 0x3f, 0xe0, 0x1f, 0x80, 0x3e, 0x00, 0x1f, 0x01, 0xff, +0xff, 0x00, 0x03, 0x80, 0x7f, 0xe0, 0x00, 0xff, 0xc0, 0x3f, 0x80, 0x3c, 0x00, 0x0e, 0x03, 0xff, +0xfe, 0x00, 0x01, 0x00, 0xff, 0xe0, 0x03, 0xff, 0x80, 0x7f, 0x80, 0x78, 0x08, 0x04, 0x03, 0xff, +0xfc, 0x03, 0x00, 0x01, 0xff, 0x80, 0x01, 0xff, 0x00, 0xff, 0x00, 0xf0, 0x1c, 0x00, 0x07, 0xff, +0xfc, 0x07, 0x80, 0x03, 0xfc, 0x00, 0x01, 0xfe, 0x01, 0xfc, 0x01, 0xe0, 0x1e, 0x00, 0x0f, 0xff, +0xf8, 0x0f, 0xc0, 0x07, 0xf0, 0x0e, 0x00, 0xfc, 0x00, 0x00, 0x07, 0xc0, 0x3f, 0x00, 0x1f, 0xff, +0xf0, 0x1f, 0xe0, 0x0f, 0x80, 0x3f, 0x00, 0x7c, 0x00, 0x00, 0x3f, 0xc0, 0x7f, 0x80, 0x3f, 0xff, +0xe0, 0x3f, 0xf0, 0x0e, 0x01, 0xff, 0x80, 0x38, 0x00, 0x07, 0xff, 0x80, 0xff, 0x80, 0x7f, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +}; + // Logo POCASG/DAPNET, 128x16px const unsigned char logo_POCSAG_bmp [] = { @@ -500,7 +522,6 @@ void COLED::writeP25Int(const char* source, bool group, unsigned int dest, const OLED_statusbar(); m_display.display(); - } void COLED::clearP25Int() @@ -566,6 +587,36 @@ void COLED::clearNXDNInt() m_display.display(); } +void COLED::writeM17Int(const char* source, const char* dest, const char* type) +{ + m_mode = MODE_M17; + + m_display.clearDisplay(); + m_display.fillRect(0, OLED_LINE2, m_display.width(), m_display.height(), BLACK); + + m_display.setCursor(0,OLED_LINE3); + m_display.printf("%s %s", type, source); + + m_display.setCursor(0,OLED_LINE4); + m_display.printf(" %s", dest); + + OLED_statusbar(); + m_display.display(); +} + +void COLED::clearM17Int() +{ + m_display.fillRect(0, OLED_LINE2, m_display.width(), m_display.height(), BLACK); + + m_display.setCursor(40,OLED_LINE4); + m_display.print("Listening"); + + m_display.setCursor(0,OLED_LINE6); + m_display.printf("%s",m_ipaddress.c_str()); + + m_display.display(); +} + void COLED::writePOCSAGInt(uint32_t ric, const std::string& message) { m_mode = MODE_POCSAG; @@ -583,7 +634,6 @@ void COLED::writePOCSAGInt(uint32_t ric, const std::string& message) OLED_statusbar(); m_display.display(); - } void COLED::clearPOCSAGInt() @@ -658,6 +708,8 @@ void COLED::OLED_statusbar() m_display.drawBitmap(0, 0, logo_P25_bmp, 128, 16, WHITE); else if (m_mode == MODE_NXDN) m_display.drawBitmap(0, 0, logo_NXDN_bmp, 128, 16, WHITE); + else if (m_mode == MODE_M17) + m_display.drawBitmap(0, 0, logo_M17_bmp, 128, 16, WHITE); else if (m_mode == MODE_POCSAG) m_display.drawBitmap(0, 0, logo_POCSAG_bmp, 128, 16, WHITE); else if (m_displayLogoScreensaver) diff --git a/OLED.h b/OLED.h index 5f3ead0..45c78ad 100644 --- a/OLED.h +++ b/OLED.h @@ -70,6 +70,9 @@ public: virtual int writeNXDNIntEx(const class CUserDBentry& source, bool group, unsigned int dest, const char* type); virtual void clearNXDNInt(); + virtual void writeM17Int(const char* source, const char* dest, const char* type); + virtual void clearM17Int(); + virtual void writePOCSAGInt(uint32_t ric, const std::string& message); virtual void clearPOCSAGInt();