This commit is contained in:
DashyFox 2024-09-25 03:48:25 +03:00
parent d9ad8667cc
commit d088948a1d

View File

@ -346,8 +346,10 @@ uint8_t loadProgramFromMacro(CurrentMacro *currentMacro) {
print("Program indexGlobal out of range in currentMacro\n"); print("Program indexGlobal out of range in currentMacro\n");
return 0; return 0;
} }
MacroProgram *macroProgram =
&currentMacro->macro.programs[currentProgIndexLocal];
uint8_t programId = currentMacro->macro.programs[currentProgIndexLocal].id; uint8_t programId = macroProgram->id;
currentMacro->currentProgram.indexGlobal = programId; currentMacro->currentProgram.indexGlobal = programId;
getProg(programId, &program_); getProg(programId, &program_);
@ -357,20 +359,19 @@ uint8_t loadProgramFromMacro(CurrentMacro *currentMacro) {
return 0; return 0;
} }
uint8_t needOverride = uint8_t needOverride = macroProgram->countRepeat != 0
currentMacro->macro.programs[currentProgIndexLocal].countRepeat != 0 && macroProgram->speedScrew != 0;
&& currentMacro->macro.programs[currentProgIndexLocal].speedScrew
!= 0;
if (needOverride) { if (needOverride) {
print("Override programs params\n"); print("Override programs params\n");
program_.header.countRepeat = program_.header.countRepeat = macroProgram->countRepeat;
currentMacro->macro.programs[currentProgIndexLocal].countRepeat;
program_.header.options = // options override(???)
currentMacro->macro.programs[currentProgIndexLocal].options; uint8_t options = macroProgram->options;
program_.header.options = options;
for (uint8_t i = 0; i < program_.header.shotCount; i++) { for (uint8_t i = 0; i < program_.header.shotCount; i++) {
program_.shots[i].speedScrew = program_.shots[i].speedScrew = macroProgram->speedScrew;
currentMacro->macro.programs[currentProgIndexLocal].speedScrew;
} }
} }
currentMacro->currentProgram.program = program_; currentMacro->currentProgram.program = program_;