Open jamesmunns opened 2 years ago
Oh, also right now the phm-worker
crate has a hard dependency on defmt
, which will likely cause problems. We should maybe introduce a shim that switches between log
and defmt
, sort of like embassy
and smoltcp
do currently.
We can use the
embedded-hal-mock
crate to implement aMachine
worker that will allow us to verify the behavior in CI testing.Additionally, we can add
insta
tests to snapshot the messages-on-the-wire to ensure we never accidentally break the wire protocol.At the moment, we have a hard dependency on
serialport::SerialPort
, HOWEVER, this is aBox<dyn SerialPort>
object, and it would be totally possible to mock this as well instead of using a real serial port.End to end, this would look a little something like this:
FakeSerial
struct that impls theserialport::SerialPort
traitphm-worker::Worker
objectinsta
to snapshot the cobs encoded line protocol (command AND response)