Rumba32: Servo position at start and after "auto-off"

edited October 16 in General
To control the servo via the servo connector on my Rumba32 1.1b I used
IO_OUTPUT(Servo1Pin, 15)
SERVO_ANALOG(Servo1, 0, Servo1Pin, 1170, 1950, 1900)
I can control a standard servo without any changes in the connector.
I use M340 P0 S1180 to put it in sense-direction and M340 P0 S1900 to park-direction.

When starting the board, the servo is in a position out of the range as set above. From the definition in io_servos.h I assume that the last three values are min, max and neutral values and NOT predefined positions.

1. When I start my board the servo moves to a position higher than S1900.
2.In the old firmware I have added R300 to make the servo switch off at the end to reduce noise in the temperature measurement.
When I add R300 or other values to the command, the servo moves to the same position like after a restart.

Is that intended? How do I make the position start in my predefined neutral position, stay there and switch off the power at that position?



Comments

  • When you look into init function:
    void init() { \
    analogServoSlots[slot] = this; \
    position = neutral; \
    HAL::servoMicroseconds(slot, neutral, 1000); \
    } \

    You see last value (neutral) is just the initialization value that is hold for 1000 so in your case initialization would be same as sending
    M340 S1900 R1000

    The other 2 are min and max value for M340.

    So intention is to behave as you expect - go to 1900 for 1 second and then power off.

    I used that for BLTouch where timings are important. So I'm quite sure timings are working.

    But you said with R300 position is higher. Does that mean without R position is correct?
    My theory is that the disabling causes the pulse time to be 2500. Can you modify in boards/FTM32F4/HAL.cpp the function TIMER_VECTOR to look like this:

    // Servo timer Interrupt handler
    void TIMER_VECTOR(SERVO_TIMER_NUM) {
    #if NUM_SERVOS > 0
    if (actServo && HAL::servoTimings[servoId]) {
    actServo->enable();
    }
    }

    That should prevent enabling with disabled servo and solve position problems if I'm right.
  • Thanks a lot! That solved the problem.

    You were right, it was for roughly a second in the right position, than it moves to a high ms value.

    With your change it works fine.

    After restart, it stays at the desired position. Adding R500 (300 was not enought) it sets the position and stays there.

    One question, one answer, solved. Make life always that easy, please.
Sign In or Register to comment.