Skip to content

Commit c92e926

Browse files
committed
Merge branch 'master' of github.com:OpenEVSE/ESP32_WiFi_V3.x
2 parents c24ea20 + 52b7d53 commit c92e926

File tree

4 files changed

+34
-40
lines changed

4 files changed

+34
-40
lines changed

platformio.ini

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ platform = https://github.com/platformio/platform-espressif8266.git#release/v1.6
8181
platform_stage = https://github.com/platformio/platform-espressif8266.git#feature/stage
8282
#platform_esp32 = https://github.com/platformio/platform-espressif32.git#feature/stage
8383
#platform_esp32 = https://github.com/platformio/platform-espressif32.git#develop
84-
platform_esp32 = [email protected].0
84+
platform_esp32 = [email protected].1
8585

8686
[env:openevse]
8787
platform = ${common.platform}
@@ -200,31 +200,8 @@ extra_scripts = ${common.extra_scripts}
200200
board_build.partitions = ${common.build_partitions_esp32}
201201

202202
[env:openevse_esp-wrover-kit_idf]
203-
platform = ${common.platform_esp32}
204-
board = esp-wrover-kit
203+
extends = env:openevse_esp-wrover-kit
205204
framework = arduino, espidf
206-
lib_deps = ${common.lib_deps}
207-
src_build_flags =
208-
${common.version}.dev
209-
${common.src_build_flags}
210-
${common.src_build_flags_esp32}
211-
${common.debug_flags_esp32}
212-
-DWIFI_LED=4
213-
-DWIFI_BUTTON=2
214-
-DWIFI_LED_ON_STATE=HIGH
215-
-DRAPI_PORT=Serial1
216-
-DONBOARD_LEDS=0,2,4
217-
build_flags =
218-
${common.build_flags}
219-
${common.build_flags_esp32}
220-
-DRX1=25
221-
-DTX1=27
222-
#upload_port = openevse.local
223-
#upload_speed = 921600
224-
upload_protocol = ftdi
225-
monitor_speed = 115200
226-
extra_scripts = ${common.extra_scripts}
227-
board_build.partitions = ${common.build_partitions_esp32}
228205

229206
# export PLATFORMIO_UPLOAD_PORT=172.16.0.157
230207
# export PLATFORMIO_UPLOAD_FLAGS="-p 3232"
@@ -254,6 +231,10 @@ monitor_speed = 115200
254231
extra_scripts = ${common.extra_scripts}
255232
board_build.partitions = ${common.build_partitions_esp32}
256233

234+
[env:openevse_huzzah32_idf]
235+
extends = env:openevse_huzzah32
236+
framework = arduino, espidf
237+
257238
[env:openevse_featheresp32]
258239
platform = ${common.platform_esp32}
259240
board = featheresp32

src/RapiSender.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ RapiSender::sendCmd(String &cmdstr, RapiCommandCompleteHandler callback, unsigne
194194
if(!_waitingForReply) {
195195
_sendNextCmd();
196196
}
197-
} else {
197+
} else if(nullptr != callback) {
198198
callback(RAPI_RESPONSE_QUEUE_FULL);
199199
}
200200
}

src/main.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,9 @@ void setup()
6464
HAL.begin();
6565

6666
DEBUG.println();
67-
DEBUG.print("OpenEVSE WiFI ");
68-
DEBUG.println(HAL.getShortId());
69-
DEBUG.println("Firmware: " + currentfirmware);
70-
67+
DEBUG.printf("OpenEVSE WiFI %s\n", HAL.getShortId().c_str());
68+
DEBUG.printf("Firmware: %s\n", currentfirmware.c_str());
69+
DEBUG.printf("IDF version: %s\n", ESP.getSdkVersion());
7170
DEBUG.printf("Free: %d\n", HAL.getFreeHeap());
7271

7372
// Read saved settings from the config

src/net_manager.cpp

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,11 @@ startClient()
111111

112112
client_disconnects = 0;
113113

114-
WiFi.begin(esid.c_str(), epass.c_str());
115-
#ifdef ESP32
116-
WiFi.enableSTA(true);
117-
WiFi.setHostname(esp_hostname.c_str());
118-
DBUGVAR(WiFi.getHostname());
119-
#else
114+
#ifndef ESP32
120115
WiFi.hostname(esp_hostname.c_str());
121-
WiFi.enableSTA(true);
122116
#endif // !ESP32
117+
118+
WiFi.begin(esid.c_str(), epass.c_str());
123119
}
124120

125121
static void net_wifi_start()
@@ -138,8 +134,6 @@ static void net_wifi_start()
138134

139135
static void display_state()
140136
{
141-
DBUGVAR(WiFi.getHostname());
142-
143137
lcd_display(F("Hostname:"), 0, 0, 0, LCD_CLEAR_LINE);
144138
lcd_display(esp_hostname.c_str(), 0, 1, 5000, LCD_CLEAR_LINE);
145139

@@ -261,6 +255,22 @@ void net_event(WiFiEvent_t event, system_event_info_t info)
261255

262256
switch (event)
263257
{
258+
case SYSTEM_EVENT_AP_START:
259+
{
260+
if(WiFi.softAPsetHostname(esp_hostname.c_str())) {
261+
DBUGF("Set host name to %s", WiFi.softAPgetHostname());
262+
} else {
263+
DBUGF("Setting host name failed: %s", esp_hostname.c_str());
264+
}
265+
} break;
266+
case SYSTEM_EVENT_STA_START:
267+
{
268+
if(WiFi.setHostname(esp_hostname.c_str())) {
269+
DBUGF("Set host name to %s", WiFi.getHostname());
270+
} else {
271+
DBUGF("Setting host name failed: %s", esp_hostname.c_str());
272+
}
273+
} break;
264274
case SYSTEM_EVENT_STA_CONNECTED:
265275
{
266276
auto& src = info.connected;
@@ -308,7 +318,11 @@ void net_event(WiFiEvent_t event, system_event_info_t info)
308318
case SYSTEM_EVENT_ETH_START:
309319
DBUGLN("ETH Started");
310320
//set eth hostname here
311-
ETH.setHostname("esp32-ethernet");
321+
if(ETH.setHostname(esp_hostname.c_str())) {
322+
DBUGF("Set host name to %s", WiFi.getHostname());
323+
} else {
324+
DBUGF("Setting host name failed: %s", esp_hostname.c_str());
325+
}
312326
break;
313327
case SYSTEM_EVENT_ETH_CONNECTED:
314328
DBUGLN("ETH Connected");

0 commit comments

Comments
 (0)