Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comamnd handler debug #45

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions main/CommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,14 +438,17 @@ int availDataTcp(const uint8_t command[], uint8_t response[])
{
uint8_t socket = command[4];
uint16_t available = 0;

ets_printf("Handling availDataTcp");
if (socketTypes[socket] == 0x00) {
ets_printf("Socket type is 0");
if (tcpServers[socket]) {
ets_printf("Socket is a tcpServer");
WiFiClient client = tcpServers[socket].available();

available = 255;

if (client) {
ets_printf("Client is available on server socket - finding a slot ");
// try to find existing socket slot
for (int i = 0; i < MAX_SOCKETS; i++) {
if (i == socket) {
Expand Down Expand Up @@ -477,6 +480,7 @@ int availDataTcp(const uint8_t command[], uint8_t response[])
}
}
} else {
ets_printf("Looking in clients list for the socket");
available = tcpClients[socket].available();
}
} else if (socketTypes[socket] == 0x01) {
Expand All @@ -491,7 +495,7 @@ int availDataTcp(const uint8_t command[], uint8_t response[])

response[2] = 1; // number of parameters
response[3] = sizeof(available); // parameter 1 length

ets_printf("Copying data about available data.");
memcpy(&response[4], &available, sizeof(available));

return 7;
Expand Down
2 changes: 1 addition & 1 deletion main/sketch.ino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extern "C" {

#define SPI_BUFFER_LEN SPI_MAX_DMA_LEN

int debug = 0;
int debug = 1;

uint8_t* commandBuffer;
uint8_t* responseBuffer;
Expand Down