From ac562ed30d8674ddd12541f2b5ec2bb8417f39b8 Mon Sep 17 00:00:00 2001 From: Darlan Alves Date: Mon, 19 Feb 2024 18:09:20 +0100 Subject: [PATCH] fix: send logs if connection is ready --- src/include/vm_instructions.hpp | 2 +- src/index.cpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/include/vm_instructions.hpp b/src/include/vm_instructions.hpp index ff1100e..71c1f62 100644 --- a/src/include/vm_instructions.hpp +++ b/src/include/vm_instructions.hpp @@ -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); } diff --git a/src/index.cpp b/src/index.cpp index 5012ef0..027ca11 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -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); }