This commit is contained in:
Nivek-domo 2025-04-19 18:50:43 +02:00 committed by GitHub
commit 06c95f9c73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -56,6 +56,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "mesh/wifi/WiFiAPClient.h" #include "mesh/wifi/WiFiAPClient.h"
#endif #endif
#if HAS_ETHERNET
#include "mesh/eth/ethClient.h"
#endif
#ifdef ARCH_ESP32 #ifdef ARCH_ESP32
#include "esp_task_wdt.h" #include "esp_task_wdt.h"
#include "modules/StoreForwardModule.h" #include "modules/StoreForwardModule.h"
@ -232,6 +236,43 @@ static void drawOEMBootScreen(OLEDDisplay *display, OLEDDisplayUiState *state, i
#endif #endif
#if HAS_ETHERNET
static void drawEthernetFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
{
display->setFont(FONT_SMALL);
display->setTextAlignment(TEXT_ALIGN_LEFT);
if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) {
display->fillRect(0 + x, 0 + y, x + display->getWidth(), y + FONT_HEIGHT_SMALL);
display->setColor(BLACK);
}
display->setColor(WHITE);
// Position verticale ajustée - commence plus haut
int16_t y_offset = y + 2; // Réduit l'espace au-dessus
// Alignement à gauche (x + petit offset)
int16_t x_offset = x + 2;
// Affichage non centré, aligné à gauche
display->drawString(x_offset, y_offset, "Ethernet Config:");
y_offset += FONT_HEIGHT_SMALL + 2; // Espacement légèrement réduit
display->drawString(x_offset, y_offset, "IP: " + Ethernet.localIP().toString());
y_offset += FONT_HEIGHT_SMALL;
display->drawString(x_offset, y_offset, "Mask: " + Ethernet.subnetMask().toString());
y_offset += FONT_HEIGHT_SMALL;
display->drawString(x_offset, y_offset, "GW: " + Ethernet.gatewayIP().toString());
//y_offset += FONT_HEIGHT_SMALL;
//display->drawString(x_offset, y_offset, "DNS: " + Ethernet.dnsServerIP().toString());
}
#endif
void Screen::drawFrameText(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y, const char *message) void Screen::drawFrameText(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y, const char *message)
{ {
uint16_t x_offset = display->width() / 2; uint16_t x_offset = display->width() / 2;
@ -2181,6 +2222,12 @@ void Screen::setFrames(FrameFocus focus)
normalFrames[numframes++] = &Screen::drawDebugInfoWiFiTrampoline; normalFrames[numframes++] = &Screen::drawDebugInfoWiFiTrampoline;
} }
#endif #endif
#if HAS_ETHERNET
if (Ethernet.hardwareStatus() != EthernetNoHardware) {
normalFrames[numframes++] = drawEthernetFrame;
}
#endif
fsi.frameCount = numframes; // Total framecount is used to apply FOCUS_PRESERVE fsi.frameCount = numframes; // Total framecount is used to apply FOCUS_PRESERVE
LOG_DEBUG("Finished build frames. numframes: %d", numframes); LOG_DEBUG("Finished build frames. numframes: %d", numframes);