mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-25 13:41:23 +01:00
counter should be int, not uint8_t
This commit is contained in:
parent
1c7a5320d8
commit
19b4893b5f
13
WifiESP.cpp
13
WifiESP.cpp
@ -37,7 +37,7 @@ static void handleError(void* arg, AsyncClient* client, int8_t error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void handleData(void* arg, AsyncClient* client, void *data, size_t len) {
|
static void handleData(void* arg, AsyncClient* client, void *data, size_t len) {
|
||||||
DIAG(F("data received from client %s"), client->remoteIP().toString().c_str());
|
//DIAG(F("data received from client %s"), client->remoteIP().toString().c_str());
|
||||||
uint8_t clientId;
|
uint8_t clientId;
|
||||||
for (clientId=0; clientId<clients.size(); clientId++){
|
for (clientId=0; clientId<clients.size(); clientId++){
|
||||||
if (clients[clientId] == client) break;
|
if (clients[clientId] == client) break;
|
||||||
@ -160,10 +160,10 @@ void WifiESP::loop() {
|
|||||||
int clientId=outboundRing->read();
|
int clientId=outboundRing->read();
|
||||||
if (clientId>=0) {
|
if (clientId>=0) {
|
||||||
int count=outboundRing->count();
|
int count=outboundRing->count();
|
||||||
DIAG(F("Wifi reply client=%d, count=%d"), clientId,count);
|
//DIAG(F("Wifi reply client=%d, count=%d"), clientId,count);
|
||||||
{
|
{
|
||||||
char buffer[count+1];
|
char buffer[count+1];
|
||||||
for(uint8_t i=0;i<count;i++) {
|
for(int i=0;i<count;i++) {
|
||||||
int c = outboundRing->read();
|
int c = outboundRing->read();
|
||||||
if (c >= 0)
|
if (c >= 0)
|
||||||
buffer[i] = (char)c;
|
buffer[i] = (char)c;
|
||||||
@ -173,8 +173,11 @@ void WifiESP::loop() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
buffer[count]=0;
|
buffer[count]=0;
|
||||||
DIAG(F("SEND:%s COUNT:%d"),buffer,count);
|
//DIAG(F("SEND:%s COUNT:%d"),buffer,count);
|
||||||
sendData(clientId, buffer, count);
|
while (! sendData(clientId, buffer, count)) {
|
||||||
|
DIAG(F("senData fail"));
|
||||||
|
yield();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user