Skip to content

Commit 3ca97d0

Browse files
committed
ESPHost library - make the example work
and remove unnecessary dependency to LwipWrapper library and its dependencies
1 parent 6ee152f commit 3ca97d0

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

Diff for: libraries/ESPhost/examples/ESP32_TEST/ESP32_TEST.ino

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "CEspControl.h"
2-
#include "CNetIf.h"
32
#include <string>
43
#include <vector>
54

@@ -23,8 +22,6 @@ using namespace std;
2322

2423
#define SerialESP Serial5
2524

26-
extern int esp_host_spi_init();
27-
2825
void getESPDebugLog();
2926
int displayMenu();
3027
void makeRequest(int req);
@@ -33,11 +30,13 @@ string prompt(string p);
3330

3431
const char mac_address[] = "aa:bb:cc:dd:ee:ff";
3532

33+
bool wifiHwInitialized = false;
3634

3735

3836
int initEvent(CCtrlMsgWrapper *resp) {
3937
if(resp->isInitEventReceived() == ESP_CONTROL_OK) {
4038
Serial.println("[EVENT !!!!]: Init event received");
39+
wifiHwInitialized = true;
4140
}
4241
}
4342

@@ -83,10 +82,19 @@ void setup() {
8382
CEspControl::getInstance().listenForDisconnectionFromSoftApEvent(disconnectionFromSofApEvent);
8483

8584

86-
85+
int err = CEspControl::getInstance().initSpiDriver();
86+
if (err != 0) {
87+
Serial.print("Error initSpiDriver err ");
88+
Serial.println(err);
89+
} else {
90+
Serial.println("initSpiDriver OK");
91+
}
92+
while (!wifiHwInitialized) {
93+
CEspControl::getInstance().communicateWithEsp();
94+
delay(100);
95+
}
8796

8897
Serial.println("STARTING PROGRAM");
89-
delay(1000);
9098
}
9199

92100

@@ -685,7 +693,7 @@ int displayMenu() {
685693
cmd_acquired = true;
686694
rv = stoi(c);
687695
}
688-
else {
696+
else if(ch >= '0' && ch <='9') {
689697
c += ch;
690698
}
691699
}

Diff for: libraries/ESPhost/src/CEspControl.h

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include "CCtrlWrapper.h"
3636
#include "CEspCommunication.h"
3737
#include "EspSpiDriver.h"
38-
#include "CNetIf.h"
3938
#include "CEspCbks.h"
4039
#include <string>
4140

0 commit comments

Comments
 (0)