Skip to content

Commit 5ee77b5

Browse files
committed
Code optimization, bugfix DHCP settings.
1 parent ac49705 commit 5ee77b5

File tree

4 files changed

+231
-220
lines changed

4 files changed

+231
-220
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Get the hardware (cheap clones from China are sufficient) and connect together:
5656
Rx0 <-> RO<br>
5757
Pin 6 <-> DE,RE
5858

59+
5960
Here is my setup:
6061
Terminal shield + Arduino Nano + W5500 eth shield (RobotDyn) + TTL to RS485 module (HW automatic flow control)
6162
<img src="/pics/HW.jpg" alt="01" style="zoom:100%;" />
@@ -93,7 +94,7 @@ The code was tested on Arduino Nano, Uno and Mega, ethernet chips W5100 and W550
9394

9495
#### Ethernet socket
9596

96-
The default Ethernet.h library determines MAX_SOCK_NUM by microcontroller RAM (not by Ethernet chip type). So if you use W5500 (which has 8 sockets available) on Arduino Nano, only 4 sockets will be used. If you want to force the library to use 8 sockets, edit https://github.com/arduino-libraries/Ethernet/blob/master/src/Ethernet.h#L36
97+
The default Ethernet.h library determines MAX_SOCK_NUM by microcontroller RAM (not by Ethernet chip type). So if you use W5500 (which has 8 sockets available) on Arduino Nano, only 4 sockets will be used. If you want to force the library to use 8 sockets, redefine MAX_SOCK_NUM in advanced settings in the sketch.
9798

9899
#### Memory
99100

arduino-modbus-rtu-tcp-gateway/04-webserver.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,11 @@ void processPost(char postParameter[]) {
205205
char *sav2 = NULL; // for inner strtok_r
206206
paramKey = strtok_r(point, "=", &sav2); // inner strtok_r, use sav2
207207
paramValue = strtok_r(NULL, "=", &sav2);
208-
if (!paramValue) continue;
208+
point = strtok_r(NULL, "&", &sav1);
209+
if (!paramValue)
210+
continue; // do not process POST parameter if there is no parameter value
209211
byte paramKeyByte = atoi(paramKey);
210212
unsigned long paramValueUlong = atol(paramValue);
211-
212213
switch (paramKeyByte) {
213214
case POST_NONE: // reserved, because atoi / atol returns NULL in case of error
214215
break;
@@ -307,7 +308,6 @@ void processPost(char postParameter[]) {
307308
default:
308309
break;
309310
}
310-
point = strtok_r(NULL, "&", &sav1);
311311
} // while (point != NULL)
312312
switch (action) {
313313
case FACTORY:

0 commit comments

Comments
 (0)