From 6fe5a060b082a61b6ad3135644517f91a015263b Mon Sep 17 00:00:00 2001 From: Tuomas Kuosmanen Date: Tue, 30 Jan 2024 23:44:41 +0200 Subject: [PATCH 1/3] Alternative SSD1362 display --- GNC255/GNC255.cpp | 9 +++++++-- GNC255/GNC255.h | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/GNC255/GNC255.cpp b/GNC255/GNC255.cpp index ddb2af0..d85bcfe 100644 --- a/GNC255/GNC255.cpp +++ b/GNC255/GNC255.cpp @@ -34,14 +34,19 @@ void GNC255::attach() Next call the constructor of your custom device adapt it to the needs of your constructor ********************************************************************************** */ - if (!FitInMemory(sizeof(U8G2_SSD1322_NHD_256X64_F_4W_SW_SPI))) { + // if (!FitInMemory(sizeof(U8G2_SSD1322_NHD_256X64_F_4W_SW_SPI))) { + if (!FitInMemory(sizeof(U8G2_SSD1362_256X64_F_4W_HW_SPI))) { // Error Message to Connector cmdMessenger.sendCmd(kStatus, F("Custom Device does not fit in Memory")); return; } + /* SSD1322 */ //_oledDisplay = new (allocateMemory(sizeof(U8G2_SSD1322_NHD_256X64_F_4W_SW_SPI))) U8G2_SSD1322_NHD_256X64_F_4W_SW_SPI(U8G2_R0, _clk, _data, _cs, _dc); - _oledDisplay = new (allocateMemory(sizeof(U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI))) U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI(U8G2_R0, 53, _dc, _reset); + //_oledDisplay = new (allocateMemory(sizeof(U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI))) U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI(U8G2_R0, 53, _dc, _reset); + + // Surenoo SOG25664B2 (SSD1362) 7pin module + _oledDisplay = new (allocateMemory(sizeof(U8G2_SSD1362_256X64_F_4W_HW_SPI))) U8G2_SSD1362_256X64_F_4W_HW_SPI(U8G2_R0, _cs, _dc, _reset); begin(); } diff --git a/GNC255/GNC255.h b/GNC255/GNC255.h index f197f45..4532f44 100644 --- a/GNC255/GNC255.h +++ b/GNC255/GNC255.h @@ -38,7 +38,9 @@ class GNC255 private: // U8G2_SSD1322_NHD_256X64_F_4W_SW_SPI *_oledDisplay; - U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI *_oledDisplay; + // U8G2_SSD1322_NHD_256X64_F_4W_HW_SPI *_oledDisplay; + /* Surenoo SOG25664B2 (SSD1362) 7pin module */ + U8G2_SSD1362_256X64_F_4W_HW_SPI *_oledDisplay; bool _initialised; uint8_t _clk, _data, _cs, _dc, _reset; bool _hasChanged; From b6179e3bd68e4521dbcbd7da5eab5eba1616acb6 Mon Sep 17 00:00:00 2001 From: Tuomas Kuosmanen Date: Wed, 31 Jan 2024 00:01:49 +0200 Subject: [PATCH 2/3] added setContrast method for the oled --- GNC255/GNC255.cpp | 10 +++++++++- GNC255/GNC255.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/GNC255/GNC255.cpp b/GNC255/GNC255.cpp index d85bcfe..80611eb 100644 --- a/GNC255/GNC255.cpp +++ b/GNC255/GNC255.cpp @@ -115,6 +115,9 @@ void GNC255::set(int16_t messageID, const char *data) case 5: // set COM/NAV mode setMode(strcmp(data, "0") == 0); break; + case 6: // set contrast (brightness) of OLED + setContrast(atoi(data)); + break; default: break; } @@ -169,4 +172,9 @@ void GNC255::_renderLabel(const char *text, Label label, Position offset, bool u _oledDisplay->print(text); if (update) _oledDisplay->sendBuffer(); -} \ No newline at end of file +} + +void GNC255::setContrast(uint8_t displayContrast) +{ + _oledDisplay->setContrast(displayContrast); +} diff --git a/GNC255/GNC255.h b/GNC255/GNC255.h index 4532f44..b85a82c 100644 --- a/GNC255/GNC255.h +++ b/GNC255/GNC255.h @@ -46,6 +46,7 @@ class GNC255 bool _hasChanged; char activeFrequency[8] = "123.456"; char standbyFrequency[8] = "123.456"; + uint8_t displayContrast = 32; void _update(); void _stop(); @@ -55,4 +56,5 @@ class GNC255 void updateActiveLabel(const char *frequency); void updateStandbyLabel(const char *frequency); void _renderLabel(const char *text, Label label, Position offset, bool update = false); + void setContrast(uint8_t displayContrast); }; From cb62f2118b26483325628521194209e5e8421df9 Mon Sep 17 00:00:00 2001 From: Tuomas Kuosmanen Date: Wed, 7 Feb 2024 15:32:27 +0200 Subject: [PATCH 3/3] Added custom font and adjusted the layout to be more close to the original unit. --- GNC255/GNC255.cpp | 13 +++++++------ GNC255/fonts.h | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 GNC255/fonts.h diff --git a/GNC255/GNC255.cpp b/GNC255/GNC255.cpp index 80611eb..91916c7 100644 --- a/GNC255/GNC255.cpp +++ b/GNC255/GNC255.cpp @@ -2,13 +2,14 @@ #include #include "allocateMem.h" #include "commandmessenger.h" +#include "fonts.h" Layout ComLayout = { - {u8g2_font_logisoso22_tn, 22, {10, 32}}, - {u8g2_font_profont10_mr, 10, {0, 32}}, - {u8g2_font_profont12_mr, 13, {18, 45}}, - {u8g2_font_profont12_mr, 12, {107, 18}}, - {u8g2_font_profont12_mr, 12, {120, 18}}, + {gnc255frequency, 22, {31, 36}}, /* Value (frequency)*/ + {u8g2_font_4x6_mr, 6, {19, 32}}, /* ValueLabel (ACT/STB) */ + {u8g2_font_profont12_mr, 13, {33, 48}}, /* Valuelabel (active or standby label) */ + {u8g2_font_profont12_mr, 12, {116, 24}}, /* ModeComLabel (COM mode indicator) */ + {u8g2_font_profont12_mr, 12, {127, 24}}, /* ModeNavLabel (NAV mode indicator) */ }; Position OffsetActive = { @@ -16,7 +17,7 @@ Position OffsetActive = { 0}; Position OffsetStandby = { - 140, + 116, 0}; GNC255::GNC255(uint8_t clk, uint8_t data, uint8_t cs, uint8_t dc, uint8_t reset) diff --git a/GNC255/fonts.h b/GNC255/fonts.h new file mode 100644 index 0000000..3094891 --- /dev/null +++ b/GNC255/fonts.h @@ -0,0 +1,14 @@ +/* + Fontname: gnc255frequency + Copyright: Created with Fony 1.4.7 + Glyphs: 12/12 + BBX Build Mode: 0 +*/ +const uint8_t gnc255frequency[224] U8G2_FONT_SECTION("gnc255frequency") = + "\14\0\4\4\4\5\2\3\5\13\25\0\0\25\0\25\0\0\0\0\0\0\307.\6\63|\205\4/\5\0" + "\244\7\60\17+}\227\63)\134\331\377\312E\232#\0\61\14)\217\62\226\315\377\315\3\6\62\21+" + "}\227\63)\134\15\234n\376p\340\203\7\3\63\25+}\227\63)\134\15\234\315\241+\7Nh\312E" + "\232#\0\64\33+}\267q\304J\31\32\61f\310\64C\306\14\31\63\344\301\203a\3\347\11\0\65\23" + "+}\207\17\14\316\60\211\212\205\63\64\345\42\315\21\0\66\24+}\27$)T\14\234a\22\25\256\354" + "\312E\232#\0\67\20+}\207\17\6\316\216\30e\343\6\316\257\0\70\24+}\227\63)\134\331jD" + "\222,F\331\225\213\64G\0\71\23+}\227\63)\134\331\225\13%\11\347BE\22$\0\0\0\0";