From 15ebb6ab10118a1c53486ffae8ca2bcba4d6e3c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Fri, 12 Jan 2018 10:03:07 +0100 Subject: [PATCH] removed some excessive logging --- comm/messages.c | 10 ++++++++-- comm/msg_bulkwrite.c | 3 +++ framework/resources.c | 6 +++--- platform/plat_compat.h | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/comm/messages.c b/comm/messages.c index dec78d6..5add7b2 100644 --- a/comm/messages.c +++ b/comm/messages.c @@ -2,6 +2,7 @@ // Created by MightyPork on 2017/11/21. // +#include #include "platform.h" #include "framework/settings.h" #include "utils/ini_parser.h" @@ -103,8 +104,13 @@ static void settings_bulkwrite_cb(BulkWrite *bulk, const uint8_t *chunk, uint32_ // clean-up request if (chunk == NULL) { ini_parse_end(); - settings_load_ini_end(); - dbg("INI write complete."); + + if (bulk->offset > 0) { + settings_load_ini_end(); + dbg("INI write complete"); + } else { + dbg("INI write failed"); + } free(bulk); return; diff --git a/comm/msg_bulkwrite.c b/comm/msg_bulkwrite.c index 7dbafd4..1ef4f9f 100644 --- a/comm/msg_bulkwrite.c +++ b/comm/msg_bulkwrite.c @@ -19,6 +19,9 @@ static TF_Result bulkwrite_lst(TinyFrame *tf, TF_Msg *msg) // this is a final call before timeout, to clean up if (msg->data == NULL) { + if (bulk->offset != bulk->len) { + TF_Error("Bulk write ended prematurely with %d written out of %d", (int)bulk->offset, (int)bulk->len); + } goto close; } diff --git a/framework/resources.c b/framework/resources.c index 1c14cb3..cc29001 100644 --- a/framework/resources.c +++ b/framework/resources.c @@ -73,7 +73,7 @@ error_t rsc_claim(Unit *unit, Resource rsc) assert_param(rsc < RESOURCE_COUNT); assert_param(unit != NULL); - dbg("%s claims %s", unit->name, rsc_get_name(rsc)); +// dbg("%s claims %s", unit->name, rsc_get_name(rsc)); if (RSC_IS_HELD(global_rscmap, rsc)) { // this whole branch is just reporting the error @@ -156,7 +156,7 @@ void rsc_free(Unit *unit, Resource rsc) assert_param(rsc_initialized); assert_param(rsc < RESOURCE_COUNT); - dbg("Free resource %s", rsc_get_name(rsc)); +// dbg("Free resource %s", rsc_get_name(rsc)); if (RSC_IS_FREE(global_rscmap, rsc)) return; @@ -211,7 +211,7 @@ void rsc_teardown(Unit *unit) assert_param(rsc_initialized); assert_param(unit != NULL); - dbg("Tearing down unit %s", unit->name); +// dbg("Tearing down unit %s", unit->name); deinit_unit_pins(unit); for (uint32_t i = 0; i < RSCMAP_LEN; i++) { diff --git a/platform/plat_compat.h b/platform/plat_compat.h index cd6345e..d81dd78 100644 --- a/platform/plat_compat.h +++ b/platform/plat_compat.h @@ -22,7 +22,7 @@ #define FLASH_SAVE_BUF_LEN 128 // Static buffer for saving to flash -#define MSG_QUE_SLOT_SIZE 64 // FIXME this should be possible to lower, but there's some bug with bulk transfer / INI parser +#define MSG_QUE_SLOT_SIZE 32 // FIXME this should be possible to lower, but there's some bug with bulk transfer / INI parser #define RX_QUE_CAPACITY 8 // TinyFrame rx queue size (64 bytes each) #define TF_MAX_PAYLOAD_RX 512 // TF max Rx payload