prusa3d / Prusa-Firmware-MMU

Other
35 stars 19 forks source link

Fix mulU24X24toH16 #155

Closed DRracer closed 2 years ago

DRracer commented 2 years ago

based on https://github.com/prusa3d/Prusa-Firmware/pull/3365

wavexx commented 2 years ago

I was wondering with Alex a few days ago if the even/odd rounding behavior was originally intentional. But I don't think with interpolation it makes any difference anyway, so I would agree to take the fastest approach

leptun commented 2 years ago

The rounding was broken only because of lsr vs lsl. That part is super easy to change. It's the changes in the 16x8R8 that make it a bit faster. You can keep the faster algorithm and change lsl back to lsr and the old behaviour will be used, but I think the new one is what should have been from the start.

leptun commented 2 years ago

I've added also R0 and R1 to the clobbers of mulU24X24toH16 just like I did in the MK3 fw implementation. I think this should be fine, but I haven't tested it on the MMU since I don't have the setup at the moment for testing this. I'm approving the PR.

DRracer commented 2 years ago

@leptun I'll try it on the machine and if it goes ok, I'll merge it, thanks for your review