net: samples: Fix timeout passed to k_sleep()

Use the appropriate K_SECONDS() macro to pass a timeout to k_sleep().

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2020-04-01 16:01:07 +03:00 committed by Johan Hedberg
commit a03a54f00c
3 changed files with 6 additions and 6 deletions

View file

@ -201,7 +201,7 @@ static int wait_for_input(int timeout)
return res;
}
#define ALIVE_TIME (MSEC_PER_SEC * 60U)
#define ALIVE_TIME K_SECONDS(60)
static struct mqtt_utf8 password = {
.utf8 = token

View file

@ -342,7 +342,7 @@ static void publish_message(void)
end:
k_delayed_work_submit(&pub_message,
MSEC_PER_SEC * timeout_for_publish());
K_SECONDS(timeout_for_publish()));
k_sem_take(&publish_msg, K_FOREVER);
}
}
@ -470,7 +470,7 @@ static void check_network_connection(struct k_work *work)
LOG_INF("waiting for DHCP to acquire addr");
end:
k_delayed_work_submit(&check_network_conn, 3 * MSEC_PER_SEC);
k_delayed_work_submit(&check_network_conn, K_SECONDS(3));
}
#endif
@ -493,7 +493,7 @@ static void l4_event_handler(struct net_mgmt_event_callback *cb,
if (mgmt_event == NET_EVENT_L4_CONNECTED) {
/* Wait for DHCP to be back in BOUND state */
k_delayed_work_submit(&check_network_conn, 3 * MSEC_PER_SEC);
k_delayed_work_submit(&check_network_conn, K_SECONDS(3));
return;
}

View file

@ -995,7 +995,7 @@ static void update_counter(struct k_work *work)
coap_resource_notify(resource_to_notify);
}
k_delayed_work_submit(&observer_work, MSEC_PER_SEC * 5U);
k_delayed_work_submit(&observer_work, K_SECONDS(5));
}
static int create_pending_request(struct coap_packet *response,
@ -1099,7 +1099,7 @@ static int send_notification_packet(const struct sockaddr *addr,
}
}
k_delayed_work_submit(&observer_work, MSEC_PER_SEC * 5U);
k_delayed_work_submit(&observer_work, K_SECONDS(5));
r = send_coap_reply(&response, addr, addr_len);