Skip to content

Commit 9ec7d4b

Browse files
committed
Merge branch 'master' of https://github.com/OpenEVSE/ESP32_WiFi_V4.x into fix#411
2 parents bd8984b + fb11345 commit 9ec7d4b

File tree

9 files changed

+786
-771
lines changed

9 files changed

+786
-771
lines changed

docs/developer-guide.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ PlatformIO can be installed as a command line utility (PlatformIO Core), a stand
3939
#### 2. Clone this repo
4040

4141
```bash
42-
git clone https://github.com/OpenEVSE/ESP32_WiFi_v3.x
42+
git clone https://github.com/OpenEVSE/ESP32_WiFi_V4.x.git
4343
```
4444

4545
#### 3. Compile & upload
@@ -59,6 +59,10 @@ If you are using a different development board, you can specify one of the envs
5959
pio run -e openevse_huzzah32_idf -t upload
6060
```
6161

62+
Build artifacts will be in `.pio/build/your_openevse_env`
63+
64+
To clean an existing build, `pio run -e your_openevse_board -t`
65+
6266
> To enable OTA updates, first upload via serial using the dev environment. This enables OTA enable build flag
6367
6468
***

docs/wired-ethernet.md

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
# Wired Ethernet using ESP32-Gateway
1+
# Wired Ethernet
22

3-
Sometimes getting a WiFi connection to an OpenEVSE / EmonEVSE install location can be troublesome.
3+
Several boards are available with ethernet hardware, which can be used as drop-in replacements for ESP8266 / ESP32 WiFi modules and are compatible with all models of OpenEVSE / EmonEVSE.
44

5-
It's now possible to connect the OpenEVSE / EmonEVSE via wired Ethernet using an ESP32-Gateway module. This module is a drop in replacement for ESP8266 / ESP32 WiFi modules and is compatible with all models of OpenEVSE / EmonEVSE.
65

76
See [OpenEnergyMonitor web-store to purchase a pre-wired ESP32-Gateway module](https://shop.openenergymonitor.com/openevse-etherent-gateway-esp32/). The Ethernet gateway in our web-store will come with pre-wired power supply, serial connections, and pre-loaded with firmware for drop in replacement.
87

@@ -12,16 +11,19 @@ Network connection can be made with a standard Ethernet cable. For new installat
1211

1312
## Hardware Connections
1413

15-
See [photos](https://photos.google.com/share/AF1QipNvANgeR_NRmLrq0lhKnA0BR7ieD8DGRoaJFoilMIwQ8c7QpxR4X7hSfGj3XiTTUw) of hardware connectors for new OpenEVSE V5.5 controller.
14+
Wiring varies depending on the board in use, in particular [this git issue](https://github.com/OpenEVSE/ESP32_WiFi_V3.x/issues/12) discusses a wiring change between revisions of the ESP32-GATEWAY board.
15+
1616

17-
> **Note**: The these hardware connections apply to the current Rev.E & Rev.F ESP32-gateway hardware revisions. See section below for older units.
17+
| Signal | EVSE wire | ESP32-GATEWAY E & F | ESP32-GATEWAY pre-E | ESP32-PoE-ISO
18+
| :--------- | :---------- | :------------------ | :------------------ | :------------
19+
| 5V | Red wire | 20 | 20 | N/C (powered over Ethernet)
20+
| GND | Black wire | 19 | 19 | GND
21+
| Tx GPIO 32 | Yellow wire | **13** | **12** | 33
22+
| Rx GPIO 16 | Green wire | 11 | 11 | 35
23+
24+
See [photos](https://photos.google.com/share/AF1QipNvANgeR_NRmLrq0lhKnA0BR7ieD8DGRoaJFoilMIwQ8c7QpxR4X7hSfGj3XiTTUw) of hardware connectors for new OpenEVSE V5.5 controller.
1825

19-
|Signal | Pin No. | EVSE connector |
20-
| :---------- | :---------- | :------------------- |
21-
5V | pin 20 | Red wire |
22-
GND | pin 19 | Black wire |
23-
Tx GPIO 32 | pin 13 | Yellow wire |
24-
Rx GPIO 16 | pin 11 | Green wire |
26+
> **Note**: The these hardware connections apply to the current Rev.E & Rev.F ESP32-gateway hardware revisions. See table above for other units.
2527
2628
![esp32-gateway-connections](esp32-gateway-connections.jpg)
2729

@@ -44,13 +46,13 @@ ESP32-gateway can be connected by micro USB and firmware can be uploaded using e
4446
First upload:
4547

4648
```bash
47-
esptool esptool.py --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 bootloader.bin 0x8000 partitions.bin 0x10000 openevse_esp32-gateway-e.bin
49+
esptool.py --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 bootloader.bin 0x8000 partitions.bin 0x10000 openevse_esp32-gateway-e.bin
4850
```
4951

5052
Subsequent upgrades:
5153

5254
```bash
53-
esptool esptool.py --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 0x10000 openevse_esp32-gateway-e.bin
55+
esptool.py --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 0x10000 openevse_esp32-gateway-e.bin
5456
```
5557

5658
### For rev G
@@ -69,9 +71,14 @@ esptool.py --before default_reset --after hard_reset write_flash 0x10000 openevs
6971

7072
## Compile and Upload
7173

72-
Firmware can be compiled and upload using PlatformIO with the `openevse_esp32-gateway-e` environment selected. The `e` environment has been tested to work on hardware Rev.E and Rev.F. See note below for older revisions.
74+
| Board | Environment |
75+
| :------------------------ | :----------------------- |
76+
| ESP32-GATEWAY pre-E | openevse_esp32-gateway |
77+
| ESP32-GATEWAY E and later | openevse_esp32-gateway-e |
78+
| ESP32-PoE-ISO | openevse_esp32-poe-iso |
7379

74-
The ESP32-gateway can be connected via micro USB and firmware compiled and uploaded with
80+
81+
Firmware can be compiled using PlatformIO `pio run -e <Environment>`. The `-t upload` option installs firmware over USB.
7582

7683
```bash
7784
pio run -e openevse_esp32-gateway-e -t upload
@@ -93,22 +100,3 @@ The web UI will notify that connection is via Wired Ethernet.
93100

94101
The ESP32-Gateway is a new addition and is currently considered in 'Beta' since the ESP32 firmware is still under active development. However, it has been extensively tested and proven reliable for many months of operation. Please report your experience to the [OpenEnergyMonitor Community Forums](https://community.openenergymonitor.org/).
95102
***
96-
97-
## Older Hardware Revisions
98-
99-
This guide focuses on using ESP-gateway hardware rev.E and above. If using a hardware rev older than rev.E the pin connections and firmware is different:
100-
101-
|Signal | Pin No. | EVSE connector |
102-
| :---------- | :---------- | :------------------- |
103-
5V | pin 20 | Red wire |
104-
GND | pin 19 | Black wire |
105-
Tx GPIO 17 | pin 12 | Yellow wire |
106-
Rx GPIO 16 | pin 11 | Green wire |
107-
108-
Firmware for older hardware revisions can be compiled and uploading using:
109-
110-
```bash
111-
pio run -e openevse_esp32-gateway -t upload
112-
```
113-
114-
See [this git issue](https://github.com/OpenEVSE/ESP32_WiFi_V3.x/issues/12) for discussion of hardware revision changes.

gui

platformio.ini

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,28 @@ build_flags =
266266
-D RANDOM_SEED_CHANNEL=1
267267
-D RX2=16
268268
-D TX2=32
269-
-D PHY_PWR=5
269+
-D ETH_PHY_POWER=5
270+
-D RESET_ETH_PHY_ON_BOOT=1
270271
board_build.extra_flags = "-DARDUINO_ESP32_GATEWAY=\'E\'"
271272
upload_speed = 921600
272273

274+
[env:openevse_esp32-poe-iso]
275+
# Tested against Rev C board
276+
extends = env:openevse_esp32-gateway
277+
board = esp32-poe-iso
278+
build_flags =
279+
${common.build_flags}
280+
${common.version}
281+
${common.src_build_flags}
282+
-D WIFI_BUTTON=34
283+
-D WIFI_BUTTON_PRESSED_STATE=LOW
284+
-D DEBUG_PORT=Serial
285+
-D RAPI_PORT=Serial2
286+
-D ENABLE_WIRED_ETHERNET
287+
-D RANDOM_SEED_CHANNEL=1
288+
-D RESET_ETH_PHY_ON_BOOT=1
289+
upload_speed = 921600
290+
273291
[env:openevse_esp32-gateway-e_dev]
274292
extends = env:openevse_esp32-gateway-e
275293
build_flags =

src/http_update.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ bool http_update_start(String source, size_t total)
8888

8989
bool http_update_write(uint8_t *data, size_t len)
9090
{
91+
// Issue #187 "HTTP update fails on ESP32 ethernet gateway" was caused by the
92+
// loop watchdog timing out, presumably because updating wasn't bottlenecked
93+
// by network and execution stayed in the Mongoose poll() method.
94+
feedLoopWDT();
95+
9196
DBUGF("Update Writing %u, %u", update_position, len);
9297
size_t written = Update.write(data, len);
9398
DBUGVAR(written);

src/lcd.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ void LcdTask::displayInfoLine(LcdInfoLine line, unsigned long &nextUpdate)
546546
gettimeofday(&local_time, NULL);
547547
struct tm timeinfo;
548548
localtime_r(&local_time.tv_sec, &timeinfo);
549-
strftime(temp, sizeof(temp), "%d/%m/%Y", &timeinfo);
549+
strftime(temp, sizeof(temp), "%Y-%m-%d", &timeinfo);
550550
displayNameValue(1, "Date", temp);
551551
_updateInfoLine = false;
552552
} break;
@@ -624,10 +624,10 @@ void LcdTask::displayScaledNumberValue(int line, const char *name, double value,
624624
static const char *mod[] = {
625625
"",
626626
"k",
627-
"m",
628-
"g",
629-
"t",
630-
"p"
627+
"M",
628+
"G",
629+
"T",
630+
"P"
631631
};
632632

633633
int index = 0;

src/net_manager.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -420,15 +420,14 @@ net_setup()
420420
#ifdef ENABLE_WIRED_ETHERNET
421421
//ETH.setHostname(esp_hostname.c_str());
422422

423-
#ifdef PHY_PWR
424-
pinMode(PHY_PWR, OUTPUT);
425-
digitalWrite(PHY_PWR, LOW);
423+
pinMode(ETH_PHY_POWER, OUTPUT);
424+
#ifdef RESET_ETH_PHY_ON_BOOT
425+
digitalWrite(ETH_PHY_POWER, LOW);
426426
delay(1000);
427-
digitalWrite(PHY_PWR, HIGH);
428-
#endif
429-
427+
#endif // #ifdef RESET_ETH_PHY_ON_BOOT
428+
digitalWrite(ETH_PHY_POWER, HIGH);
430429
ETH.begin();
431-
#endif
430+
#endif // #ifdef ENABLE_WIRED_ETHERNET
432431

433432
if (MDNS.begin(esp_hostname.c_str()))
434433
{

0 commit comments

Comments
 (0)