Add IP address to splash screen
This commit is contained in:
parent
0a3f747d00
commit
f80c314247
5 changed files with 30 additions and 10 deletions
|
@ -154,6 +154,7 @@ void setupWifi()
|
||||||
Serial.println("WiFi connected");
|
Serial.println("WiFi connected");
|
||||||
Serial.println("IP address: ");
|
Serial.println("IP address: ");
|
||||||
Serial.println(WiFi.localIP());
|
Serial.println(WiFi.localIP());
|
||||||
|
epdShowIp();
|
||||||
// WiFi.setTxPower(WIFI_POWER_8_5dBm);
|
// WiFi.setTxPower(WIFI_POWER_8_5dBm);
|
||||||
// enableWiFi();
|
// enableWiFi();
|
||||||
}
|
}
|
||||||
|
|
33
src/epd.cpp
33
src/epd.cpp
|
@ -22,14 +22,14 @@ void setupDisplay()
|
||||||
display.setRotation(1);
|
display.setRotation(1);
|
||||||
display.setFont(&Antonio_SemiBold20pt7b);
|
display.setFont(&Antonio_SemiBold20pt7b);
|
||||||
display.setTextColor(GxEPD_WHITE);
|
display.setTextColor(GxEPD_WHITE);
|
||||||
int16_t tbx, tby;
|
// int16_t tbx, tby;
|
||||||
uint16_t tbw, tbh;
|
// uint16_t tbw, tbh;
|
||||||
display.getTextBounds("OrangeBTClock", 0, 0, &tbx, &tby, &tbw, &tbh);
|
// display.getTextBounds("OrangeBTClock", 0, 0, &tbx, &tby, &tbw, &tbh);
|
||||||
// center the bounding box by transposition of the origin:
|
// // center the bounding box by transposition of the origin:
|
||||||
uint16_t x = ((display.width() - tbw) / 2) - tbx;
|
// uint16_t x = ((display.width() - tbw) / 2) - tbx;
|
||||||
uint16_t y = ((display.height() - tbh) / 2) - tby;
|
// uint16_t y = ((display.height() - tbh) / 2) - tby;
|
||||||
display.fillScreen(GxEPD_BLACK);
|
display.fillScreen(GxEPD_BLACK);
|
||||||
display.setCursor(x, y);
|
// display.setCursor(x, y);
|
||||||
// display.print("OrangeBTClock");
|
// display.print("OrangeBTClock");
|
||||||
|
|
||||||
// display.drawImage(epd_bitmap_allArray[0], GxEPD_WHITE, 0,0 250,37);
|
// display.drawImage(epd_bitmap_allArray[0], GxEPD_WHITE, 0,0 250,37);
|
||||||
|
@ -39,6 +39,9 @@ void setupDisplay()
|
||||||
display.drawBitmap(xPos,yPos, epd_bitmap_oclogo, 250, 37, GxEPD_WHITE);
|
display.drawBitmap(xPos,yPos, epd_bitmap_oclogo, 250, 37, GxEPD_WHITE);
|
||||||
display.display(false);
|
display.display(false);
|
||||||
|
|
||||||
|
display.setCursor(0, 37);
|
||||||
|
|
||||||
|
|
||||||
// display.fillScreen(GxEPD_WHITE);
|
// display.fillScreen(GxEPD_WHITE);
|
||||||
// display.drawLine(0, 10, display.width(), 10, GxEPD_BLACK);
|
// display.drawLine(0, 10, display.width(), 10, GxEPD_BLACK);
|
||||||
// display.drawLine(0, row2, display.width(), row2, GxEPD_BLACK);
|
// display.drawLine(0, row2, display.width(), row2, GxEPD_BLACK);
|
||||||
|
@ -70,6 +73,22 @@ void setupDisplay()
|
||||||
// display.display(true);
|
// display.display(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void epdShowIp() {
|
||||||
|
display.setRotation(1);
|
||||||
|
display.setFont(&LibreFranklin_SemiBold10pt7b);
|
||||||
|
display.setTextColor(GxEPD_WHITE);
|
||||||
|
String ipStr = WiFi.localIP().toString();
|
||||||
|
int16_t tbx, tby;
|
||||||
|
uint16_t tbw, tbh;
|
||||||
|
display.getTextBounds(ipStr, 0, 0, &tbx, &tby, &tbw, &tbh);
|
||||||
|
// center the bounding box by transposition of the origin:
|
||||||
|
uint16_t x = ((display.width() - tbw) / 2) - tbx;
|
||||||
|
uint16_t y = ((display.height() - tbh) / 2) - tby + 37;
|
||||||
|
display.setCursor(x, y);
|
||||||
|
display.println(WiFi.localIP());
|
||||||
|
display.display(true);
|
||||||
|
}
|
||||||
|
|
||||||
void updateRow2(String c, char icon)
|
void updateRow2(String c, char icon)
|
||||||
{
|
{
|
||||||
if (c.equals(currentRow2) && icon == currentIcon2)
|
if (c.equals(currentRow2) && icon == currentIcon2)
|
||||||
|
|
|
@ -9,4 +9,5 @@ void showSetupText(String t);
|
||||||
void updateRow1(String c, char icon);
|
void updateRow1(String c, char icon);
|
||||||
void updateRow2(String c, char icon);
|
void updateRow2(String c, char icon);
|
||||||
void updateRow3(String c, char icon);
|
void updateRow3(String c, char icon);
|
||||||
void updateRows(String row1Content, String row2Content, String row3Content);
|
void updateRows(String row1Content, String row2Content, String row3Content);
|
||||||
|
void epdShowIp();
|
|
@ -42,8 +42,6 @@ void setup()
|
||||||
{
|
{
|
||||||
// setCpuFrequencyMhz(40);
|
// setCpuFrequencyMhz(40);
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
delay(2500);
|
|
||||||
Serial.println("Hello");
|
|
||||||
#ifndef IS_ORANGECLOCK
|
#ifndef IS_ORANGECLOCK
|
||||||
pinMode(LED_BUILTIN, OUTPUT);
|
pinMode(LED_BUILTIN, OUTPUT);
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <FastLED.h>
|
#include <FastLED.h>
|
||||||
#include <freertos/FreeRTOS.h>
|
#include <freertos/FreeRTOS.h>
|
||||||
#include <freertos/task.h>
|
#include <freertos/task.h>
|
||||||
|
#include <WiFi.h>
|
||||||
|
|
||||||
#ifdef VERSION_EPD_2_13
|
#ifdef VERSION_EPD_2_13
|
||||||
#define EPD_CLASS GxEPD2_213_B74
|
#define EPD_CLASS GxEPD2_213_B74
|
||||||
|
|
Loading…
Reference in a new issue