mirror of
https://github.com/DashyFox/StackSport.git
synced 2025-06-28 13:19:41 +00:00
half work
This commit is contained in:
@ -96,10 +96,11 @@ void UART3_SaveMacro(uint8_t *dataPtr, uint8_t len) {
|
||||
for (uint8_t i = 0; i < macro.header.programmCount; i++) {
|
||||
uint8_t pos = 2 + i * sizeof(MacroProgram);
|
||||
macro.programs[i].id = dataPtr[pos + 0];
|
||||
macro.programs[i].speedScrew = dataPtr[pos + 2];
|
||||
macro.programs[i].countRepeat = dataPtr[pos + 3];
|
||||
macro.programs[i].options = dataPtr[pos + 4];
|
||||
macro.programs[i].speedScrew = dataPtr[pos + 1];
|
||||
macro.programs[i].countRepeat = dataPtr[pos + 2];
|
||||
macro.programs[i].options = dataPtr[pos + 3];
|
||||
}
|
||||
saveMacro(macroIndx, ¯o);
|
||||
} else {
|
||||
delMacro(macroIndx);
|
||||
}
|
||||
@ -107,22 +108,28 @@ void UART3_SaveMacro(uint8_t *dataPtr, uint8_t len) {
|
||||
SendResponse(dataPtr[0], 0, NULL, 0);
|
||||
}
|
||||
|
||||
// 100
|
||||
void UART3_StartMacro(uint8_t *dataPtr, uint8_t len) {
|
||||
const uint8_t MIN_PARAM_LENGTH = 0;
|
||||
const uint8_t MIN_PARAM_LENGTH = 1;
|
||||
if (!checkLen(dataPtr[0], len, MIN_PARAM_LENGTH))
|
||||
return;
|
||||
|
||||
uint8_t macroIndx = dataPtr[1];
|
||||
if(prepareMacro(macroIndx))
|
||||
startShooting(infoBlock.hwInfo.timings.preRun);
|
||||
|
||||
SendResponse(dataPtr[0], 0, NULL, 0);
|
||||
}
|
||||
|
||||
// 101
|
||||
void UART3_StartProgram(uint8_t *dataPtr, uint8_t len) {
|
||||
const uint8_t MIN_PARAM_LENGTH = 0;
|
||||
const uint8_t MIN_PARAM_LENGTH = 1;
|
||||
if (!checkLen(dataPtr[0], len, MIN_PARAM_LENGTH))
|
||||
return;
|
||||
|
||||
uint8_t progIndx = dataPtr[1];
|
||||
prepareProgramm(progIndx);
|
||||
startShooting(infoBlock.hwInfo.timings.preRun);
|
||||
if(prepareProgramm(progIndx))
|
||||
startShooting(infoBlock.hwInfo.timings.preRun);
|
||||
|
||||
SendResponse(dataPtr[0], 0, NULL, 0);
|
||||
}
|
||||
@ -134,8 +141,8 @@ void UART3_StartShot(uint8_t *dataPtr, uint8_t len) {
|
||||
return;
|
||||
|
||||
uint8_t shotIndx = dataPtr[1];
|
||||
prepareShot(shotIndx);
|
||||
startShooting(infoBlock.hwInfo.timings.preRun);
|
||||
if(prepareShot(shotIndx))
|
||||
startShooting(infoBlock.hwInfo.timings.preRun);
|
||||
|
||||
SendResponse(dataPtr[0], 0, NULL, 0);
|
||||
}
|
||||
@ -470,13 +477,13 @@ void UART3_ReadStatistics(uint8_t *dataPtr, uint8_t len) {
|
||||
|
||||
switch (currentInfo.mode) {
|
||||
case ShotMode:
|
||||
res.shot_number = isRun ? currentInfo.shot.index : 0xFF;
|
||||
res.shot_number = isRun ? currentInfo.shot.indexGlobal : 0xFF;
|
||||
break;
|
||||
case ProgramMode:
|
||||
res.program_number = isRun ? currentInfo.program.index : 0xFF;
|
||||
res.program_number = isRun ? currentInfo.program.indexGlobal : 0xFF;
|
||||
break;
|
||||
case MacroMode:
|
||||
res.macro_number = isRun ? currentInfo.macro.index : 0xFF;
|
||||
res.macro_number = isRun ? currentInfo.macro.indexGlobal : 0xFF;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -488,8 +495,8 @@ void UART3_ReadStatistics(uint8_t *dataPtr, uint8_t len) {
|
||||
res.total_program_done_HIGH = HIGHBIT(infoBlock.statInfo.shotsInProgram);
|
||||
res.total_program_done_LOW = LOWBIT(infoBlock.statInfo.shotsInProgram);
|
||||
|
||||
res.total_macro_done_HIGH = HIGHBIT(infoBlock.statInfo.totalMacros);
|
||||
res.total_macro_done_LOW = LOWBIT(infoBlock.statInfo.totalMacros);
|
||||
res.total_macro_done_HIGH = HIGHBIT(infoBlock.statInfo.shotInMacro);
|
||||
res.total_macro_done_LOW = LOWBIT(infoBlock.statInfo.shotInMacro);
|
||||
|
||||
SendResponse(dataPtr[0], 0, (uint8_t*) &res, sizeof(res));
|
||||
}
|
||||
|
Reference in New Issue
Block a user