fix and update save funcs

This commit is contained in:
2024-09-19 23:42:38 +03:00
parent 953593d32a
commit 6746f19cf0
6 changed files with 248 additions and 128 deletions

View File

@ -169,6 +169,7 @@ uint8_t prepareShot(uint8_t number) {
return 1;
} else {
// TODO: sound_ERR(); ledFX_ERR();
print("shot not exist\n\n");
return 0;
}
}
@ -179,24 +180,18 @@ void setPosSingle(ServoMap servo, uint8_t value) {
if (servo == SERVO_AXIAL)
inv = !inv;
uint8_t deviationToMax = currentServo->max > currentServo->def
? currentServo->max - currentServo->def
: currentServo->def - currentServo->max;
uint8_t deviationToMin = currentServo->def > currentServo->min
? currentServo->def - currentServo->min
: currentServo->min - currentServo->def;
uint8_t maxDeviation = (deviationToMax > deviationToMin) ? deviationToMax : deviationToMin;
uint8_t minLimit = (currentServo->def >= maxDeviation) ? currentServo->def - maxDeviation : 0;
uint8_t maxLimit = (currentServo->def + maxDeviation <= 180) ? currentServo->def + maxDeviation : 180;
if (value > maxLimit) {
value = maxLimit;
} else if (value < minLimit) {
value = minLimit;
}
if (inv)
value = 180 - value;
if(value > 90){
value = map(value, 91, 180, currentServo->def, currentServo->max);
}else if(value < 90) {
value = map(value, 89, 0, currentServo->def, currentServo->min);
} else {
value = currentServo->def;
}
SetServo(servo, value);
}
@ -256,11 +251,3 @@ void setRollersSpeed(uint8_t up, uint8_t down) {
Vz1 = 200 - up; // invert
Vz2 = down;
}
// shot sequence
void startProgram() {
}
// shot sequence
void startMacro() {
}