fabic has joined #rust-embedded
GenTooMan has quit [Ping timeout: 240 seconds]
GenTooMan has joined #rust-embedded
starblue1 has joined #rust-embedded
starblue has quit [Ping timeout: 258 seconds]
<re_irc> <@t​heunkn0wn1:m​atrix.org> anyone know of a cobs library that doesn't panic decoding malformed data?
<re_irc> <@t​heunkn0wn1:m​atrix.org> Failing that, a library that provides serial framing by some other mechanism that is more fault-tollerant?
<re_irc> <@h​enrik_alser:m​atrix.org> theunkn0wn1: https://crates.io/crates/postcard
<re_irc> <@d​isasm-ewg:m​atrix.org> almindor: TIL one can install svd2rust from AUR 😅
<re_irc> <@d​isasm-ewg:m​atrix.org> Probably the next step is to find svd2rust on one of these "CDs full of software"
<re_irc> <@9​names:m​atrix.org> I'm sure if you send the author an e-mail they can mail you the latest release on a floppy disk
emerent_ has joined #rust-embedded
emerent has quit [Killed (mercury.libera.chat (Nickname regained by services))]
emerent_ is now known as emerent
fabic has quit [Remote host closed the connection]
fabic has joined #rust-embedded
<re_irc> <@d​isasm-ewg:m​atrix.org> 9names: On eight floppy disks
neceve has joined #rust-embedded
fabic has quit [Remote host closed the connection]
<re_irc> <@t​heunkn0wn1:m​atrix.org> henrik_alser: That is a serde compatible serialization layer, it doesn't handle framing. Postcard-cobs suffers from the same defect
<re_irc> <@t​heunkn0wn1:m​atrix.org> Further, postcard has no library support outside of rust, afaik.
fabic has joined #rust-embedded
<re_irc> <@h​enrik_alser:m​atrix.org> What kind of framing are you looking for? (I mean cobs is a kind of framing itself…)
<re_irc> <@h​enrik_alser:m​atrix.org> (You’d use the cobs ”flavour” with postcard)
<re_irc> <@t​heunkn0wn1:m​atrix.org> henrik_alser: Something that allows me to clearly detect the threshold between frames, which is what cobs gives
<re_irc> <@t​heunkn0wn1:m​atrix.org> henrik_alser: Yes, that suffers the problem of the other side not being rust, so I would have to develop something that can understand it.
<re_irc> <@t​heunkn0wn1:m​atrix.org> Which would probably be an interesting but time consuming process 🤔
<re_irc> <@h​enrik_alser:m​atrix.org> Unless you serialize to a variable length where the message would be prefixed by its length there’s nothing ”postcardy” about the output as far as i know?
<re_irc> <@t​heunkn0wn1:m​atrix.org> I don't need serialization, I'm using no_std serde-json for that. (Unfortunately it's variable width since it's text based)
<re_irc> <@t​heunkn0wn1:m​atrix.org> What I need is a cobs equivalent that doesn't panic on bad data.
<re_irc> <@t​heunkn0wn1:m​atrix.org> I patched postcard-cobs to remove the one unwrap that was panicking my tests but it feels more like a hacky workaround then a solution
<re_irc> <@h​enrik_alser:m​atrix.org> Never used the postcard-cobs crate, i think you’re supposed to use the postcard crate with cobs flavor
<re_irc> <@h​enrik_alser:m​atrix.org> Seems I don’t really understand the problem i however so i rest my case :)
<re_irc> <@t​heunkn0wn1:m​atrix.org> postcard depends on postcard-obs.
fabic has quit [Ping timeout: 258 seconds]
<re_irc> <@h​enrik_alser:m​atrix.org> Ping @jamesmunns
<re_irc> <@t​heunkn0wn1:m​atrix.org> Il try to restate the problem:
<re_irc> <@t​heunkn0wn1:m​atrix.org> the transmit/receive of the device are cobs-encoded frames. the cobs encoding allows me to easily and progamatically split the TX/RX data into packets since cobs ensures a null byte only ever exists at packet boundries.
<re_irc> <@t​heunkn0wn1:m​atrix.org> The device needs to *receive* data over its USART, that holds a command.
<re_irc> <@t​heunkn0wn1:m​atrix.org> Since I am concerned about possible data corruption on-the-wire, i need to presume the RX'ed bytes may possibly be bad. So I wrote a small test that feeds malformed bytes to `cobs::decode` and `postcard_cobs::decode` respectively, and both panicked in the same place. Given panicks in embedded devices are bad,...
<re_irc> <@j​amesmunns:m​atrix.org> ACK (about to jump into a call)
<re_irc> <@j​amesmunns:m​atrix.org> BUT
<re_irc> <@j​amesmunns:m​atrix.org> I am interested in fixing this
<re_irc> <@t​heunkn0wn1:m​atrix.org> I filed a bandaid on your fork jamesmunns https://github.com/ferrous-systems/cobs.rs/pull/2
<re_irc> <@j​amesmunns:m​atrix.org> I recently was given ownership of the upstream `cobs` crate, I plan to smash together `cobs`, `postcard-cobs` (which is just a fork of `cobs` with MY patches), and the `kolben` crate where I wrote some new flavors
<re_irc> <@t​heunkn0wn1:m​atrix.org> im not sure i fixed it the right way though.
<re_irc> <@j​amesmunns:m​atrix.org> ACK!
<re_irc> <@j​amesmunns:m​atrix.org> Will look, if you don't see progress by this weekend, plz reping me here :)
<re_irc> <@t​heunkn0wn1:m​atrix.org> Wilco.
<re_irc> <@j​amesmunns:m​atrix.org> theunkn0wn1: merged your changes and published as `v0.2.0` of `postcard-cobs`.
<re_irc> <@j​amesmunns:m​atrix.org> If you have a version mismatch problem with `postcard`, let me know, and I can update the dep there (but I'd prefer to avoid until I merge with upstream `cobs`)
<re_irc> <@j​amwaffles:m​atrix.org> While we're on the subject of postcard, jamesmunns do you have any examples of receiving data on the host side? I've got a device sending me a serialized struct over USART every 1s but I can't get it to decode :(
<re_irc> <@j​amesmunns:m​atrix.org> Uhhh sure!
<re_irc> <@j​amesmunns:m​atrix.org> (lots, actually)
<re_irc> <@j​amesmunns:m​atrix.org> is "with cobs" okay?
<re_irc> <@j​amesmunns:m​atrix.org> that's how I usually do it over UART
<re_irc> <@j​amwaffles:m​atrix.org> Yeah of course, I've been trying that to but to no avail :(
<re_irc> <@j​amesmunns:m​atrix.org> https://github.com/jamesmunns/OtterPill-rs/ - that might be on a slightly older version of postcard or whatever, but the patterns should be the same.
<re_irc> <@j​amesmunns:m​atrix.org> See `phm-cli` (host side) and `phm` (device side) for example.
<re_irc> <@j​amesmunns:m​atrix.org> (or `vintage-cli` and `vintage`)
<re_irc> <@j​amesmunns:m​atrix.org> I guess https://github.com/jamesmunns/OtterPill-rs/blob/master/phm-icd/src/cobs_buffer.rs is the interesting part
<re_irc> <@j​amesmunns:m​atrix.org> (I should probably just upstream roughly that code to postcard, I guess, I copy and paste that file like everywhere 😅)
<re_irc> <@j​amwaffles:m​atrix.org> Ahh your COBS `Buffer` is doing some fancy stuff which I'm... not lol
<re_irc> <@j​amwaffles:m​atrix.org> Mind if I steal it?
<re_irc> <@j​amesmunns:m​atrix.org> Please do! I don't have a license there (whoops), but assume MIT+Apache 2.0
<re_irc> <@j​amwaffles:m​atrix.org> Noted 🙂 thank you!
<re_irc> <@j​amesmunns:m​atrix.org> also, probably worth just using a modern const-generics heapless buffer in there.
<re_irc> <@j​amesmunns:m​atrix.org> (if you clean that up, get rid of panics, and just use heapless for the buffer vec, and PR it to postcard, I'll merge + release it ASAP)
<re_irc> <@j​amesmunns:m​atrix.org> If not, I'll do it... eventually :D
<re_irc> <@j​amwaffles:m​atrix.org> Hah yeah I literally just ported it to const generics. I'll do a PR in a bit if I have a mo
<re_irc> <@j​amwaffles:m​atrix.org> It's extremely noice with const generics
<re_irc> <@j​amesmunns:m​atrix.org> :D
crabbedhaloablut has joined #rust-embedded
crabbedhaloablut has quit [Remote host closed the connection]
<re_irc> <@j​amwaffles:m​atrix.org> `heapless` uses const-generics now doesn't it
crabbedhaloablut has joined #rust-embedded
<re_irc> <@j​amesmunns:m​atrix.org> yep
<re_irc> <@j​amesmunns:m​atrix.org> and postcard now uses the new const-generics heapless (behind a feature flag)
<re_irc> <@j​amesmunns:m​atrix.org> IMO OK to gate that impl behind the heapless feature
<re_irc> <@j​amwaffles:m​atrix.org> sgtm, I'll test this out in my app and clean up for a PR
<re_irc> <@j​amesmunns:m​atrix.org> ACK! Maybe call it something more descriptive, like `CobsReceiveBuffer`
<re_irc> <@j​amesmunns:m​atrix.org> but you do you :D
<re_irc> <@j​amwaffles:m​atrix.org> `CornOnTheCobsHueHueHue`
<re_irc> <@j​amesmunns:m​atrix.org> `CobsCollector`
<re_irc> <@j​amesmunns:m​atrix.org> :D
<re_irc> <@j​amwaffles:m​atrix.org> `CobsAccumulator`?
<re_irc> <@j​amesmunns:m​atrix.org> Corn on the cobs cross-language puns, you say? https://docs.rs/kolben
<re_irc> <@j​amesmunns:m​atrix.org> jamwaffles: Sure, anything that gets the "this is used for receiving COBS encoded data in chunks" message across, I'm up for.
<re_irc> <@j​amesmunns:m​atrix.org> "Buffer" is just kind of a contextless name :D
<re_irc> <@j​amwaffles:m​atrix.org> We can bikeshed in the PR :)
<re_irc> <@j​amwaffles:m​atrix.org> Which I have now publicly committed to. Very dangerous
<re_irc> <@j​amwaffles:m​atrix.org> Gosh it works! Yesss thank you sir, copy and paste is the most incredible thing ❤️ I shall repay with PRs shortly after some celebratory tiramisu
<re_irc> <@j​amesmunns:m​atrix.org> I'd also be interested in what I WAS doing, that you weren't
<re_irc> <@j​amesmunns:m​atrix.org> (probably means I need better docs)
<re_irc> <@j​amesmunns:m​atrix.org> Oh, is this for the fancy lights, btw?
<re_irc> <@j​amwaffles:m​atrix.org> Something to do with reading the serial port. Previously I was using USB, delimiting with a newline, and deserializing without COBS. I'm now using a USB serial adapter which I think throws out packets with varying lengths which means I need to "accumulate" them
<re_irc> <@j​amwaffles:m​atrix.org> Yeah it is
<re_irc> <@j​amwaffles:m​atrix.org> Monitoring battery current usage :)
<re_irc> <@j​amesmunns:m​atrix.org> niiiiiiice
<re_irc> <@j​amwaffles:m​atrix.org> All going into Grafana for pretty screenshot reasons
<re_irc> <@j​amesmunns:m​atrix.org> ayyyyyoooo
<re_irc> <@j​amesmunns:m​atrix.org> btw - brilliant (hah!) idea to have built-in mount points for a diffuser
<re_irc> <@j​amesmunns:m​atrix.org> that HAS to be a life saver.
<re_irc> <@j​amesmunns:m​atrix.org> plus those LEDs look brighter than your garden variety WS2812B, though those already blind me
<re_irc> <@j​amesmunns:m​atrix.org> (it doesn't help most of my LED hacking is done at night)
<re_irc> <@j​amwaffles:m​atrix.org> I was using a stack of postit notes before lol
<re_irc> <@j​amwaffles:m​atrix.org> These LEDs are so bright they bleached them
<re_irc> <@j​amesmunns:m​atrix.org> lolol
<re_irc> <@j​amwaffles:m​atrix.org> They're just 4000k white LEDs but I can PWM them with TLC5940s
<re_irc> <@j​amesmunns:m​atrix.org> how much power/LED?
<re_irc> <@j​amwaffles:m​atrix.org> 40mA roughly, but it's pulsed (even at 100% duty cycle)
<re_irc> <@j​amwaffles:m​atrix.org> 25 LEDs plus drivers, USB-C power IC, etc is about 6 Watts
<re_irc> <@j​amesmunns:m​atrix.org> Nice! Not too stonking bright, but def brighter than the usual 25-35mA for a smartled (assuming still 5V power), but probably more warm white light for the same power
<re_irc> <@j​amwaffles:m​atrix.org> > Not too stonking bright
<re_irc> <@j​amwaffles:m​atrix.org> It's _painful_ at full brightness :D
<re_irc> <@j​amesmunns:m​atrix.org> I have a 256-smartled panel (16x16, takes like 12-15A at 5V), and I accidentally set it full brightness once, and it IMMEDIATELY gave me a headache.
<re_irc> <@j​amwaffles:m​atrix.org> And I'm gonna be adding 10mA to the current at some point
<re_irc> <@j​amwaffles:m​atrix.org> Yeah LEDs are definitely entering the "might need safety glasses" territory these days
<re_irc> <@j​amwaffles:m​atrix.org> jamwaffles: I did it! https://github.com/jamesmunns/postcard/pull/41
<re_irc> <@j​amesmunns:m​atrix.org> Review comments back at you jamwaffles !
<re_irc> <@j​amesmunns:m​atrix.org> jamwaffles: I just released v0.7.1, but I realized the example is wrong
<re_irc> <@j​amesmunns:m​atrix.org> you `break` on `Consumed`, but you should instead continue (or NOP)
<re_irc> <@j​amesmunns:m​atrix.org> oh, nevermind me
<re_irc> <@j​amesmunns:m​atrix.org> I'm wrong
<re_irc> <@j​amesmunns:m​atrix.org> ha ha
<re_irc> <@j​amesmunns:m​atrix.org> then uhh, hooray v0.7.1!
<re_irc> <@j​amwaffles:m​atrix.org> Releases will continue until examples improve
<re_irc> <@j​amwaffles:m​atrix.org> Hooray for 0.7.1! 🎉
<re_irc> <@j​amesmunns:m​atrix.org> Thanks again!
<re_irc> <@j​amwaffles:m​atrix.org> Any time :)
<re_irc> <@h​enrik_alser:m​atrix.org> Great job 🍿
fabic has joined #rust-embedded
<re_irc> <@h​enrik_alser:m​atrix.org> Works great 🎉 jamwaffles jamesmunns
<re_irc> <@h​enrik_alser:m​atrix.org> Just a small PR that makes new() a const fn https://github.com/jamesmunns/postcard/pull/42
<re_irc> <@h​enrik_alser:m​atrix.org> (so it can be early initialized in rtic etc)
tokomak has quit [Ping timeout: 256 seconds]
<re_irc> <@j​amwaffles:m​atrix.org> Nice catch
<re_irc> <@j​amwaffles:m​atrix.org> Working great here too :D
<re_irc> <@j​amesmunns:m​atrix.org> Aaaaand released as v0.7.2!
<re_irc> <@j​amesmunns:m​atrix.org> Thanks henrik_alser!
<re_irc> <@j​amesmunns:m​atrix.org> Oof, popular time for a release, as it seems: https://docs.rs/releases/queue
fabic has quit [Ping timeout: 272 seconds]
<re_irc> <@r​yan-summers:m​atrix.org> jamwaffles: Out of curiosity, what are you using for telemetry transfer + display? We have a very similar setup using mqtt + telegram + influxdb
<re_irc> <@j​amwaffles:m​atrix.org> USART to USB converter off ebay, picked up by a quick lil Rust program that writes it into Postgres which I hooked Grafana up to
<re_irc> <@j​amwaffles:m​atrix.org> I tried influxDB but couldn't get it working. I like/am familiar with PG so I just used that
<re_irc> <@r​yan-summers:m​atrix.org> Ah okay, so also grafana :) Was wondering! I didn't have a hand in the database work, I just got to see the nice results
<re_irc> <@r​yan-summers:m​atrix.org> It looks really nice though
<re_irc> <@j​amwaffles:m​atrix.org> Yeah I love Grafana
<re_irc> <@j​amwaffles:m​atrix.org> I cba with hand writing JS chart components or whatever, I just want the data!
<re_irc> <@j​amwaffles:m​atrix.org> Grafana is absolute boss for that
zBeeble42 has joined #rust-embedded
GenTooMan has quit [Ping timeout: 258 seconds]
GenTooMan has joined #rust-embedded
neceve has quit [Ping timeout: 258 seconds]
zBeeble42 is now known as zBeeble
creich has joined #rust-embedded
zBeeble42 has joined #rust-embedded
zBeeble42 has quit [Read error: Connection reset by peer]
zBeeble has quit [Read error: Connection reset by peer]