InfiniTime icon indicating copy to clipboard operation
InfiniTime copied to clipboard

Fix SIGFPE in MotionController

Open kaloyan-raev opened this issue 1 month ago • 3 comments

Avoid division by zero when time - lastTime == 0. This happenedwhen I started InfiniSim for the first time.

kaloyan-raev avatar Nov 30 '25 13:11 kaloyan-raev

The specific SIGFPE I got in the simulator was:

Thread 13 "MAIN" received signal SIGFPE, Arithmetic exception.
[Switching to Thread 0x7fffda97d640 (LWP 248941)]
0x00005555555cf7f5 in Pinetime::Controllers::MotionController::Update (this=0x5555556c12a0 <motionController>, x=0, y=0, z=0, nbSteps=0) at /home/kaloyan/git/InfiniSim/InfiniTime/src/components/motion/MotionController.cpp:61
61	                  100 / (time - lastTime);

kaloyan-raev avatar Nov 30 '25 13:11 kaloyan-raev

Build size and comparison to main:

Section Size Difference
text 382444B 16B
data 944B 0B
bss 22632B 0B

Run in InfiniEmu

github-actions[bot] avatar Nov 30 '25 13:11 github-actions[bot]

Thanks for the patch :)

This should have already been resolved by #2329 as this now enforces 100 ticks between each UpdateMotion call, could you try InfiniSim with the latest main?

mark9064 avatar Dec 06 '25 14:12 mark9064