From b6f9dbfb5b66190cd8d798ec0f99a7f3cdeb8ea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=B6vesdi?= Date: Mon, 29 Apr 2024 22:31:16 +0200 Subject: [PATCH 1/4] fixed: example loops crashing after 256 passes --- examples/stm32f1/src/bin/can.rs | 4 ++-- examples/stm32f4/src/bin/can.rs | 2 +- examples/stm32f4/src/bin/wdt.rs | 2 +- examples/stm32g4/src/bin/can.rs | 4 ++-- examples/stm32h5/src/bin/can.rs | 2 +- examples/stm32h7/src/bin/can.rs | 2 +- examples/stm32u0/src/bin/wdt.rs | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/stm32f1/src/bin/can.rs b/examples/stm32f1/src/bin/can.rs index 1c13d623d..ad0c8a5a5 100644 --- a/examples/stm32f1/src/bin/can.rs +++ b/examples/stm32f1/src/bin/can.rs @@ -85,7 +85,7 @@ async fn main(_spawner: Spawner) { defmt::println!("Error {}", err); } } - i += 1; + i = i.wrapping_add(1); } */ @@ -135,6 +135,6 @@ async fn main(_spawner: Spawner) { defmt::println!("Error {}", err); } } - i += 1; + i = i.wrapping_add(1); } } diff --git a/examples/stm32f4/src/bin/can.rs b/examples/stm32f4/src/bin/can.rs index cedc057a7..8e3beee24 100644 --- a/examples/stm32f4/src/bin/can.rs +++ b/examples/stm32f4/src/bin/can.rs @@ -63,6 +63,6 @@ async fn main(_spawner: Spawner) { envelope.frame.data()[0], latency.as_micros() ); - i += 1; + i = i.wrapping_add(1); } } diff --git a/examples/stm32f4/src/bin/wdt.rs b/examples/stm32f4/src/bin/wdt.rs index ea27ebce0..430898b40 100644 --- a/examples/stm32f4/src/bin/wdt.rs +++ b/examples/stm32f4/src/bin/wdt.rs @@ -36,6 +36,6 @@ async fn main(_spawner: Spawner) { wdt.pet(); } - i += 1; + i = i.wrapping_add(1); } } diff --git a/examples/stm32g4/src/bin/can.rs b/examples/stm32g4/src/bin/can.rs index 7836334af..90004f874 100644 --- a/examples/stm32g4/src/bin/can.rs +++ b/examples/stm32g4/src/bin/can.rs @@ -192,7 +192,7 @@ async fn main(_spawner: Spawner) { Timer::after_millis(250).await; - i += 1; + i = i.wrapping_add(1); } } else { static TX_BUF: StaticCell> = StaticCell::new(); @@ -228,7 +228,7 @@ async fn main(_spawner: Spawner) { Timer::after_millis(250).await; - i += 1; + i = i.wrapping_add(1); } } } diff --git a/examples/stm32h5/src/bin/can.rs b/examples/stm32h5/src/bin/can.rs index dc77ec3bf..194239d47 100644 --- a/examples/stm32h5/src/bin/can.rs +++ b/examples/stm32h5/src/bin/can.rs @@ -93,6 +93,6 @@ async fn main(_spawner: Spawner) { Timer::after_millis(250).await; - i += 1; + i = i.wrapping_add(1); } } diff --git a/examples/stm32h7/src/bin/can.rs b/examples/stm32h7/src/bin/can.rs index a889d5860..0af11ef3e 100644 --- a/examples/stm32h7/src/bin/can.rs +++ b/examples/stm32h7/src/bin/can.rs @@ -93,6 +93,6 @@ async fn main(_spawner: Spawner) { Timer::after_millis(250).await; - i += 1; + i = i.wrapping_add(1); } } diff --git a/examples/stm32u0/src/bin/wdt.rs b/examples/stm32u0/src/bin/wdt.rs index f6276e2e9..8f9ea516d 100644 --- a/examples/stm32u0/src/bin/wdt.rs +++ b/examples/stm32u0/src/bin/wdt.rs @@ -36,6 +36,6 @@ async fn main(_spawner: Spawner) { wdt.pet(); } - i += 1; + i = i.wrapping_add(1); } } From 5df703cf4b22f2fef2c2bed9fc6ceaca98d8ddfb Mon Sep 17 00:00:00 2001 From: pkoevesdi <33196971+pkoevesdi@users.noreply.github.com> Date: Mon, 29 Apr 2024 22:38:58 +0200 Subject: [PATCH 2/4] Update wdt.rs: added missing type --- examples/stm32u0/src/bin/wdt.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/stm32u0/src/bin/wdt.rs b/examples/stm32u0/src/bin/wdt.rs index 8f9ea516d..c0db89b22 100644 --- a/examples/stm32u0/src/bin/wdt.rs +++ b/examples/stm32u0/src/bin/wdt.rs @@ -18,7 +18,7 @@ async fn main(_spawner: Spawner) { let mut wdt = IndependentWatchdog::new(p.IWDG, 1_000_000); wdt.unleash(); - let mut i = 0; + let mut i:u8 = 0; loop { info!("high"); From a2ea307114cbfade6793819e30d8438a34b0b201 Mon Sep 17 00:00:00 2001 From: pkoevesdi <33196971+pkoevesdi@users.noreply.github.com> Date: Mon, 29 Apr 2024 22:42:46 +0200 Subject: [PATCH 3/4] Update wdt.rs: reverted changes, probably unneccesary --- examples/stm32u0/src/bin/wdt.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/stm32u0/src/bin/wdt.rs b/examples/stm32u0/src/bin/wdt.rs index c0db89b22..f6276e2e9 100644 --- a/examples/stm32u0/src/bin/wdt.rs +++ b/examples/stm32u0/src/bin/wdt.rs @@ -18,7 +18,7 @@ async fn main(_spawner: Spawner) { let mut wdt = IndependentWatchdog::new(p.IWDG, 1_000_000); wdt.unleash(); - let mut i:u8 = 0; + let mut i = 0; loop { info!("high"); @@ -36,6 +36,6 @@ async fn main(_spawner: Spawner) { wdt.pet(); } - i = i.wrapping_add(1); + i += 1; } } From 56b4d39df903d4dc235300dbe0fe57345c1e6fc1 Mon Sep 17 00:00:00 2001 From: pkoevesdi <33196971+pkoevesdi@users.noreply.github.com> Date: Mon, 29 Apr 2024 22:45:02 +0200 Subject: [PATCH 4/4] Update wdt.rs: reverted change, probably unneccesary here --- examples/stm32f4/src/bin/wdt.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/stm32f4/src/bin/wdt.rs b/examples/stm32f4/src/bin/wdt.rs index 430898b40..ea27ebce0 100644 --- a/examples/stm32f4/src/bin/wdt.rs +++ b/examples/stm32f4/src/bin/wdt.rs @@ -36,6 +36,6 @@ async fn main(_spawner: Spawner) { wdt.pet(); } - i = i.wrapping_add(1); + i += 1; } }