fix programm

This commit is contained in:
DashyFox 2024-09-22 23:02:30 +03:00
parent 9b94fd12d6
commit 1564f38ff3
2 changed files with 10 additions and 6 deletions

View File

@ -13,7 +13,7 @@
#include "Print.h"
#include "SimpleTimer.h"
#define ballReact_value 10
#define ballReact_value 10 // время реакции на вылет мяча
CurrentInfo currentInfo;
@ -266,8 +266,8 @@ void shotApply(Shot *shot) {
shot->rotationVertical);
setRollersSpeed(shot->speedRollerTop, shot->speedRollerBottom);
setScrewkSpeed(shot->speedScrew);
noBallTimeout = calculatePeriod(
shot->speedScrew) * NOBALL_TIMEOUT_MULTIPLIER;
noBallTimeout = MIN(calculatePeriod(
shot->speedScrew) * NOBALL_TIMEOUT_MULTIPLIER, 30000);
noBallTimer = millis();
print("Fire!\n");
print("isExist ");
@ -308,8 +308,13 @@ uint8_t loadShotFromProgram(CurrentProgram *currentProg) {
// TODO: sound_ERR(); ledFX_ERR();
return 0;
}
shot_.speedScrew =
uint8_t overridenSpeedScrew =
currentProg->program.shots[currentProgramShotId].speedScrew;
if (overridenSpeedScrew != 0) {
shot_.speedScrew = overridenSpeedScrew;
}
uint8_t repeatCountFromShot = currentProg->program.header.options & 2U;
if (!repeatCountFromShot) {
print("Repeat Count Override\n");
@ -410,7 +415,6 @@ uint8_t prepareShot(uint8_t number) {
return 0;
}
}
uint8_t prepareProgramm(uint8_t number) {
Program program;
getProg(number, &program);

View File

@ -65,7 +65,7 @@ void UART3_SaveProgram(uint8_t *dataPtr, uint8_t len) {
prog.header.countRepeat = dataPtr[2];
prog.header.options = dataPtr[3];
if (dataPtr[4] != 0xFF && dataPtr[5]) {
if (dataPtr[4] != 0xFF && dataPtr[5] != 0xFF) {
for (uint8_t i = 0; i < prog.header.shotCount; i++) {
uint8_t pos = 4 + i * sizeof(ProgramShot);
prog.shots[i].id = dataPtr[pos + 0];