ArduSub custom motor control

Understood!

Well, I think at this point it may be too late to alter our design plans and so we’ll have to present the product with the missing feature. Is the statement below accurate?

Position Hold out-of-water is unstable and currently under development by ArduSub, while position hold using the Underwater GPS Developer Kit would be possible but not within the project budget.”

Got the new switch cases written up with the while loop. This would make multiple calls for the same thing, is this acceptable? How/where is the boolean being updated to reflect the current status of the button? (I placed the stop motors code right outside the while loop assuming that somehow it’s updated within the loop).

Also, is it possible to limit the speed of the thrusters? I know for the servos we can specific values between 800 and 2200 but what about for the actual motors?

    case JSButton::button_function_t::k_custom_1:
    // this custom function lowers the arm (arm down)

    while (held) {
        SRV_Channel* chan = SRV_Channels::srv_channel(SERVO_CHAN_1 - 1); // 0-indexed
        ServoRelayEvents.do_set_servo(SERVO_CHAN_1, chan->get_output_max()); // 1-indexed

        SRV_Channel* chan = SRV_Channels::srv_channel(SERVO_CHAN_2 - 1); // 0-indexed
        ServoRelayEvents.do_set_servo(SERVO_CHAN_2, chan->get_output_max()); // 1-indexed
    }

     SRV_Channel* chan = SRV_Channels::srv_channel(SERVO_CHAN_1 - 1); // 0-indexed
     ServoRelayEvents.do_set_servo(SERVO_CHAN_1, 1500); // 1-indexed

     SRV_Channel* chan = SRV_Channels::srv_channel(SERVO_CHAN_2 - 1); // 0-indexed
     ServoRelayEvents.do_set_servo(SERVO_CHAN_2, 1500); // 1-indexed

    break;

    case JSButton::button_function_t::k_custom_2:
    // this custom function raises the arm (arm up)

    while (held) {
        SRV_Channel* chan = SRV_Channels::srv_channel(SERVO_CHAN_1 - 1); // 0-indexed
        ServoRelayEvents.do_set_servo(SERVO_CHAN_1, chan->get_output_min()); // 1-indexed

        SRV_Channel* chan = SRV_Channels::srv_channel(SERVO_CHAN_2 - 1); // 0-indexed
        ServoRelayEvents.do_set_servo(SERVO_CHAN_2, chan->get_output_min()); // 1-indexed
    }

     SRV_Channel* chan = SRV_Channels::srv_channel(SERVO_CHAN_1 - 1); // 0-indexed
     ServoRelayEvents.do_set_servo(SERVO_CHAN_1, 1500); // 1-indexed

     SRV_Channel* chan = SRV_Channels::srv_channel(SERVO_CHAN_2 - 1); // 0-indexed
     ServoRelayEvents.do_set_servo(SERVO_CHAN_2, 1500); // 1-indexed

    break;