From a73080b1fc57b8ca1799afa9d358285ff00ae32a Mon Sep 17 00:00:00 2001 From: joran2738 <101818067+joran2738@users.noreply.github.com> Date: Sat, 25 Nov 2023 15:16:09 +0100 Subject: [PATCH] set_owner_details returns an error code not 0 or 1 --- docs/udp_broadcast.md | 14 +++++++------- project/Core/Src/main.c | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/udp_broadcast.md b/docs/udp_broadcast.md index c9d53aa..8e8cf46 100644 --- a/docs/udp_broadcast.md +++ b/docs/udp_broadcast.md @@ -59,7 +59,7 @@ void main(void){ LOG_WARN(TAG,"error initializing udp connection, trying again in 500ms"); HAL_Delay(500); if(udp_broadcast_connection_init() != ERR_OK){ - LOG_WARN(TAG,"error initializing udp connection, check warnings from udp_broadcast_init() or udp_broadcast_connection_init()"); + LOG_WARN(TAG,"error initializing udp connection, check warnings from udp_broadcast_init() or udp_broadcast_connection_init()"); } connected: @@ -82,9 +82,9 @@ THe 'udp_broadcast_set_owner_details(const char* , const char*)' function does 2 void main(void){ ... - if (!udp_broadcast_set_owner_details("Joran", "Van Nieuwenhoven")){ - ... - } + if (udp_broadcast_set_owner_details("Joran", "Van Nieuwenhoven") != ERR_OK){ + ... + } ... } ``` @@ -106,11 +106,11 @@ void main(void){ char surname[20]; char reply[120]; - strncp(name,udp_broadcast_get_owner_details_name(),sizeof(name)); + strncp(name, udp_broadcast_get_owner_details_name(), sizeof(name) - 1); - strncp(surname,udp_broadcast_get_owner_details_surname(),sizeof(surname)); + strncp(surname, udp_broadcast_get_owner_details_surname(), sizeof(surname) - 1); - strncp(reply,udp_broadcast_get_owner_details_reply(),sizeof(reply)); + strncp(reply, udp_broadcast_get_owner_details_reply(), sizeof(reply) - 1); ... } ``` \ No newline at end of file diff --git a/project/Core/Src/main.c b/project/Core/Src/main.c index 4c3890a..c32ec1b 100644 --- a/project/Core/Src/main.c +++ b/project/Core/Src/main.c @@ -146,7 +146,7 @@ int main(void) } connected: - if (udp_broadcast_set_owner_details("Joran", "Van Nieuwenhoven")){ + if (udp_broadcast_set_owner_details("Joran", "Van Nieuwenhoven") != ERR_OK){ LOG_WARN(TAG,"error setting owner's details"); }