Skip to main content

status moved 0 always return 0

Posted in

Hello again
testing the last version I have found that the command
status moved motor# always returns 0

status home motor# works ok

monitoring the serial port I have seen that the openmoco sends always 0

and the code is ok

case 11:
// motor steps moved

serial_write((byte)1);
serial_write((byte)4);

serial_write( motor_steps_moved[input_serial_buffer[2]] );

sent = true;
break;

is always motor_steps_moved=0 ?

best regards
Inco.

[42] > motor 0 enable on
[set_motor] Set Motor 0 'enable' => 'on'
[43] > motor 0 dir 1 steps 100
[set_motor] Set Motor 0 'dir' => '1'
[44] > motor 0 steps 100
[set_motor] Set Motor 0 'steps' => '100'
[45] > motor 0 home on
[set_motor] Set Motor 0 'home' => 'on'
[46] > camera on
[set_camera] Set Camera Enable/Disable => 'on'
[47] > start
Starting Execution
[48] > status moved 0
moved, 0 = 0
[49] > status home 0
home, 0 = 1400
[50] > status moved 0
moved, 0 = 0
[51] > status home 0
home, 0 = 1900
[52] > stop
Stopping Execution
[53] > status home 0
home, 0 = 2900
[54] > status moved 0
moved, 0 = 0
[55] >

Inco, you are correct - the

Inco, you are correct - the problem was caused by a recent change in 0.82, used to prevent calculating motor steps moved for repeat cycle motor movements.

The latest check-in fixes this issue and the typedef issue you found previously. The problem here is an order of operations error, what was:

(line 165 of OM_Motor_Control.pde)

  if( ! action_status & B00100000 )
     motor_steps_moved[motor] += (unsigned long) ( steps - backlash_val );

Needs to be:

  if( ! (action_status & B00100000) )
     motor_steps_moved[motor] += (unsigned long) ( steps - backlash_val );

!c