Closed Hoksmur closed 9 years ago
it's not a full xmodem protocol.
I didn't actually need xmodem but since it existed in eLua I hoped it would be easy to implement in nodemcu and that would have worked. Now I did something myself that would be able to use the on data event without any special character as separator that could mess up binary file transfers. I just choose a small enough size of data that I thought would fit within the receive buffer of the esp and that wouldn't be to much overhead when sending a not fully used chunk.
This is just sends 130 byte chunks with.
soh, used number of bytes, data.
Datasize is 128 bytes and is padded with random bytes if not all is used, I.e when filesize is not n*128. I end the transfer by sending a block with the used number of bytes set to zero and just 128 bytes of random data. No crc or packet number is used.
What I do though is sending the filename in the beginning, terminated by a single zero byte.
If nodemcu ever implements xmodem in C I would probably use that, but this is good enough for now.
Hi. Peter, why do you use 130 bytes block?
As I see, it should be 132: soh, num, !num, data[128], crc You can read Wiki:
And, maybe it will be usefull: this
PS: I don't understand, how should to detect file's size, when it isn't n*128..