MausTec / edge-o-matic-3000

Firmware for the Edge-o-Matic 3000
GNU General Public License v3.0
104 stars 29 forks source link

Motor off delay and minimum speed setting #6

Closed MauAbata closed 3 years ago

MauAbata commented 3 years ago

It would be nice if there was a min motor speed and a delay till motor ramp start settings. So that you could have more control over the spacing. It’s also be fun to have patterns for the delays. So that you could push someone closer and closer and then a long cool down.

MauAbata commented 3 years ago

https://github.com/MausTec/nogasm-wifi/blob/master/src/OrgasmControl.cpp#L53-L54

This is where the speed ramps up, so to implement motor_min_speed here you'd do something like

if (motor_speed < 0) {
  motor_speed = Config.motor_min_speed;
} else {
  motor_speed += motor_increment;
}

Though it'd be a bit more complicated--right now we need to check if the current speed is < 0, and the new speed >= 0. So that should actually be:

auto new_speed = motor_speed + motor_increment;
if (motor_speed < 0 && new_speed >= 0) {
  // Zero crossing / turn on detected
  motor_speed = Config.motor_min_speed;
} else {
  motor_speed = new_speed;
}
krishpants commented 3 years ago

Potentially fixed in my PR