Skip to content

Commit

Permalink
fix: send logs if connection is ready
Browse files Browse the repository at this point in the history
  • Loading branch information
darlanalves authored Feb 19, 2024
1 parent a583b7a commit ac562ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/include/vm_instructions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ void MOVE_TO_FLASH vm_load(Program *program, byteref _bytes, int length)
program->counter = 0;
program->paused = false;

_printf(program, "[i] Loaded %u bytes\n", length);
_printf(program, "[i] Loaded %d bytes\n", length);
os_timer_setfn(&program->timer, &vm_tick, program);
os_timer_arm(&program->timer, 1, 0);
}
Expand Down
5 changes: 2 additions & 3 deletions src/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,9 @@ void onReceive(void *arg, char *data, unsigned short length)

void onSend(char *data, int length)
{
TRACE("send %d bytes\n", length);
TRACE("conn state: %d\n", conn->state);
TRACE("send %d bytes, state %d\n", length, conn->state);
printBuffer(data, length);
if (conn->state == ESPCONN_CONNECT)
if (conn->state == ESPCONN_CONNECT || conn->state == ESPCONN_WRITE)
{
espconn_send(conn, (uint8 *)data, length);
}
Expand Down

0 comments on commit ac562ed

Please sign in to comment.