Skip to content

Commit a74041e

Browse files
author
j000bs
committed
Rename class SSD1306DisplayDevice to DisplayDevice
1 parent db3c3bd commit a74041e

9 files changed

+31
-31
lines changed

src/OpenBikeSensorFirmware.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Button button(PUSHBUTTON_PIN);
5757

5858
Config config;
5959

60-
SSD1306DisplayDevice* obsDisplay;
60+
DisplayDevice* obsDisplay;
6161
HCSR04SensorManager* sensorManager;
6262
static BluetoothManager* bluetoothManager;
6363

@@ -209,7 +209,7 @@ void setup() {
209209
if (displayError != 0) {
210210
Serial.println("Display not found");
211211
}
212-
obsDisplay = new SSD1306DisplayDevice;
212+
obsDisplay = new DisplayDevice;
213213

214214
obsDisplay->showLogo(true);
215215
obsDisplay->showTextOnGrid(2, obsDisplay->startLine(), OBSVersion);

src/configServer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ String getIp() {
492492
}
493493
}
494494

495-
void updateDisplay(SSD1306DisplayDevice * const display, String action = "") {
495+
void updateDisplay(DisplayDevice * const display, String action = "") {
496496
if (action.isEmpty()) {
497497
display->showTextOnGrid(0, 0, "Ver.:");
498498
display->showTextOnGrid(1, 0, OBSVersion);

src/displays.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
#include "fonts/fonts.h"
2727

28-
void SSD1306DisplayDevice::showNumConfirmed() {
28+
void DisplayDevice::showNumConfirmed() {
2929
String val = String(confirmedMeasurements);
3030
if (confirmedMeasurements <= 9) {
3131
val = "0" + val;
@@ -34,7 +34,7 @@ void SSD1306DisplayDevice::showNumConfirmed() {
3434
this->prepareTextOnGrid(3, 5, "conf");
3535
}
3636

37-
void SSD1306DisplayDevice::showNumButtonPressed() {
37+
void DisplayDevice::showNumButtonPressed() {
3838
String val = String(numButtonReleased);
3939
if (numButtonReleased <= 9) {
4040
val = "0" + val;
@@ -43,7 +43,7 @@ void SSD1306DisplayDevice::showNumButtonPressed() {
4343
this->prepareTextOnGrid(1, 5, "press");
4444
}
4545

46-
void SSD1306DisplayDevice::displaySimple(uint16_t value) {
46+
void DisplayDevice::displaySimple(uint16_t value) {
4747
if (value == MAX_SENSOR_VALUE) {
4848
this->prepareTextOnGrid(0, 0,
4949
"", HUGE_FONT, -7, -7);
@@ -54,7 +54,7 @@ void SSD1306DisplayDevice::displaySimple(uint16_t value) {
5454
this->prepareTextOnGrid(3, 2, "cm", MEDIUM_FONT, -7, -5);
5555
}
5656

57-
void SSD1306DisplayDevice::showValues(
57+
void DisplayDevice::showValues(
5858
HCSR04SensorInfo sensor1, HCSR04SensorInfo sensor2, uint16_t minDistanceToConfirm, int16_t batteryPercentage,
5959
int16_t TemperaturValue, int lastMeasurements, boolean insidePrivacyArea,
6060
double speed, uint8_t satellites) {
@@ -141,7 +141,7 @@ void SSD1306DisplayDevice::showValues(
141141

142142
}
143143

144-
void SSD1306DisplayDevice::showGPS(uint8_t sats) {
144+
void DisplayDevice::showGPS(uint8_t sats) {
145145
String val = String(sats);
146146
if (sats <= 9) {
147147
val = "0" + val;
@@ -150,7 +150,7 @@ void SSD1306DisplayDevice::showGPS(uint8_t sats) {
150150
this->prepareTextOnGrid(3, 5, "sats");
151151
}
152152

153-
void SSD1306DisplayDevice::showBatterieValue(int16_t input_val){
153+
void DisplayDevice::showBatterieValue(int16_t input_val){
154154

155155
uint8_t x_offset_batterie_logo = 65;
156156
uint8_t y_offset_batterie_logo = 2;
@@ -195,7 +195,7 @@ void SSD1306DisplayDevice::showBatterieValue(int16_t input_val){
195195
//m_display->display();
196196
}
197197

198-
void SSD1306DisplayDevice::showTemperatureValue(int16_t input_val){
198+
void DisplayDevice::showTemperatureValue(int16_t input_val){
199199
uint8_t x_offset_temp_logo = 30;
200200
uint8_t y_offset_temp_logo = 2;
201201
cleanTemperatur(x_offset_temp_logo,y_offset_temp_logo);
@@ -204,7 +204,7 @@ void SSD1306DisplayDevice::showTemperatureValue(int16_t input_val){
204204
this->showTextOnGrid(1, 0, val + "°C", TINY_FONT);
205205
}
206206

207-
void SSD1306DisplayDevice::showSpeed(double velocity) {
207+
void DisplayDevice::showSpeed(double velocity) {
208208
const int bufSize = 4;
209209
char buffer[bufSize];
210210
if (velocity >= 0) {
@@ -216,30 +216,30 @@ void SSD1306DisplayDevice::showSpeed(double velocity) {
216216
this->prepareTextOnGrid(1, 5, "km/h");
217217
}
218218

219-
uint8_t SSD1306DisplayDevice::currentLine() const {
219+
uint8_t DisplayDevice::currentLine() const {
220220
return mCurrentLine;
221221
}
222222

223-
uint8_t SSD1306DisplayDevice::newLine() {
223+
uint8_t DisplayDevice::newLine() {
224224
if (mCurrentLine >= 5) {
225225
scrollUp();
226226
}
227227
return ++mCurrentLine;
228228
}
229229

230-
uint8_t SSD1306DisplayDevice::scrollUp() {
230+
uint8_t DisplayDevice::scrollUp() {
231231
for (uint8_t i = 0; i < 5; i++) {
232232
prepareTextOnGrid(2, i, obsDisplay->get_gridTextofCell(2, i + 1));
233233
}
234234
m_display->display();
235235
return mCurrentLine--;
236236
}
237237

238-
uint8_t SSD1306DisplayDevice::startLine() {
238+
uint8_t DisplayDevice::startLine() {
239239
return mCurrentLine = 0;
240240
}
241241

242-
void SSD1306DisplayDevice::highlight(uint32_t highlightTimeMillis) {
242+
void DisplayDevice::highlight(uint32_t highlightTimeMillis) {
243243
mHighlightTill = millis() + highlightTimeMillis;
244244
if (!mHighlighted) {
245245
if (mInverted) {
@@ -251,7 +251,7 @@ void SSD1306DisplayDevice::highlight(uint32_t highlightTimeMillis) {
251251
}
252252
}
253253

254-
void SSD1306DisplayDevice::handleHighlight() {
254+
void DisplayDevice::handleHighlight() {
255255
if (mHighlighted && mHighlightTill < millis()) {
256256
if (mInverted) {
257257
m_display->invertDisplay();

src/displays.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const int DIO = 25; //Set the DIO pin connection to the display
6060

6161
extern bool BMP280_active;
6262

63-
class SSD1306DisplayDevice {
63+
class DisplayDevice {
6464
private:
6565
void handleHighlight();
6666
void displaySimple(uint16_t value);
@@ -73,15 +73,15 @@ class SSD1306DisplayDevice {
7373
bool mHighlighted = false;
7474

7575
public:
76-
SSD1306DisplayDevice() {
76+
DisplayDevice() {
7777
m_display = new SSD1306(0x3c, 21, 22); // ADDRESS, SDA, SCL
7878
m_display->init();
7979
m_display->setBrightness(255);
8080
m_display->setTextAlignment(TEXT_ALIGN_LEFT);
8181
m_display->display();
8282
}
8383

84-
~SSD1306DisplayDevice() {
84+
~DisplayDevice() {
8585
delete m_display;
8686
}
8787

src/globals.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <Arduino.h>
2828

2929
// Forward declare classes to build (because there is a cyclic dependency between sensor.h and displays.h)
30-
class SSD1306DisplayDevice;
30+
class DisplayDevice;
3131
class HCSR04SensorManager;
3232

3333

@@ -52,7 +52,7 @@ extern int numButtonReleased;
5252
extern Config config;
5353

5454

55-
extern SSD1306DisplayDevice* obsDisplay;
55+
extern DisplayDevice* obsDisplay;
5656

5757
extern HCSR04SensorManager* sensorManager;
5858

src/gps.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ PrivacyArea Gps::newPrivacyArea(double latitude, double longitude, int radius) {
545545
return newPrivacyArea;
546546
}
547547

548-
bool Gps::hasFix(SSD1306DisplayDevice *display) const {
548+
bool Gps::hasFix(DisplayDevice *display) const {
549549
bool result = false;
550550
if (mCurrentGpsRecord.hasValidFix() && mLastTimeTimeSet) {
551551
log_d("Got location...");
@@ -563,7 +563,7 @@ int32_t Gps::getMessagesWithFailedCrcCount() const {
563563
return mMessagesWithFailedCrcReceived;
564564
}
565565

566-
void Gps::showWaitStatus(SSD1306DisplayDevice const * display) const {
566+
void Gps::showWaitStatus(DisplayDevice const * display) const {
567567
String satellitesString[2];
568568
if (mValidMessagesReceived == 0) { // could not get any valid char from GPS module
569569
satellitesString[0] = "OFF?";

src/gps.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "displays.h"
3232
#include "gpsrecord.h"
3333

34-
class SSD1306DisplayDevice;
34+
class DisplayDevice;
3535

3636
class Gps {
3737
public:
@@ -47,7 +47,7 @@ class Gps {
4747
/* read and process data from serial, true if there was valid data. */
4848
bool handle();
4949

50-
bool hasFix(SSD1306DisplayDevice *display) const;
50+
bool hasFix(DisplayDevice *display) const;
5151

5252
/* Returns true if valid communication with the gps module was possible. */
5353
bool moduleIsAlive() const;
@@ -56,7 +56,7 @@ class Gps {
5656

5757
uint8_t getValidSatellites() const;
5858

59-
void showWaitStatus(const SSD1306DisplayDevice *display) const;
59+
void showWaitStatus(const DisplayDevice *display) const;
6060

6161
/* Returns current speed, negative value means unknown speed. */
6262
double getSpeed() const;

src/utils/alpdata.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
/* Download http://alp.u-blox.com/current_14d.alp (ssl?) if there is a new one
3131
* Takes 5 seconds to update the data.
3232
*/
33-
void AlpData::update(SSD1306DisplayDevice *display) {
33+
void AlpData::update(DisplayDevice *display) {
3434
String lastModified = loadLastModified();
3535

3636
File f = SD.open(ALP_DATA_FILE_NAME, FILE_READ);
@@ -95,7 +95,7 @@ void AlpData::update(SSD1306DisplayDevice *display) {
9595
httpClient.end();
9696
}
9797

98-
void AlpData::displayHttpClientError(SSD1306DisplayDevice *display, int httpError) {
98+
void AlpData::displayHttpClientError(DisplayDevice *display, int httpError) {
9999
display->showTextOnGrid(0, 4, String("ALP data failed ") + String(httpError).c_str());
100100
String errorString = HTTPClient::errorToString(httpError);
101101
display->showTextOnGrid(0, 5, errorString.c_str());

src/utils/alpdata.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static const char *const ALP_DOWNLOAD_URL = "https://alp.u-blox.com/current_14d.
3939

4040
class AlpData {
4141
public:
42-
static void update(SSD1306DisplayDevice *display);
42+
static void update(DisplayDevice *display);
4343
static bool available();
4444
static void saveMessage(const uint8_t *data, size_t size);
4545
static size_t loadMessage(uint8_t *data, size_t size);
@@ -50,7 +50,7 @@ class AlpData {
5050
private:
5151
static void saveLastModified(const String &header);
5252
static String loadLastModified();
53-
static void displayHttpClientError(SSD1306DisplayDevice *display, int httpError);
53+
static void displayHttpClientError(DisplayDevice *display, int httpError);
5454
File mAlpDataFile;
5555

5656
};

0 commit comments

Comments
 (0)