From c2315a9e6ac72712e192f5ba452d34f26f138dca Mon Sep 17 00:00:00 2001 From: subDesTagesMitExtraKaese <59580649+subDesTagesMitExtraKaese@users.noreply.github.com> Date: Tue, 29 Jun 2021 00:03:15 +0200 Subject: [PATCH] Update Geiger-Counter-Shield.ino Fixed buffer overflow --- Geiger-Counter-Shield.ino | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Geiger-Counter-Shield.ino b/Geiger-Counter-Shield.ino index 79c83e7..c4c8424 100644 --- a/Geiger-Counter-Shield.ino +++ b/Geiger-Counter-Shield.ino @@ -254,10 +254,9 @@ void loop() cpm = 0; for (int i = 0; i < 6; i++) cpm += cp10sValues[i]; - - if (n < 6) - n++; - else + + n++; + if (n == 6) n = 0; // Check if the CPM level changes rapidly