C-X1/PyFlashAero

Date parsing code incorrect?

Closed this issue · 1 comments

https://github.com/cyborg-x1/PyFlashAero/blob/master/src/FlashAir/card.py#L47 code when ran against the example date value from https://www.flashair-developers.com/en/documents/api/commandcgi/ (17071) creates an invalid value - (2013, 21, 15)

It looks to me that month value is taken too wide - 0x1F = 5 bits and not 4 bits like in the documentation.

(((date&(0x3F<<9))>>9)+1980,((date&(0x0F<<5))>>5),date&(0x1F)) parses the date to a more reasonable (2013, 5, 15)

Oh, ok never noticed, I am not working with the human data, I guess I have just copied it from the day value ... damn ...

Thanks.