Skip to content

Commit

Permalink
MINOR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lexus2k committed Nov 19, 2023
1 parent 164eece commit 9fa1389
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ if (ENABLE_FD_LOGS)
if (LOG_LEVEL)
add_definitions("-DTINY_LOG_LEVEL_DEFAULT=${LOG_LEVEL}")
endif()
endif()
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static bool peek_next;
static void send_message(const char *message)
{
tiny_mutex_lock(&queue_mutex);
char *msg = _strdup(message);
char *msg = strdup(message);
queue.push(msg);
tiny_mutex_unlock(&queue_mutex);
}
Expand Down
1 change: 1 addition & 0 deletions examples/linux/loopback/tiny_loopback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ static int run_fd(tiny_serial_handle_t port)
{
fprintf(stderr, "Failed to send packet\n");
}
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}
else
{
Expand Down
5 changes: 5 additions & 0 deletions src/hal/tiny_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ extern "C"
if ( lvl < g_tiny_log_level ) \
fprintf(stderr, "%08" PRIu32 " ms: " fmt, tiny_millis(), ##__VA_ARGS__); \
}
#define TINY_LOG0(lvl, fmt) \
{ \
if ( lvl < g_tiny_log_level ) \
fprintf(stderr, "%08" PRIu32 " ms: " fmt, tiny_millis()); \
}
#else
#define TINY_LOG(...)
#endif
Expand Down
6 changes: 5 additions & 1 deletion src/proto/crc/tiny_crc.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,13 @@ uint16_t tiny_chksum(uint16_t sum, const uint8_t* data, int data_length)

int get_crc_field_size(hdlc_crc_t crc_type)
{
if ( crc_type == 0xFF )
if ( crc_type == HDLC_CRC_OFF )
{
return 0;
}
if ( crc_type == HDLC_CRC_DEFAULT )
{
crc_type = HDLC_CRC_32;
}
return (int)crc_type / 8;
}
2 changes: 1 addition & 1 deletion src/proto/fd/tiny_fd.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#endif

#if TINY_FD_DEBUG
#define LOG(lvl, fmt, ...) TINY_LOG(lvl, fmt, __VA_ARGS__)
#define LOG(lvl, fmt, ...) TINY_LOG(lvl, fmt, ##__VA_ARGS__)
#else
#define LOG(...)
#endif
Expand Down

0 comments on commit 9fa1389

Please sign in to comment.