Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ramp up when orgasm earned #84

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

B4ben-69
Copy link
Contributor

fixed with your new pull requests

@B4ben-69
Copy link
Contributor Author

issue #62

Comment on lines 349 to 355
// continue to raise motor to max speed
if (output_state.motor_speed <= (Config.motor_max_speed - output_state.motor_increment)
) {
update_check(output_state.motor_speed, output_state.motor_speed + output_state.motor_increment);
} else {
update_check(output_state.motor_speed, output_state.motor_speed + output_state.motor_increment);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried using _set_speed here and display did not render correctly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_set_speed controls hardware, but does not trigger an update check. it's a mess.

@MauAbata
Copy link
Contributor

This is cleaner. I'll pull this into my editor and see if I can massage it more to my liking.

update_check(output_state.motor_speed, output_state.motor_speed + output_state.motor_increment);
} else {
update_check(output_state.motor_speed, Config.motor_max_speed );
}
Copy link
Contributor Author

@B4ben-69 B4ben-69 Mar 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these code

plus this code
output_state.motor_increment = calculate_increment(Config.motor_start_speed, Config.motor_max_speed, Config.motor_ramp_time_s);

plus this codes
// Control output while motor control is paused if (output_state.control_motor == OC_MANUAL_CONTROL) { uint8_t speed = orgasm_control_get_motor_speed(); _set_speed(speed); }

could be reduced in one function and one additional structure. For example
`
static struct {
uint8_t motor_start_speed;
uint8_t motor_max_speed;
int motor_ramp_time_s;
} config_state;

/**

  • @brief Simplified method to increment motor speed up to a config max
  • @the increment is calculated at first execution and recalculated if config changes
  • @param void
    */
    void increment_motor()
    if ( config_state.motor_max_speed != Config.motor_max_speed ||
    config_state.motor_start_speed != Config.motor_start_speed ||
    config_state.motor_ramp_time_s != Config.motor_ramp_time_s) {
    config_state.motor_max_speed != Config.motor_max_speed;
    config_state.motor_start_speed!= Config.motor_start_speed;
    config_state.motor_ramp_time_s!= Config.motor_ramp_time_s;
    output_state.motor_increment = calculate_increment(Config.motor_start_speed, Config.motor_max_speed, Config.motor_ramp_time_s);
    }
    if (output_state.motor_speed <= (Config.motor_max_speed - output_state.motor_increment)) {
    update_check(output_state.motor_speed, output_state.motor_speed + output_state.motor_increment);
    } else {
    update_check(output_state.motor_speed, Config.motor_max_speed );
    }
    _set_speed(output_state.motor_speed);`

I wound call increment_motor() in the Pre-orgasm part and the Post-orgasm part and delete all the listed code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants