Browse Source

0.8.135

* translated `/system` #1717
* added default pin seetings for opendtufusion board
* fixed ethernet static IP
* fixed ethernet MAC address read back
main
lumapu 5 months ago
parent
commit
83b386deda
  1. 3
      src/CHANGES.md
  2. 17
      src/network/AhoyEthernet.h
  3. 10
      src/network/AhoyEthernetSpi.h
  4. 4
      src/network/AhoyWifiEsp32.h
  5. 10
      src/web/html/setup.html

3
src/CHANGES.md

@ -2,6 +2,9 @@
## 0.8.135 - 2024-08-11 ## 0.8.135 - 2024-08-11
* translated `/system` #1717 * translated `/system` #1717
* added default pin seetings for opendtufusion board
* fixed ethernet static IP
* fixed ethernet MAC address read back
## 0.8.134 - 2024-08-10 ## 0.8.134 - 2024-08-10
* combined Ethernet and WiFi variants - Ethernet is now always included, but needs to be enabled if needed * combined Ethernet and WiFi variants - Ethernet is now always included, but needs to be enabled if needed

17
src/network/AhoyEthernet.h

@ -22,7 +22,7 @@ class AhoyEthernet : public AhoyWifi {
}; };
public: public:
void begin() override { virtual void begin() override {
mMode = Mode::WIRELESS; mMode = Mode::WIRELESS;
mAp.enable(); mAp.enable();
AhoyWifi::begin(); AhoyWifi::begin();
@ -34,31 +34,32 @@ class AhoyEthernet : public AhoyWifi {
ETH.setHostname(mConfig->sys.deviceName); ETH.setHostname(mConfig->sys.deviceName);
} }
String getIp(void) { virtual String getIp(void) override {
if(Mode::WIRELESS == mMode) if(Mode::WIRELESS == mMode)
return AhoyWifi::getIp(); return AhoyWifi::getIp();
else else
return ETH.localIP().toString(); return ETH.localIP().toString();
} }
String getMac(void) { virtual String getMac(void) override {
if(Mode::WIRELESS == mMode) if(Mode::WIRELESS == mMode)
return AhoyWifi::getMac(); return AhoyWifi::getMac();
else else
return ETH.macAddress(); return mEthSpi.macAddress();
} }
bool isWiredConnection() { virtual bool isWiredConnection() override {
return (Mode::WIRED == mMode); return (Mode::WIRED == mMode);
} }
private: private:
void OnEvent(WiFiEvent_t event) { virtual void OnEvent(WiFiEvent_t event) override {
switch(event) { switch(event) {
case ARDUINO_EVENT_ETH_CONNECTED:
mMode = Mode::WIRED; // needed for static IP
[[fallthrough]];
case SYSTEM_EVENT_STA_CONNECTED: case SYSTEM_EVENT_STA_CONNECTED:
mWifiConnecting = false; mWifiConnecting = false;
[[fallthrough]];
case ARDUINO_EVENT_ETH_CONNECTED:
if(NetworkState::CONNECTED != mStatus) { if(NetworkState::CONNECTED != mStatus) {
if(ARDUINO_EVENT_ETH_CONNECTED == event) if(ARDUINO_EVENT_ETH_CONNECTED == event)
WiFi.disconnect(); WiFi.disconnect();

10
src/network/AhoyEthernetSpi.h

@ -116,10 +116,14 @@ class AhoyEthernetSpi {
} }
String macAddress() { String macAddress() {
uint8_t mac_addr[6] = {0, 0, 0, 0, 0, 0}; uint8_t mac_addr[6];
esp_eth_ioctl(eth_handle, ETH_CMD_G_MAC_ADDR, mac_addr); esp_eth_ioctl(eth_handle, ETH_CMD_G_MAC_ADDR, mac_addr);
char mac_addr_str[24]; char mac_addr_str[19];
snprintf(mac_addr_str, sizeof(mac_addr_str), "%02X:%02X:%02X:%02X:%02X:%02X", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]); for(uint8_t i = 0; i < 6; i++) {
snprintf(&mac_addr_str[i*3], sizeof(mac_addr_str), "%02X", mac_addr[i]);
mac_addr_str[i*3+2] = ':';
}
mac_addr_str[17] = '\0';
return String(mac_addr_str); return String(mac_addr_str);
} }

4
src/network/AhoyWifiEsp32.h

@ -41,11 +41,11 @@ class AhoyWifi : public AhoyNetwork {
mAp.tickLoop(); mAp.tickLoop();
} }
String getIp(void) override { virtual String getIp(void) override {
return WiFi.localIP().toString(); return WiFi.localIP().toString();
} }
String getMac(void) override { virtual String getMac(void) override {
return WiFi.macAddress(); return WiFi.macAddress();
} }

10
src/web/html/setup.html

@ -457,11 +457,11 @@
[1, "GPIO1"], [1, "GPIO1"],
[2, "GPIO2"], [2, "GPIO2"],
[3, "GPIO3"], [3, "GPIO3"],
[4, "GPIO4"], [4, "GPIO4 (CMT CSB)"],
[5, "GPIO5"], [5, "GPIO5 (CMT SDIO)"],
[6, "GPIO6"], [6, "GPIO6 (CMT SCLK)"],
[7, "GPIO7"], [7, "GPIO7"],
[8, "GPIO8"], [8, "GPIO8 (CMT GPIO3)"],
[9, "GPIO9 (DATA display)"], [9, "GPIO9 (DATA display)"],
[10, "GPIO10 (SCK display)"], [10, "GPIO10 (SCK display)"],
[11, "GPIO11 (CS display)"], [11, "GPIO11 (CS display)"],
@ -474,7 +474,7 @@
[18, "GPIO18"], [18, "GPIO18"],
[19, "GPIO19 ({#PIN_DONT_USE} - USB-)"], [19, "GPIO19 ({#PIN_DONT_USE} - USB-)"],
[20, "GPIO20 ({#PIN_DONT_USE} - USB+)"], [20, "GPIO20 ({#PIN_DONT_USE} - USB+)"],
[21, "GPIO21"], [21, "GPIO21 (CMT FCSB)"],
[26, "GPIO26 (PSRAM - {#PIN_NOT_AVAIL})"], [26, "GPIO26 (PSRAM - {#PIN_NOT_AVAIL})"],
[27, "GPIO27 (FLASH - {#PIN_NOT_AVAIL})"], [27, "GPIO27 (FLASH - {#PIN_NOT_AVAIL})"],
[28, "GPIO28 (FLASH - {#PIN_NOT_AVAIL})"], [28, "GPIO28 (FLASH - {#PIN_NOT_AVAIL})"],

Loading…
Cancel
Save