mirror of
https://github.com/DashyFox/StackSport.git
synced 2025-05-04 07:10:17 +00:00
fix program switch
This commit is contained in:
parent
31a74305f6
commit
d9ad8667cc
@ -147,7 +147,6 @@ void BallEXT() {
|
||||
ballReact_timer = millis();
|
||||
}
|
||||
|
||||
|
||||
void RobotTick() {
|
||||
BallEXT_Handler();
|
||||
|
||||
@ -348,7 +347,6 @@ uint8_t loadProgramFromMacro(CurrentMacro *currentMacro) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
uint8_t programId = currentMacro->macro.programs[currentProgIndexLocal].id;
|
||||
currentMacro->currentProgram.indexGlobal = programId;
|
||||
getProg(programId, &program_);
|
||||
@ -364,11 +362,12 @@ uint8_t loadProgramFromMacro(CurrentMacro *currentMacro) {
|
||||
&& currentMacro->macro.programs[currentProgIndexLocal].speedScrew
|
||||
!= 0;
|
||||
|
||||
if (needOverride)
|
||||
{
|
||||
if (needOverride) {
|
||||
print("Override programs params\n");
|
||||
program_.header.countRepeat = currentMacro->macro.programs[currentProgIndexLocal].countRepeat;
|
||||
program_.header.options = currentMacro->macro.programs[currentProgIndexLocal].options;
|
||||
program_.header.countRepeat =
|
||||
currentMacro->macro.programs[currentProgIndexLocal].countRepeat;
|
||||
program_.header.options =
|
||||
currentMacro->macro.programs[currentProgIndexLocal].options;
|
||||
for (uint8_t i = 0; i < program_.header.shotCount; i++) {
|
||||
program_.shots[i].speedScrew =
|
||||
currentMacro->macro.programs[currentProgIndexLocal].speedScrew;
|
||||
@ -378,6 +377,7 @@ uint8_t loadProgramFromMacro(CurrentMacro *currentMacro) {
|
||||
currentMacro->currentProgram.currentShotIndexLocal = 0;
|
||||
currentMacro->currentProgram.currentBallCount = 0;
|
||||
|
||||
loadShotFromProgram(¤tMacro->currentProgram);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -412,15 +412,15 @@ uint8_t nextBallInShot(CurrentShot *shot) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint8_t nextShotInProgram(CurrentProgram *prog) {
|
||||
uint8_t shotApply_f = 0;
|
||||
if (nextBallInShot(&prog->currentShot)) {
|
||||
print("\nSwitch shot\n");
|
||||
if (!loadNextShotInProgram(prog)) {
|
||||
print("loadNextShotInProgram ERR\n");
|
||||
return 0;
|
||||
}
|
||||
shotApply(&prog->currentShot);
|
||||
shotApply_f = 1;
|
||||
}
|
||||
|
||||
// Проверка на завершение программы
|
||||
@ -431,18 +431,21 @@ uint8_t nextShotInProgram(CurrentProgram *prog) {
|
||||
print("Program DONE\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (shotApply_f)
|
||||
shotApply(&prog->currentShot);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t nextProgramInMacro(CurrentMacro *currentMacro) {
|
||||
// uint8_t shotApply_f = 0;
|
||||
if (nextShotInProgram(¤tMacro->currentProgram)) {
|
||||
print("\nSwitch program\n");
|
||||
if (!loadNextProgramInMacro(currentMacro)) {
|
||||
print("loadNextProgramInMacro ERR\n");
|
||||
return 0;
|
||||
}
|
||||
// shotApply(¤tMacro->currentProgram.currentShot);
|
||||
shotApply(¤tMacro->currentProgram.currentShot);
|
||||
// shotApply_f = 1;
|
||||
}
|
||||
|
||||
// Проверка на завершение макро
|
||||
@ -451,6 +454,8 @@ uint8_t nextProgramInMacro(CurrentMacro *currentMacro) {
|
||||
// print("Macro DONE\n");
|
||||
// return 1;
|
||||
// }
|
||||
// if (shotApply_f)
|
||||
// shotApply(¤tMacro->currentProgram.currentShot);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user