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

used motor ramp in orgasm modes instead of jarring ramp up #74

Closed
wants to merge 0 commits into from

Conversation

B4ben-69
Copy link
Contributor

fixes issue #62

Config.motor_start_speed, Config.motor_max_speed, Config.motor_ramp_time_s))
) {
output_state.motor_speed += calculate_increment(
Config.motor_start_speed, Config.motor_max_speed, Config.motor_ramp_time_s
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible that we can calculate this once at a higher scope and use that value down here for all these comparisons and increments? Speed isn't really a concern, but I think it would be tidy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true, i haven't looked that it becomes a "constant" unless start, max or ramp time is changed in config. I'll look into it tonight

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 just saw your update on motor control.
I had switched to : update_check(output_state.motor_speed, 0);

should i change all of these to your new fonction? _set_speed(uint8_t speed)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, use _set_speed, that will ensure both the hardware speed and the broadcasted events remain in sync.

update_check is used to set a flag if a value has changed, which is used by things like the UI and event manager to dispatch events. This should only be used for arousal and motor speed changes. I will likely clean this up as part of my efforts to simplify orgasm_control.c, since it is still inconsistent when output_state.motor_speed is used.

@@ -298,6 +300,8 @@ static void orgasm_control_updateEdgingTime() { // Edging+Orgasm timer
if (orgasm_control_isPermitOrgasmReached() && !orgasm_control_isPostOrgasmReached()) {
if (output_state.control_motor) {
orgasm_control_pauseControl(); // make sure orgasm is now possible
// Calculate motor increment once, from here to end of post orgasm
output_state.motor_increment = calculate_increment(Config.motor_start_speed, Config.motor_max_speed, Config.motor_ramp_time_s);
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't cache this value in a global state. Apologies, when I said a "higher scope" I meant at the top of the function call you were in.

Config values can change at runtime, and this value should be recalculated whenever it is used to ensure the freshest config values. There is no need to devote a static memory allocation to this value. I just did not want the value recalculated between your conditional clause and the final usage of it.

} else {
post_orgasm_state.menu_is_locked = ocFALSE;
post_orgasm_state.detected_orgasm = ocFALSE;
output_state.motor_speed = 0;
update_check(output_state.motor_speed, 0)
eom_hal_set_motor_speed(output_state.motor_speed);
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 as discussed

// raise motor speed to max speep. protect not to go higher than max
if (output_state.motor_speed <= (Config.motor_max_speed - calculate_increment(
Config.motor_start_speed, Config.motor_max_speed, Config.motor_ramp_time_s))
// raise motor speed to max speed. protect not to go higher than max
Copy link
Contributor

Choose a reason for hiding this comment

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

This scope here is a good place to put your motor_increment variable. You can declare it at the top of this scope, then define it down here with the calculation. That will leave it available to both the conditional and the speed assignment below.

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 refreshed my branch with your new updates since it was causing merge issues. Had to resubmit a merge request

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