From f884b5e70c4c4b6735cdb8991ea8637ae6e835f2 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Mon, 21 May 2018 15:16:28 +0200 Subject: [PATCH] All other static OLED pages --- README.md | 6 ++++++ crossbow/tx_oled.cpp | 51 +++++++++++++++++++++------------------------------ 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index fe9b093..76099d6 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,12 @@ Needs implementation: * RX configuration from TX module * Sending telemetry from TX to OpenTX radio +# Dependencies + +To compile, following libraries have to be installed: + +* [U8g2](https://github.com/olikraus/u8g2) for OLED support in TX module + # Protocol | Byte | Description | Notes | diff --git a/crossbow/tx_oled.cpp b/crossbow/tx_oled.cpp index 7197717..5dc9a57 100644 --- a/crossbow/tx_oled.cpp +++ b/crossbow/tx_oled.cpp @@ -77,48 +77,39 @@ void TxOled::page(uint8_t page) { } void TxOled::renderPagePwr() { - // _display.clearDisplay(); - // _display.setTextColor(WHITE, BLACK); + char buf[OLED_COL_COUNT]; - // _display.setCursor(0, 0); - // _display.setTextSize(2); - // _display.print("PWR"); + _display.clear(); + _display.setFont(u8x8_font_pxplustandynewtv_f); + _display.draw1x2String(0, 0, "Power"); - // //TODO content - // _display.setCursor(0, 25); - // _display.setTextSize(3); - // _display.print(radioNode.loraTxPower); - // _display.print("dBm"); - - // _display.display(); + _display.setFont(u8x8_font_chroma48medium8_r); + snprintf(buf, OLED_COL_COUNT, "%d%s", radioNode.loraTxPower, "dBm"); + _display.draw1x2String(0, 4, buf); } void TxOled::renderPageBind() { - // _display.clearDisplay(); - // _display.setTextColor(WHITE, BLACK); + char buf[OLED_COL_COUNT]; - // _display.setCursor(0, 0); - // _display.setTextSize(2); - // _display.print("Bind"); + _display.clear(); + _display.setFont(u8x8_font_pxplustandynewtv_f); + _display.draw1x2String(0, 0, "Bind"); - // //TODO content - - // _display.display(); + _display.setFont(u8x8_font_chroma48medium8_r); + snprintf(buf, OLED_COL_COUNT, "Bind?"); + _display.draw1x2String(0, 4, buf); } void TxOled::renderPageMode() { - // _display.clearDisplay(); - // _display.setTextColor(WHITE, BLACK); + char buf[OLED_COL_COUNT]; - // _display.setCursor(0, 0); - // _display.setTextSize(2); - // _display.print("Mode"); + _display.clear(); + _display.setFont(u8x8_font_pxplustandynewtv_f); + _display.draw1x2String(0, 0, "Mode"); - // _display.setCursor(0, 25); - // _display.setTextSize(3); - // _display.print("Full"); - - // _display.display(); + _display.setFont(u8x8_font_chroma48medium8_r); + snprintf(buf, OLED_COL_COUNT, "Full"); + _display.draw1x2String(0, 4, buf); } void TxOled::renderPageStats() {