-
Notifications
You must be signed in to change notification settings - Fork 29
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
base: main
Are you sure you want to change the base?
Conversation
issue #62 |
src/orgasm_control.c
Outdated
// 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); | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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 ); | ||
} |
There was a problem hiding this comment.
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
fixed with your new pull requests