[riot-notifications] [RIOT-OS/RIOT] gnrc_lwmac: enable radio duty-cycle printing. (#8942)

Martine Lenders notifications at github.com
Tue Jan 22 10:02:08 CET 2019


miri64 requested changes on this pull request.



> @@ -880,7 +872,16 @@ static void _lwmac_msg_handler(gnrc_netif_t *netif, msg_t *msg)
             lwmac_schedule_update(netif);
             break;
         }
-
+#if (GNRC_MAC_ENABLE_DUTYCYCLE_RECORD == 1)
+        case GNRC_MAC_TYPE_GET_DUTYCYCLE: {
+            /* Output LWMAC's radio duty-cycle ratio */
+            uint64_t duty = (uint64_t) rtt_get_counter();
+            duty = ((uint64_t) netif->mac.prot.lwmac.awake_duration_sum_ticks) * 100 /
+                   (duty - (uint64_t)netif->mac.prot.lwmac.system_start_time_ticks);
+            printf("[LWMAC]: achieved radio duty-cycle: %u %% \n", (uint16_t) duty);

Why is `duty` cast to `uint16_t` if it was `uint64_t` before?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/8942#pullrequestreview-194894205
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190122/f517422a/attachment-0001.html>


More information about the notifications mailing list