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
starblue has quit [Ping timeout: 264 seconds]
starblue has joined #rust-embedded
<re_irc> it's quite an old design, so the main reason to use it is because you already have one
lehmrob has joined #rust-embedded
lehmrob has quit [Ping timeout: 240 seconds]
<re_irc> <@762spr:matrix.org> What's a good way to do a lookup table in a nostd way? I am working with a thermocouple so I need to store a bunch of static values to reference to determine the temperature
<re_irc> <@ithinuel:matrix.org> Do you need that table to be built at runtime?
<re_irc> <@ithinuel:matrix.org> If not simply use a global array/slice, both static or const should work fine.Read-only accesses to non-mutable globals are safe.
<re_irc> <@762spr:matrix.org> no, the data will never change so I guess a global array should work, I was just wondering if there was a better way to do it with all the neat tricks in rustπŸ˜…
thomas25 has joined #rust-embedded
thomas25 has left #rust-embedded [Textual IRC Client: www.textualapp.com]
lehmrob has joined #rust-embedded
inara has quit [Quit: Leaving]
inara has joined #rust-embedded
lehmrob has quit [Quit: Konversation terminated!]
lehmrob has joined #rust-embedded
starblue has quit [Ping timeout: 240 seconds]
starblue has joined #rust-embedded
IlPalazzo-ojiisa has joined #rust-embedded
lehmrob has quit [Ping timeout: 240 seconds]
lehmrob has joined #rust-embedded
<re_irc> <@ryan-summers:matrix.org> Question: Does Rust guarantee that safe code cannot generate a non-UTF8 "&str"?
<re_irc> <@diondokter:matrix.org> I guess so
<re_irc> <@diondokter:matrix.org> All unchecked string functions are unsafe
<re_irc> <@ryan-summers:matrix.org> Just a sec, MVP coming in that shows that's not true
<re_irc> <@diondokter:matrix.org> What.
<re_irc> <@ryan-summers:matrix.org> Yeah
<re_irc> <@ryan-summers:matrix.org> String::from_utf8_lossy isn't working properlyu
<re_irc> <@ryan-summers:matrix.org> Can someone tell me why this works
<re_irc> <@ryan-summers:matrix.org> And reassure me I'm not going insane
<re_irc> <@diondokter:matrix.org> Ah right, so the bytes representing the string remain the same
<re_irc> <@ryan-summers:matrix.org> As far as I can tell, the utf8 conversion is _supposed_ to convert invalid UTF8 sequences to the invalid character code, but it doesn't seem to do that
<re_irc> <@ryan-summers:matrix.org> If you try to provide this to anything expecting a UTF8 input, it fails
<re_irc> <@ryan-summers:matrix.org> e.g. an external data base will reject this as text
<re_irc> <@ryan-summers:matrix.org> I _think_ this is a bug in the standard library?
<re_irc> <@dirbaio:matrix.org> '00 01 02 03' is valid utf8
<re_irc> <@ryan-summers:matrix.org> Ah you're right
<re_irc> <@dirbaio:matrix.org> are you using postgres?
<re_irc> postgres rejects the '00' character, I think that's postgres-specific weirdness
<re_irc> <@ryan-summers:matrix.org> I indeed am!
<re_irc> <@diondokter:matrix.org> Yeah, using the example of the function gives the correct results
<re_irc> <@ryan-summers:matrix.org> Thanks postgres
<re_irc> <@diondokter:matrix.org> Phew
<re_irc> <@ryan-summers:matrix.org> Thanks for reassuring me. That was throwing me through a hard loop
<re_irc> <@diondokter:matrix.org> That would've been a major bug haha
<re_irc> <@ryan-summers:matrix.org> Thanks for the literature, I'll give it a read
<re_irc> <@dirbaio:matrix.org> workaround is to strip them out, or store them as "bytea" 🀷
<re_irc> <@dirbaio:matrix.org> i've had fun with this in the past too πŸ€ͺ
<re_irc> <@ryan-summers:matrix.org> God that one would have taken me absolute ages to find
<re_irc> <@ryan-summers:matrix.org> Thanks
lehmrob has quit [Ping timeout: 256 seconds]
<re_irc> <@jannic:matrix.org> TIL. And I've been using PostgreSQL since before it got that name.
<re_irc> <@amb12:matrix.org> gh formatting
loki_val has quit [Read error: Connection reset by peer]
crabbedhaloablut has joined #rust-embedded
lehmrob has joined #rust-embedded
<re_irc> <@ubik:matrix.org> , : FYI, I managed to crack the "sysex checksum". It turns out they are mangling the bits before sending them in the wire. I disassembled the function which does that and it basically takes the first N bits of a byte and saves them in a register and shifts the byte right by N bits. It then goes to the next byte, does the same for N+1 and ANDs in the bits from the register. And so on.
<re_irc> <@ubik:matrix.org> If you "decode" them by turning the algorithm the other way round, you get a set of bytes which have a regular SysEx checksum
<re_irc> <@ubik:matrix.org> I assume this is done just to confuse reverse engineers
lehmrob has quit [Ping timeout: 240 seconds]
emerent has quit [Ping timeout: 256 seconds]
emerent_ has joined #rust-embedded
emerent_ is now known as emerent
<re_irc> <@peter9477:matrix.org> : Nice. And thanks for the follow-up! :-) I wonder if rather than obfuscation it could just be an alternative form of checksum that they felt was more effective than the other relatively trivial ones that are used.
<re_irc> <@dngrs:matrix.org> when using "load" in GDB, does that actually write the binary to flash? (have been wondering about this recently because the GDB way of "flashing" seemed many many times faster than via probe-rs, instantaneous actually)
lehmrob has joined #rust-embedded
<re_irc> <@adamgreig:matrix.org> It does normally but if it's instant it's possibly not actually doing it? Gdb just tells the gdb server (openocd? Probe-rs? Pyocd?) To do the loading
<re_irc> <@dngrs:matrix.org> yeah I think I was using openocd with (probably) a BMP
<re_irc> <@dngrs:matrix.org> it's been a long time
<re_irc> <@dngrs:matrix.org> anyway it popped up in my mind again because I had previously assumed the image went to RAM but then thought, that would've required relocation...
IlPalazzo-ojiisa has quit [Quit: Leaving.]
lehmrob has quit [Ping timeout: 240 seconds]
<re_irc> <@firefrommoonlight:matrix.org> Hi! Does anyone have a good algo or lib for setting CAN timings? Thank you!
dc740 has joined #rust-embedded
<re_irc> <@timokrgr:matrix.org> : http://www.bittiming.can-wiki.info/
dc740 has quit [Remote host closed the connection]
<re_irc> <@firefrommoonlight:matrix.org> Thank you
<re_irc> <@firefrommoonlight:matrix.org> Unfortunately, that's not suitable for setting bit timing dynamically
<re_irc> <@firefrommoonlight:matrix.org> Although the play may be to interpolate from that table...
<re_irc> <@firefrommoonlight:matrix.org> (Sorry; I phrased that question poorly)
dc740 has joined #rust-embedded
dc_740 has joined #rust-embedded
dc740 has quit [Ping timeout: 256 seconds]
dc_740 has quit [Remote host closed the connection]
<re_irc> <@kaddare:matrix.org> I'M PAYING OFF DEBTS AND BILLS OF THE FIRST FIVE PEOPLE TO MESSAGE ME "ALIVE"
<re_irc> πŸŒπŸ’΅πŸ’΄πŸ’―πŸ’°