esphome_samsung_ac icon indicating copy to clipboard operation
esphome_samsung_ac copied to clipboard

Ensure message delivery for NASA packets

Open atanasenko opened this issue 4 months ago • 3 comments

This is a draft of my playground which I was testing with my NASA 3 indoor to 1 outdoor units and trying to fix the writes which were either ignored or also caused some incoming packets to get mangled (sometimes including acks for a successful message). I'd like to open a discussion and am open for any suggestions.

I'm running this code locally and so far I haven't had a single missed packet for quite a while.

I don't have a way to test this with non-nasa, so I retained the behavior where packets were sent immediately after F8.

I have a suspicion that the preamble bytes that are sent prior to each packet might have something in them for congestion control. But until somebody figures this out, sending packets has to happen during quiet periods.

  • Queue outgoing packets and send them during loop()
  • Only send packets during relatively quiet time
  • Do not send new packets until we receive an ack for the one already sent
  • Retry sending packet if no ack received
  • Make absolutely sure that there is no incoming data available or there is no more data expected to arrive before sending
  • Attempt to recover packets from incoming data if stars aligned in a way that all of the above failed
  • Modify raw data logging a bit for readability

See #57

atanasenko avatar Feb 11 '24 00:02 atanasenko