Skip to content

Commit f90c10a

Browse files
committed
Merge branch 'main' into ethernet_debugging
2 parents cc5ad5f + 79e014e commit f90c10a

File tree

10 files changed

+875
-28
lines changed

10 files changed

+875
-28
lines changed

Diff for: libraries/Arduino_LED_Matrix/examples/TextWithArduinoGraphics/TextWithArduinoGraphics.ino

+5-7
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,20 @@
55
ArduinoLEDMatrix matrix;
66

77
void setup() {
8-
Serial.begin(115200);
98
matrix.begin();
109

1110
matrix.beginDraw();
11+
1212
matrix.stroke(0xFFFFFFFF);
13-
// add some static text
14-
// will only show "UNO" (not enough space on the display)
15-
const char text[] = "UNO r4";
13+
matrix.textScrollSpeed(100);
14+
15+
const char text[] = " UNO r4 ";
1616
matrix.textFont(Font_4x6);
1717
matrix.beginText(0, 1, 0xFFFFFF);
1818
matrix.println(text);
19-
matrix.endText();
19+
matrix.endText(SCROLL_LEFT);
2020

2121
matrix.endDraw();
22-
23-
delay(2000);
2422
}
2523

2624
void loop() {

Diff for: libraries/Arduino_LED_Matrix/src/Arduino_LED_Matrix.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#pragma once
2+
13
#include "Arduino.h"
24
#include "FspTimer.h"
35
#include "gallery.h"
@@ -248,7 +250,7 @@ class ArduinoLEDMatrix
248250

249251
#ifdef MATRIX_WITH_ARDUINOGRAPHICS
250252
virtual void set(int x, int y, uint8_t r, uint8_t g, uint8_t b) {
251-
if (y >= canvasHeight || x >= canvasWidth) {
253+
if (y >= canvasHeight || x >= canvasWidth || y < 0 || x < 0) {
252254
return;
253255
}
254256
// the r parameter is (mis)used to set the character to draw with
@@ -300,4 +302,4 @@ class ArduinoLEDMatrix
300302
}
301303
}
302304
}
303-
};
305+
};

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

+18-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,12 +30,15 @@ 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
}
41+
return ESP_CONTROL_OK;
4242
}
4343

4444
int stationDisconnectionEvent(CCtrlMsgWrapper *resp) {
@@ -47,6 +47,7 @@ int stationDisconnectionEvent(CCtrlMsgWrapper *resp) {
4747
Serial.print("[EVENT !!!!]: C33 was disconnected from AP for reason ");
4848
Serial.println(reason);
4949
}
50+
return ESP_CONTROL_OK;
5051
}
5152

5253
int disconnectionFromSofApEvent(CCtrlMsgWrapper *resp) {
@@ -56,6 +57,7 @@ int disconnectionFromSofApEvent(CCtrlMsgWrapper *resp) {
5657
Serial.print(MAC);
5758
Serial.println(" disconnected from ESP32 Soft AP");
5859
}
60+
return ESP_CONTROL_OK;
5961
}
6062

6163

@@ -65,6 +67,7 @@ int heartBeatEvent(CCtrlMsgWrapper *resp) {
6567
Serial.print("[EVENT !!!!]: heart beat n ");
6668
Serial.println(hb);
6769
}
70+
return ESP_CONTROL_OK;
6871
}
6972

7073

@@ -83,10 +86,19 @@ void setup() {
8386
CEspControl::getInstance().listenForDisconnectionFromSoftApEvent(disconnectionFromSofApEvent);
8487

8588

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

88101
Serial.println("STARTING PROGRAM");
89-
delay(1000);
90102
}
91103

92104

@@ -685,7 +697,7 @@ int displayMenu() {
685697
cmd_acquired = true;
686698
rv = stoi(c);
687699
}
688-
else {
700+
else if(ch >= '0' && ch <='9') {
689701
c += ch;
690702
}
691703
}

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

Diff for: libraries/Ethernet/src/Ethernet.cpp

+12-9
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,32 @@ int CEthernet::begin(unsigned long timeout, unsigned long responseTimeout) {
2828
/* -------------------------------------------------------------------------- */
2929
int CEthernet::begin(IPAddress local_ip) {
3030
/* -------------------------------------------------------------------------- */
31-
IPAddress subnet(255, 255, 255, 0);
32-
return begin(local_ip, subnet);
31+
// Assume the DNS server will be the machine on the same network as the local IP
32+
// but with last octet being '1'
33+
IPAddress dns_server = local_ip;
34+
dns_server[3] = 1;
35+
return begin(local_ip, dns_server);
3336
}
3437

3538
/* -------------------------------------------------------------------------- */
36-
int CEthernet::begin(IPAddress local_ip, IPAddress subnet) {
39+
int CEthernet::begin(IPAddress local_ip, IPAddress dns_server) {
3740
/* -------------------------------------------------------------------------- */
3841
// Assume the gateway will be the machine on the same network as the local IP
3942
// but with last octet being '1'
4043
IPAddress gateway = local_ip;
4144
gateway[3] = 1;
42-
return begin(local_ip, subnet, gateway);
45+
return begin(local_ip, dns_server, gateway);
4346
}
4447

4548
/* -------------------------------------------------------------------------- */
46-
int CEthernet::begin(IPAddress local_ip, IPAddress subnet, IPAddress gateway) {
49+
int CEthernet::begin(IPAddress local_ip, IPAddress dns_server, IPAddress gateway) {
4750
/* -------------------------------------------------------------------------- */
48-
// Assume the DNS server will be the same machine than gateway
49-
return begin(local_ip, subnet, gateway, gateway);
51+
IPAddress subnet(255, 255, 255, 0);
52+
return begin(local_ip, dns_server, gateway, subnet);
5053
}
5154

5255
/* -------------------------------------------------------------------------- */
53-
int CEthernet::begin(IPAddress local_ip, IPAddress subnet, IPAddress gateway, IPAddress dns_server) {
56+
int CEthernet::begin(IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet) {
5457
/* -------------------------------------------------------------------------- */
5558

5659
ni = CLwipIf::getInstance().get(NI_ETHERNET, local_ip, gateway, subnet);
@@ -108,7 +111,7 @@ int CEthernet::begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_ser
108111
int CEthernet::begin(uint8_t *mac, IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet, unsigned long timeout, unsigned long responseTimeout) {
109112
/* -------------------------------------------------------------------------- */
110113
CLwipIf::getInstance().setMacAddress(NI_ETHERNET, mac);
111-
return begin(local_ip, subnet, gateway, dns_server);
114+
return begin(local_ip, dns_server, gateway, subnet);
112115
}
113116

114117
/* -------------------------------------------------------------------------- */

Diff for: libraries/Ethernet/src/EthernetC33.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ class CEthernet {
4141
int begin(unsigned long timeout = 60000, unsigned long responseTimeout = 4000);
4242
EthernetLinkStatus linkStatus();
4343
int begin(IPAddress local_ip);
44-
int begin(IPAddress local_ip, IPAddress subnet);
45-
int begin(IPAddress local_ip, IPAddress subnet, IPAddress gateway);
46-
int begin(IPAddress local_ip, IPAddress subnet, IPAddress gateway, IPAddress dns_server);
44+
int begin(IPAddress local_ip, IPAddress dns_server);
45+
int begin(IPAddress local_ip, IPAddress dns_server, IPAddress gateway);
46+
int begin(IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet);
4747
// Initialise the Ethernet shield to use the provided MAC address and gain the rest of the
4848
// configuration through DHCP.
4949
// Returns 0 if the DHCP configuration failed, and 1 if it succeeded

0 commit comments

Comments
 (0)