A couple of things I noticed:
1. you shouldn’t be multiplying by 9.8 in you acceleration calculation. It should be acc * sensitivity / 1000.0
2. Your acceleration range setting appears to not match what you are using for your sensitivity. Your resting acceleration is half of 9.8.
Their example here is pretty good.