From f15c3f157cc73a9061ea6e8907a7d9022c0754af Mon Sep 17 00:00:00 2001 From: Tony Smith Date: Fri, 26 Jul 2024 13:05:33 +0100 Subject: [PATCH] Code consistency --- app/http.c | 10 +++++----- app/main.c | 9 ++++----- app/network.c | 7 +++---- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/app/http.c b/app/http.c index 2b1b532..df7ff54 100644 --- a/app/http.c +++ b/app/http.c @@ -112,7 +112,7 @@ MvChannelHandle http_get_handle(void) { /** - * @brief Configure the channel Notification Center. + * @brief Configure the channel notification center. */ void http_setup_notification_center(void) { @@ -129,12 +129,12 @@ void http_setup_notification_center(void) { // Ask Microvisor to establish the notification center // and confirm that it has accepted the request enum MvStatus status = mvSetupNotifications(&http_notification_setup, &http_handles.notification); - do_assert(status == MV_STATUS_OKAY, "Could not set up HTTP channel Notification Center"); + do_assert(status == MV_STATUS_OKAY, "Could not set up HTTP channel notification center"); // Start the notification IRQ NVIC_ClearPendingIRQ(TIM8_BRK_IRQn); NVIC_EnableIRQ(TIM8_BRK_IRQn); - server_log("HTTP Notification Center handle: %lu", (uint32_t)http_handles.notification); + server_log("HTTP notification center handle: %lu", (uint32_t)http_handles.notification); } @@ -158,8 +158,8 @@ enum MvStatus http_send_request(uint32_t item_number) { // Set up the request const char verb[] = "GET"; const char body[] = ""; - char url[46] = ""; - sprintf(url, "https://jsonplaceholder.typicode.com/todos/%lu", item_number); + char url[64] = ""; + snprintf(url, 64, "https://jsonplaceholder.typicode.com/todos/%lu", item_number); const struct MvHttpHeader hdrs[] = {}; const struct MvHttpRequest request_config = { .method = { diff --git a/app/main.c b/app/main.c index 880ea54..9d800b6 100644 --- a/app/main.c +++ b/app/main.c @@ -281,8 +281,7 @@ static void process_http_response(void) { // the request was successful (status code 200) if (resp_data.result == MV_HTTPRESULT_OK) { if (resp_data.status_code == 200) { - server_log("HTTP response header count: %lu", resp_data.num_headers); - server_log("HTTP response body length: %lu", resp_data.body_length); + server_log("HTTP response received. Body length: %lu bytes, %lu headers", resp_data.body_length, resp_data.num_headers); // Set up a buffer that we'll get Microvisor to write // the response body into @@ -335,7 +334,7 @@ static void output_headers(uint32_t num_headers) { /** - * @brief Configure the System Notification Center. + * @brief Configure the System notification center. */ static void setup_sys_notification_center(void) { @@ -353,7 +352,7 @@ static void setup_sys_notification_center(void) { // and confirm that it has accepted the request enum MvStatus status = mvSetupNotifications(&sys_notification_setup, &sys_nc_handle); do_assert(status == MV_STATUS_OKAY, "Could not set up sys NC"); - server_log("System Notification Center handle: %lu", (uint32_t)sys_nc_handle); + server_log("System notification center handle: %lu", (uint32_t)sys_nc_handle); // Tell Microvisor to use the new notification center for system notifications const struct MvOpenSystemNotificationParams sys_notification_params = { @@ -411,7 +410,7 @@ static void do_clear_led(void* arg) { /** - * @brief The System Notification Center interrupt handler. + * @brief The System notification center interrupt handler. * * This is called by Microvisor -- we need to check for key events * such as polite deployment. diff --git a/app/network.c b/app/network.c index b0b7d91..bbff752 100644 --- a/app/network.c +++ b/app/network.c @@ -75,7 +75,7 @@ void net_open_network(void) { /** - * @brief Configure the network Notification Center. + * @brief Configure the network notification center. */ static void net_setup_notification_center(void) { @@ -93,12 +93,12 @@ static void net_setup_notification_center(void) { // Ask Microvisor to establish the notification center // and confirm that it has accepted the request enum MvStatus status = mvSetupNotifications(&net_notification_config, &net_handles.notification); - do_assert(status == MV_STATUS_OKAY, "Could not start network Notification Center"); + do_assert(status == MV_STATUS_OKAY, "Could not start network notification center"); // Start the notification IRQ NVIC_ClearPendingIRQ(TIM2_IRQn); NVIC_EnableIRQ(TIM2_IRQn); - server_log("Network Notification Center handle: %lu", (uint32_t)net_handles.notification); + server_log("Network notification center handle: %lu", (uint32_t)net_handles.notification); } } @@ -123,4 +123,3 @@ void TIM2_IRQHandler(void) { // Add your own notification processing code here } -