ArduPilot / SiK

Tools and firmware for the Si1000
BSD 2-Clause "Simplified" License
284 stars 232 forks source link

Use proper CRC for flash parameter storage and refactor param save/load #6

Closed pelrun closed 10 years ago

pelrun commented 11 years ago

Original checksum was extremely brittle; changed from sequential XOR to the crc16 used by the packet code.

Since changing the checksum code invalidates existing configuration data, took opportunity to refactor the save/load code and the in-flash data format, which also resolved some weird configuration corruption issues we've been seeing.

tridge commented 11 years ago

Hi James, Thanks for this! I'll pull this in next time I do a major upgrade (such as adding multiple node support). I won't pull it in now as I don't think the old one is bad enough to require everyone to redo their config. Cheers, Tridge

tridge commented 10 years ago

I've decided not to make the change as I haven't seen any evidence that the weak CRC causes any problem, and I would like to keep compatibility with previous releases

pelrun commented 10 years ago

It wasn't a theoretical fix, though, I actually encountered problems on the bench, since a wiped parameter block (filled with FF's) will be seen as valid if the crc is 0. It's also valid if the param block was filled with 0's, but that's less likely when reflashing. That said, both of those cases could be screened for separately, without the incompatibility of a new CRC.