romanz / amodem

Audio MODEM Communication Library in Python
Other
950 stars 118 forks source link

Disable Checksum check? #42

Open TheMKDev opened 5 years ago

TheMKDev commented 5 years ago

Is there a way to disable the check?

Eric-Miao commented 4 years ago

No, we also encounter this problem. LOL

RonAmihai commented 4 years ago

I've succeeded to "achieve" this by disabling the raising of the checksum error. https://github.com/romanz/amodem/blob/10c06f7646f12e2f03115b188feba8482d779387/amodem/framing.py#L31

But it seems to cause side effects sometimes like raising struct.error: unpack requires a buffer of 4 bytes here: https://github.com/romanz/amodem/blob/10c06f7646f12e2f03115b188feba8482d779387/amodem/framing.py#L26

I've took the ugliness ever further, surrounded the struct.unpack with try/except and ignored the error in case it rises. Of course it doesn't end well from the data's perspective, and if the process actually reaches this point the data will be almost completely corrupted (event though the I/O logged as 'Finished').

So I'm trying to find what causes the size alignment issues in the case of ignored checksum error.

Tetragromaton commented 4 years ago

Same at android app, can it be toggled off ?

romanz commented 4 years ago

It can be done, but the main issue (as @RonAmihai mentioned) is the loss of byte alignment. Given enough noise, the receiver will lose the synchronization and won't be able to decode the rest of the message. Would you like to have the option to recover the initial part of the message, before the checksum error?

erikson1970 commented 4 years ago

Nice work @romanz - I added optional flag to enable/disable stop faults in my latest commit on my fork. I am going to add Reed Solomon FEC next. May take a few days as the day job is intruding.