Skip to content

Commit dd87f16

Browse files
mickeylCopilot
andauthored
Update examples/L2CAP/L2CAP_Client/main/main.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent b04fe93 commit dd87f16

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

  • examples/L2CAP/L2CAP_Client/main

examples/L2CAP/L2CAP_Client/main/main.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,12 @@ void statusTask(void *pvParameters) {
8383
if (startTime > 0 && blocksSent > 0) {
8484
uint64_t currentTime = esp_timer_get_time();
8585
double elapsedSeconds = (currentTime - startTime) / 1000000.0;
86-
double bytesPerSecond = bytesSent / elapsedSeconds;
87-
double kbPerSecond = bytesPerSecond / 1024.0;
86+
double bytesPerSecond = 0.0;
87+
double kbPerSecond = 0.0;
88+
if (elapsedSeconds > 0.0) {
89+
bytesPerSecond = bytesSent / elapsedSeconds;
90+
kbPerSecond = bytesPerSecond / 1024.0;
91+
}
8892

8993
// Heap monitoring
9094
size_t currentHeap = esp_get_free_heap_size();

0 commit comments

Comments
 (0)