ChanServ changed the topic of #rust-embedded to: Welcome to the Rust Embedded IRC channel! Bridged to #rust-embedded:matrix.org and logged at https://libera.irclog.whitequark.org/rust-embedded, code of conduct at https://www.rust-lang.org/conduct.html
starblue1 has quit [Ping timeout: 272 seconds]
starblue1 has joined #rust-embedded
<re_irc> <9names (@9names:matrix.org)> I'm finally happy enough with my Wii nunchuk/classic controller driver to announce it's existence.
<re_irc> I've only tested it on rp2040 (and embedded-hal-mock), so please file bugs if it doesn't work on your hardware.
mmahrous has joined #rust-embedded
tokomak has joined #rust-embedded
<re_irc> <James Munns> Planning on streaming in about an hour (16:30 CET), either bootloader development or working with Keyberon (the keyboard framework). If you have thoughts on what youd like to see, lemme know here or on twitter: https://twitter.com/bitshiftmask/status/1495406680917557251
mmahrous has quit [Remote host closed the connection]
<re_irc> <wcampbell> How do I use a f64.ceil() function in the embedded setting? I found https://doc.rust-lang.org/std/primitive.f64.html#method.ceil and in core: https://doc.rust-lang.org/core/intrinsics/fn.ceilf64.html. But I don't know how to use it.
<re_irc> <wcampbell> Maybe something like this? But I need a compile guard or something?
<re_irc> - writeln!(f, " Heading: {}", heading.ceil())?;
<re_irc> + if cfg!(feature = "alloc") {
<re_irc> + writeln!(f, " Heading: {}", ceilf64(heading))?;
<re_irc> <James Munns> Going live now, btw: https://youtu.be/oLRRWSfyou8
<re_irc> <wcampbell> TeXitoi: thanks! never heard of this
crabbedhaloablut has quit [Ping timeout: 240 seconds]
crabbedhaloablut has joined #rust-embedded
tokomak has quit [Read error: Connection reset by peer]
<re_irc> <blauskaerm> James Munns: What program are you using when making git commits?
<re_irc> <James Munns> blauskaerm: It's just git, "git add -i"
<re_irc> <James Munns> Oh, and then "nano" for the actual commit messages
<re_irc> <blauskaerm> I might be mistaken but what are you running on 23:20? That's git add -i ?
<re_irc> <James Munns> Ah! That's a diffing tool called "Beyond Compare"
<re_irc> <James Munns> It's a paid tool (but a very good one), there's a similar OSS tool called meld you can also try
<re_irc> <blauskaerm> Ahaaa! Looked like you were staging commits :)
<re_irc> <James Munns> https://scootersoftware.com/
<re_irc> <James Munns> Nah, that was a folder diff of an older project and the current project
<re_irc> <blauskaerm> I use meld for my daily work but will check it out
<re_irc> <James Munns> Just to make "stealing" the relevant parts easier
<re_irc> <James Munns> I also use it as my diff/merge tool, as it supports 3 way merging in a really clear way IMO
<re_irc> <James Munns> (but I think meld does that too these days? I've used BC for like 10 years now :D)
<re_irc> <blauskaerm> Can recommend git cola as staging tool. Makes it easier to partially stage sections
<re_irc> <blauskaerm> So git messages makes more sense if you are solving two issues at the same time
<re_irc> <blauskaerm> James Munns: Yeah you can so that in meld today. I use it as diff and merge tool for git
<re_irc> <James Munns> Nice! I dont really think in "chunks" (or even use staging that much), habits from older VCS tools. I pretty much just branches, commits, and the working dir
<re_irc> <James Munns> But there are a ton of different ways to use git, for sure :)
<re_irc> <blauskaerm> Everyone has their own way of working :) structure in chunks can help later when pusseling changes with the blame function
<re_irc> <K900> I usually just "git commit --pick" when I want to commit a chunk
<re_irc> <K900> * --patch"
<re_irc> <blauskaerm> I've never done it from the cli tbh. Will give it a try tomorrow ;)
<re_irc> <blauskaerm> There is also magit to emacs which I use very frequently
<re_irc> <dngrs (spookyvision@github)> has kdiff3 been mentioned? free and does 3-way merge
<re_irc> <dngrs (spookyvision@github)> it's also UGLY AS HELL
<re_irc> <dngrs (spookyvision@github)> but works
<re_irc> <xiretza> I have "git a" aliased to "add --patch", since I'm bad at working on only one thing at a time I end up having to use it a lot
<re_irc> <xiretza> I guess "commit --patch" might be a viable alternative
<re_irc> <K900> I also use git-revise extensively
<re_irc> <xiretza> K900: oh, cool!
<re_irc> <dngrs (spookyvision@github)> float handling sure is (space-)expensive, eh
<re_irc> 0.5% 10.7% 6.9KiB std core::fmt::float::float_to_decimal_common_exact
<re_irc> 0.5% 9.1% 5.9KiB std core::num::flt2dec::strategy::dragon::format_shortest
<re_irc> (...)
<re_irc> <dngrs (spookyvision@github)> float handling sure is (space-)expensive, eh
<re_irc> File .text Size Crate Name
<re_irc> 0.5% 10.7% 6.9KiB std core::fmt::float::float_to_decimal_common_exact
<re_irc> (...)
<re_irc> <dirbaio> oof :D
<re_irc> <dirbaio> if it's just for debugging use defmt
<re_irc> <dngrs (spookyvision@github)> lots of "fmt" which I can probably ultimately get rid of
<re_irc> <dngrs (spookyvision@github)> float to int, not so much
<re_irc> <dngrs (spookyvision@github)> I am using defmt
<re_irc> <dngrs (spookyvision@github)> but also for (dev time) efficiency reasons, "defmt::Debug2Format" here and there
<re_irc> <dirbaio> ahhhh yep that's probably what's pulling it in
<re_irc> <dirbaio> to get defmt's efficiency you need all printing to use "real" defmt::Format impls...
<re_irc> <dngrs (spookyvision@github)> yup I know, that's what I meant with dev time efficiency
<re_irc> <dngrs (spookyvision@github)> I'm not in the mood of implementing them all :D
<re_irc> <dirbaio> it's easy, just #[derive(defmt::Format)]`
<re_irc> <dirbaio> * " #[derive(defmt::Format)]"
<re_irc> <dngrs (spookyvision@github)> and it's not like I care much, 90k flash of 512k used rn. But the size _was_ surprising
<re_irc> <dirbaio> the problem is if it's third party lib's structs :'(
<re_irc> <dngrs (spookyvision@github)> dirbaio: that's not so straightforward when it's 3rd party crates
<re_irc> <dngrs (spookyvision@github)> I _could_ newtype them all, but again: time…
<re_irc> <dirbaio> yeah 😭
<re_irc> <dngrs (spookyvision@github)> in general newtype is fantastic though
<re_irc> <dngrs (spookyvision@github)> the magic universal adapter
<re_irc> <vdkj> Modularizing some code. What is happenening here?
<re_irc> --> src/bin/pid_update.rs:5:26
<re_irc> error[E0603]: function `abs` is private
<re_irc> |
<re_irc> <newam> is it in a separate crate? I can't be certain from looking at those paths.
<re_irc> <dirbaio> if you use the "lib" part of a crate from the "bin" part of a crate, it's as if they were different crates
<re_irc> <newam> dirbaio: huh, learn something new every day. Do you know the rationale behind this?
<re_irc> <vdkj> ../syd
<re_irc> β”œβ”€β”€ Cargo.lock
<re_irc> β”œβ”€β”€ Cargo.toml
<re_irc> β”œβ”€β”€ LICENSE-MIT
<re_irc> <dirbaio> either make it pub, or import the stuff directly from the bins with only "mod" declarations
<re_irc> <dngrs (spookyvision@github)> the terminology is sometimes a bit fuzzy. The directory containing your "Cargo.toml" is a "package" which contains several "crates"
<re_irc> <dirbaio> newam: I have no idea for the rationale, I find it confusing myself too :'(
<re_irc> <dngrs (spookyvision@github)> 0 or 1 library crate, 0..n binary crates, and at least 1 crate in total
<re_irc> <dirbaio> also the build.rs "crate"
<re_irc> <dirbaio> and example crates
<re_irc> <dirbaio> and tests
<re_irc> <dirbaio> πŸ€ͺ
<re_irc> <dngrs (spookyvision@github)> oy vey
<re_irc> <dirbaio> and examples
<re_irc> <vdkj> So in lib.rs I have "pub mod math_embedded" where math_embedded.rs` contains the free functions.
<re_irc> <vdkj> I had assumed that that meens these functions are then pub?
<re_irc> <dirbaio> you'll also need "pub fn abs(.." , not "pub(crate)"
<re_irc> <vdkj> dirbaio: 10 points.
<re_irc> Thanks!
<re_irc> <dirbaio> OR in "src/bin/pid_update.rs" you can do "#[path = "../math_embedded.rs"] mod math_embedded;" so that it's no longer in a "different crate"
<re_irc> <dirbaio> (but then you're complining math_embedded.rs twice)
jackneill has quit [Remote host closed the connection]
jackneill has joined #rust-embedded
<re_irc> <Ryan Butler> Has anyone ever used protobuf vs flatbuffers on a microcontroller? Performance differences aside, was flatbuffers a significantly smaller binary than protobuffers? The API generated by flatbuffers is a bit weird/non idiomatic (imo, maybe I'm wrong?)
<re_irc> <dirbaio> rust flatbuffers is not safe for parsing untrusted data: https://google.github.io/flatbuffers/flatbuffers_guide_use_rust.html see "Access of untrusted buffers"
<re_irc> <dirbaio> no bounds checking at all πŸ‘Œ