<re_irc>
<@disasm-ewg:matrix.org> almindor: TIL one can install svd2rust from AUR 😅
<re_irc>
<@disasm-ewg:matrix.org> Probably the next step is to find svd2rust on one of these "CDs full of software"
<re_irc>
<@9names:matrix.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>
<@disasm-ewg:matrix.org> 9names: On eight floppy disks
neceve has joined #rust-embedded
fabic has quit [Remote host closed the connection]
<re_irc>
<@theunkn0wn1:matrix.org> henrik_alser: That is a serde compatible serialization layer, it doesn't handle framing. Postcard-cobs suffers from the same defect
<re_irc>
<@theunkn0wn1:matrix.org> Further, postcard has no library support outside of rust, afaik.
fabic has joined #rust-embedded
<re_irc>
<@henrik_alser:matrix.org> What kind of framing are you looking for? (I mean cobs is a kind of framing itself…)
<re_irc>
<@henrik_alser:matrix.org> (You’d use the cobs ”flavour” with postcard)
<re_irc>
<@theunkn0wn1:matrix.org> henrik_alser: Something that allows me to clearly detect the threshold between frames, which is what cobs gives
<re_irc>
<@theunkn0wn1:matrix.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>
<@theunkn0wn1:matrix.org> Which would probably be an interesting but time consuming process 🤔
<re_irc>
<@henrik_alser:matrix.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>
<@theunkn0wn1:matrix.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>
<@theunkn0wn1:matrix.org> What I need is a cobs equivalent that doesn't panic on bad data.
<re_irc>
<@theunkn0wn1:matrix.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>
<@henrik_alser:matrix.org> Never used the postcard-cobs crate, i think you’re supposed to use the postcard crate with cobs flavor
<re_irc>
<@henrik_alser:matrix.org> Seems I don’t really understand the problem i however so i rest my case :)
<re_irc>
<@theunkn0wn1:matrix.org> postcard depends on postcard-obs.
<re_irc>
<@theunkn0wn1:matrix.org> Il try to restate the problem:
<re_irc>
<@theunkn0wn1:matrix.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>
<@theunkn0wn1:matrix.org> The device needs to *receive* data over its USART, that holds a command.
<re_irc>
<@theunkn0wn1:matrix.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>
<@jamesmunns:matrix.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>
<@theunkn0wn1:matrix.org> im not sure i fixed it the right way though.
<re_irc>
<@jamesmunns:matrix.org> ACK!
<re_irc>
<@jamesmunns:matrix.org> Will look, if you don't see progress by this weekend, plz reping me here :)
<re_irc>
<@theunkn0wn1:matrix.org> Wilco.
<re_irc>
<@jamesmunns:matrix.org> theunkn0wn1: merged your changes and published as `v0.2.0` of `postcard-cobs`.
<re_irc>
<@jamesmunns:matrix.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>
<@jamwaffles:matrix.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>
<@jamesmunns:matrix.org> is "with cobs" okay?
<re_irc>
<@jamesmunns:matrix.org> that's how I usually do it over UART
<re_irc>
<@jamwaffles:matrix.org> Yeah of course, I've been trying that to but to no avail :(
<re_irc>
<@jamesmunns:matrix.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>
<@jamesmunns:matrix.org> See `phm-cli` (host side) and `phm` (device side) for example.
<re_irc>
<@jamesmunns:matrix.org> (or `vintage-cli` and `vintage`)
<re_irc>
<@jamesmunns:matrix.org> (I should probably just upstream roughly that code to postcard, I guess, I copy and paste that file like everywhere 😅)
<re_irc>
<@jamwaffles:matrix.org> Ahh your COBS `Buffer` is doing some fancy stuff which I'm... not lol
<re_irc>
<@jamwaffles:matrix.org> Mind if I steal it?
<re_irc>
<@jamesmunns:matrix.org> Please do! I don't have a license there (whoops), but assume MIT+Apache 2.0
<re_irc>
<@jamesmunns:matrix.org> also, probably worth just using a modern const-generics heapless buffer in there.
<re_irc>
<@jamesmunns:matrix.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>
<@jamesmunns:matrix.org> If not, I'll do it... eventually :D
<re_irc>
<@jamwaffles:matrix.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>
<@jamwaffles:matrix.org> It's extremely noice with const generics
<re_irc>
<@jamesmunns:matrix.org> :D
crabbedhaloablut has joined #rust-embedded
crabbedhaloablut has quit [Remote host closed the connection]
<re_irc>
<@jamwaffles:matrix.org> `heapless` uses const-generics now doesn't it
crabbedhaloablut has joined #rust-embedded
<re_irc>
<@jamesmunns:matrix.org> yep
<re_irc>
<@jamesmunns:matrix.org> and postcard now uses the new const-generics heapless (behind a feature flag)
<re_irc>
<@jamesmunns:matrix.org> Corn on the cobs cross-language puns, you say? https://docs.rs/kolben
<re_irc>
<@jamesmunns:matrix.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>
<@jamesmunns:matrix.org> "Buffer" is just kind of a contextless name :D
<re_irc>
<@jamwaffles:matrix.org> We can bikeshed in the PR :)
<re_irc>
<@jamwaffles:matrix.org> Which I have now publicly committed to. Very dangerous
<re_irc>
<@jamwaffles:matrix.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>
<@jamesmunns:matrix.org> I'd also be interested in what I WAS doing, that you weren't
<re_irc>
<@jamesmunns:matrix.org> (probably means I need better docs)
<re_irc>
<@jamesmunns:matrix.org> Oh, is this for the fancy lights, btw?
<re_irc>
<@jamwaffles:matrix.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>
<@jamwaffles:matrix.org> Yeah it is
<re_irc>
<@jamwaffles:matrix.org> Monitoring battery current usage :)
<re_irc>
<@jamesmunns:matrix.org> niiiiiiice
<re_irc>
<@jamwaffles:matrix.org> All going into Grafana for pretty screenshot reasons
<re_irc>
<@jamesmunns:matrix.org> ayyyyyoooo
<re_irc>
<@jamesmunns:matrix.org> btw - brilliant (hah!) idea to have built-in mount points for a diffuser
<re_irc>
<@jamesmunns:matrix.org> that HAS to be a life saver.
<re_irc>
<@jamesmunns:matrix.org> plus those LEDs look brighter than your garden variety WS2812B, though those already blind me
<re_irc>
<@jamesmunns:matrix.org> (it doesn't help most of my LED hacking is done at night)
<re_irc>
<@jamwaffles:matrix.org> I was using a stack of postit notes before lol
<re_irc>
<@jamwaffles:matrix.org> These LEDs are so bright they bleached them
<re_irc>
<@jamesmunns:matrix.org> lolol
<re_irc>
<@jamwaffles:matrix.org> They're just 4000k white LEDs but I can PWM them with TLC5940s
<re_irc>
<@jamesmunns:matrix.org> how much power/LED?
<re_irc>
<@jamwaffles:matrix.org> 40mA roughly, but it's pulsed (even at 100% duty cycle)
<re_irc>
<@jamwaffles:matrix.org> 25 LEDs plus drivers, USB-C power IC, etc is about 6 Watts
<re_irc>
<@jamesmunns:matrix.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>
<@jamwaffles:matrix.org> > Not too stonking bright
<re_irc>
<@jamwaffles:matrix.org> It's _painful_ at full brightness :D
<re_irc>
<@jamesmunns:matrix.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>
<@jamwaffles:matrix.org> And I'm gonna be adding 10mA to the current at some point
<re_irc>
<@jamwaffles:matrix.org> Yeah LEDs are definitely entering the "might need safety glasses" territory these days
<re_irc>
<@ryan-summers:matrix.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>
<@jamwaffles:matrix.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>
<@jamwaffles:matrix.org> I tried influxDB but couldn't get it working. I like/am familiar with PG so I just used that
<re_irc>
<@ryan-summers:matrix.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>
<@ryan-summers:matrix.org> It looks really nice though
<re_irc>
<@jamwaffles:matrix.org> Yeah I love Grafana
<re_irc>
<@jamwaffles:matrix.org> I cba with hand writing JS chart components or whatever, I just want the data!
<re_irc>
<@jamwaffles:matrix.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]