mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-03-12 00:13:58 +01:00
NetworkManager: NM log prefix
This commit is contained in:
parent
801641f781
commit
ca567e720d
|
|
@ -74,7 +74,7 @@ void NetworkManager::_processAPTimeout() {
|
|||
}
|
||||
|
||||
if (millis() - _apStartup > _apTimeout) {
|
||||
Serial.println("AP timeout reached. Disabling AP mode.");
|
||||
Serial.println("[NM] AP timeout reached. Disabling AP mode.");
|
||||
disableAP();
|
||||
}
|
||||
}
|
||||
|
|
@ -82,25 +82,25 @@ void NetworkManager::_processAPTimeout() {
|
|||
void NetworkManager::_onNetworkEvent(arduino_event_id_t event, arduino_event_info_t /*info*/) {
|
||||
switch (event) {
|
||||
case ARDUINO_EVENT_ETH_START:
|
||||
Serial.println("ETH Started");
|
||||
Serial.println("[NM] ETH Started");
|
||||
if (!_hostName.isEmpty()) {
|
||||
Serial.println("ETH Setting Hostname: " + _hostName);
|
||||
Serial.println("[NM] ETH Setting Hostname: " + _hostName);
|
||||
ETH.setHostname(_hostName.c_str());
|
||||
}
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_CONNECTED:
|
||||
Serial.println("ETH Connected");
|
||||
Serial.println("[NM] ETH Connected");
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_GOT_IP:
|
||||
Serial.println("ETH Got IP");
|
||||
Serial.println("[NM] ETH Got IP");
|
||||
_ethernetConnected = true;
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_DISCONNECTED:
|
||||
Serial.println("ETH Disconnected");
|
||||
Serial.println("[NM] ETH Disconnected");
|
||||
_ethernetConnected = false;
|
||||
break;
|
||||
case ARDUINO_EVENT_ETH_STOP:
|
||||
Serial.println("ETH Stopped");
|
||||
Serial.println("[NM] ETH Stopped");
|
||||
_ethernetConnected = false;
|
||||
break;
|
||||
default:
|
||||
|
|
@ -110,7 +110,7 @@ void NetworkManager::_onNetworkEvent(arduino_event_id_t event, arduino_event_inf
|
|||
|
||||
// Initialize
|
||||
bool NetworkManager::setup() {
|
||||
Serial.println("Initializing Networking...");
|
||||
Serial.println("[NM] Initializing Networking...");
|
||||
|
||||
WiFi.onEvent(
|
||||
[this](arduino_event_id_t event, arduino_event_info_t info) {
|
||||
|
|
@ -135,7 +135,7 @@ void NetworkManager::setHostName(const String& hostName) {
|
|||
bool NetworkManager::setupAP(String apName, String apPsk) {
|
||||
_wifiAPmode = true;
|
||||
|
||||
Serial.println("Starting AP mode: " + apName);
|
||||
Serial.println("[NM] Starting AP mode: " + apName);
|
||||
|
||||
// Full WiFi reset sequence
|
||||
WiFi.disconnect(true);
|
||||
|
|
@ -149,16 +149,16 @@ bool NetworkManager::setupAP(String apName, String apPsk) {
|
|||
delay(1000); // Give AP time to fully initialize
|
||||
|
||||
if (apStarted) {
|
||||
Serial.println("AP setup successful");
|
||||
Serial.println("[NM] AP setup successful");
|
||||
_apStartup = millis();
|
||||
}
|
||||
else {
|
||||
Serial.println("AP setup failed");
|
||||
Serial.println("[NM] AP setup failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
IPAddress apIP = getWiFiAPIP();
|
||||
Serial.println("AP IP assigned: " + apIP.toString());
|
||||
Serial.println("[NM] AP IP assigned: " + apIP.toString());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@ bool NetworkManager::disableAP() {
|
|||
}
|
||||
|
||||
void NetworkManager::setAPTimeout(unsigned long timeout) {
|
||||
Serial.println("Setting AP timeout to " + String(timeout / 1000) + " sec");
|
||||
Serial.println("[NM] Setting AP timeout to " + String(timeout / 1000) + " sec");
|
||||
_apTimeout = timeout;
|
||||
}
|
||||
|
||||
|
|
@ -265,7 +265,7 @@ String NetworkManager::getWiFimacAddress(void) const {
|
|||
// Ethernet methods
|
||||
bool NetworkManager::ethernetConnect(eth_phy_type_t type, uint8_t phy_addr, uint8_t mdc, uint8_t mdio, int power, eth_clock_mode_t clock_mode, bool use_mac_from_efuse) {
|
||||
_ethernetMode = true;
|
||||
Serial.println("Setting up Ethernet...");
|
||||
Serial.println("[NM] Setting up Ethernet...");
|
||||
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
|
||||
// SDK 5.x (Arduino SDK 3.x)
|
||||
|
|
@ -285,7 +285,7 @@ bool NetworkManager::setEthernetIP(const String& staticIP, const String& gateway
|
|||
|
||||
IPAddress ip, gw, sn, d1, d2;
|
||||
if (!ip.fromString(staticIP) || !gw.fromString(gateway) || !sn.fromString(subnet)) {
|
||||
Serial.println("Invalid static IP configuration");
|
||||
Serial.println("[NM] Invalid static IP configuration");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -299,7 +299,7 @@ bool NetworkManager::setEthernetIP(const String& staticIP, const String& gateway
|
|||
ETH.config(ip, gw, sn);
|
||||
}
|
||||
|
||||
Serial.println("Ethernet static IP: " + staticIP);
|
||||
Serial.println("[NM] Ethernet static IP: " + staticIP);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue