From d96e6cebc106508ac584a7887cc0ef994212cb17 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Fri, 21 May 2021 22:22:50 +0200 Subject: [PATCH] remove smart pointer in Display --- lib/Display/Display.cpp | 10 +++++----- lib/Display/Display.h | 2 +- src/LoRa_APRS_iGate.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/Display/Display.cpp b/lib/Display/Display.cpp index 865eb34..95766b5 100644 --- a/lib/Display/Display.cpp +++ b/lib/Display/Display.cpp @@ -18,7 +18,7 @@ void Display::setup(BoardConfig const *const boardConfig) { digitalWrite(boardConfig->OledReset, HIGH); } Wire.begin(boardConfig->OledSda, boardConfig->OledScl); - _disp = std::shared_ptr(new SSD1306(&Wire, boardConfig->OledAddr)); + _disp = new SSD1306(&Wire, boardConfig->OledAddr); Bitmap bitmap(_disp->getWidth(), _disp->getHeight()); _disp->display(&bitmap); @@ -47,7 +47,7 @@ void Display::update() { if (_frames.size() > 0) { std::shared_ptr frame = *_frames.begin(); - Bitmap bitmap(_disp.get()); + Bitmap bitmap(_disp); frame->drawStatusPage(bitmap); _disp->display(&bitmap); @@ -60,7 +60,7 @@ void Display::update() { } } else { if (_disp->isDisplayOn()) { - Bitmap bitmap(_disp.get()); + Bitmap bitmap(_disp); _statusFrame->drawStatusPage(bitmap); _disp->display(&bitmap); @@ -88,7 +88,7 @@ void Display::setStatusFrame(std::shared_ptr frame) { } void Display::showSpashScreen(String firmwareTitle, String version) { - Bitmap bitmap(_disp.get()); + Bitmap bitmap(_disp); bitmap.drawString(0, 10, firmwareTitle); bitmap.drawString(0, 20, version); bitmap.drawString(0, 35, "by Peter Buchegger"); @@ -97,7 +97,7 @@ void Display::showSpashScreen(String firmwareTitle, String version) { } void Display::showStatusScreen(String header, String text) { - Bitmap bitmap(_disp.get()); + Bitmap bitmap(_disp); bitmap.drawString(0, 0, header); bitmap.drawStringLF(0, 10, text); _disp->display(&bitmap); diff --git a/lib/Display/Display.h b/lib/Display/Display.h index cda71ac..045e898 100644 --- a/lib/Display/Display.h +++ b/lib/Display/Display.h @@ -42,7 +42,7 @@ public: void addFrame(std::shared_ptr frame); private: - std::shared_ptr _disp; + OLEDDisplay *_disp; Timer _displayFrameRate; std::shared_ptr _statusFrame; diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index 9d99d09..e2ffaea 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -66,8 +66,8 @@ void setup() { boardConfig = finder.searchBoardConfig(); if (boardConfig == 0) { logPrintlnE("Board config not set and search failed!"); - while (true) { - } + while (true) + ; } userConfig.board = boardConfig->Name; confmg.writeConfiguration(userConfig);