Closed
Description
Hey!
This crate works very well for my project, but only in debug mode.
I need some heavy computations, so i have to use release mode when, deploying.
Something gets optimized by the compiler, so that this crate (and only this crate of my few installed), wont work as expected.
Running init() and clear() work as intended, but every other function returns a Infallible
error.
I tried to debug this myself, and smashed my head against the wall for hours. I installed this crate locally and tinkered with the source code, but with no luck whatsoever..
Here is my simple code, that invokes the this crate. Can you spot anything, that is incorrect?
let core = pac::CorePeripherals::take().unwrap();
let mut delay = cortex_m::delay::Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());
let mut clk = pins.gpio6.into_push_pull_output();
let mut dio = pins.gpio7.into_push_pull_output();
let mut tm = TM1637::new(&mut clk, &mut dio, &mut delay);
let mut counter: u8 = 0;
let mut thingy_done = false;
loop {
let result = tm.init();
if result.is_ok() {
let _ = serial.write(b"initialized\n\r");
}
let result = tm.clear();
if result.is_ok() {
let _ = serial.write(b"cleared\n\r");
}
let result = tm.set_brightness(128); // <-- Succeeds in debug-, fails in releasemode
if result.is_err() {
let _ = serial.write(b"failed to set brighness\n\r");
}
}
rust is up to date, i updated in the process of debugging:
rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.74.0 (79e9716c9 2023-11-13)`
Metadata
Metadata
Assignees
Labels
No labels