fix logic

This commit is contained in:
2024-09-27 17:28:49 +03:00
parent e4cc2cecf5
commit 3424b775aa
5 changed files with 45 additions and 21 deletions

View File

@ -54,6 +54,7 @@ void UART3_SaveShot(uint8_t *dataPtr, uint8_t len) {
SendResponse(dataPtr[0], 0, NULL, 0);
}
// 101
void UART3_SaveProgram(uint8_t *dataPtr, uint8_t len) {
const uint8_t MIN_PARAM_LENGTH = 5;
if (!checkLen(dataPtr[0], len, MIN_PARAM_LENGTH))
@ -80,6 +81,7 @@ void UART3_SaveProgram(uint8_t *dataPtr, uint8_t len) {
SendResponse(dataPtr[0], 0, NULL, 0);
}
// 100
void UART3_SaveMacro(uint8_t *dataPtr, uint8_t len) {
const uint8_t MIN_PARAM_LENGTH = 5;
if (!checkLen(dataPtr[0], len, MIN_PARAM_LENGTH))
@ -115,7 +117,7 @@ void UART3_StartMacro(uint8_t *dataPtr, uint8_t len) {
return;
uint8_t macroIndx = dataPtr[1];
if(prepareMacro(macroIndx))
if (prepareMacro(macroIndx))
startShooting(infoBlock.hwInfo.timings.preRun);
SendResponse(dataPtr[0], 0, NULL, 0);
@ -128,7 +130,7 @@ void UART3_StartProgram(uint8_t *dataPtr, uint8_t len) {
return;
uint8_t progIndx = dataPtr[1];
if(prepareProgramm(progIndx))
if (prepareProgramm(progIndx))
startShooting(infoBlock.hwInfo.timings.preRun);
SendResponse(dataPtr[0], 0, NULL, 0);
@ -141,7 +143,7 @@ void UART3_StartShot(uint8_t *dataPtr, uint8_t len) {
return;
uint8_t shotIndx = dataPtr[1];
if(prepareShot(shotIndx))
if (prepareShot(shotIndx))
startShooting(infoBlock.hwInfo.timings.preRun);
SendResponse(dataPtr[0], 0, NULL, 0);
@ -302,6 +304,21 @@ void UART3_SetServoMinAngle(uint8_t *dataPtr, uint8_t len) {
SendResponse(dataPtr[0], 0, NULL, 0);
}
// 204
void UART3_ResetServoMinAngle(uint8_t *dataPtr, uint8_t len) {
const uint8_t MIN_PARAM_LENGTH = 1;
if (!checkLen(dataPtr[0], len, MIN_PARAM_LENGTH))
return;
ServoMap servo = dataPtr[1];
infoBlock.hwInfo.servos[servo].min = 0;
infoBlock.hwInfo.servos[servo].max = 180;
saveInfoBlock();
SendResponse(dataPtr[0], 0, NULL, 0);
}
void UART3_GetServoMaxAngle(uint8_t *dataPtr, uint8_t len) {
const uint8_t MIN_PARAM_LENGTH = 1;
if (!checkLen(dataPtr[0], len, MIN_PARAM_LENGTH))