mirror of
https://github.com/DashyFox/StackSport.git
synced 2025-06-28 05:09:32 +00:00
programm works
This commit is contained in:
@ -45,11 +45,9 @@ void UART3_SaveShot(uint8_t *dataPtr, uint8_t len) {
|
||||
shot.speedRollerTop = dataPtr[3] + 100;
|
||||
shot.speedRollerBottom = dataPtr[4] + 100;
|
||||
shot.speedScrew = map(dataPtr[5], 0, 120, 0, 100);
|
||||
shot.rotationAxial = map((int8_t)dataPtr[6], -99, 99, 0, 180);
|
||||
shot.rotationHorizontal = map((int8_t)dataPtr[7], -99, 99, 0, 180);
|
||||
shot.rotationVertical = 180 - (int8_t)dataPtr[8] - 90;
|
||||
|
||||
|
||||
shot.rotationAxial = map((int8_t) dataPtr[6], -99, 99, 0, 180);
|
||||
shot.rotationHorizontal = map((int8_t) dataPtr[7], -99, 99, 0, 180);
|
||||
shot.rotationVertical = 180 - (int8_t) dataPtr[8] - 90;
|
||||
|
||||
saveShot(shotIndx, &shot);
|
||||
|
||||
@ -97,10 +95,10 @@ void UART3_SaveMacro(uint8_t *dataPtr, uint8_t len) {
|
||||
dataPtr[5] != 0xFF) {
|
||||
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].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];
|
||||
}
|
||||
} else {
|
||||
delMacro(macroIndx);
|
||||
@ -109,7 +107,6 @@ void UART3_SaveMacro(uint8_t *dataPtr, uint8_t len) {
|
||||
SendResponse(dataPtr[0], 0, NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
void UART3_StartMacro(uint8_t *dataPtr, uint8_t len) {
|
||||
const uint8_t MIN_PARAM_LENGTH = 0;
|
||||
if (!checkLen(dataPtr[0], len, MIN_PARAM_LENGTH))
|
||||
@ -123,6 +120,10 @@ void UART3_StartProgram(uint8_t *dataPtr, uint8_t len) {
|
||||
if (!checkLen(dataPtr[0], len, MIN_PARAM_LENGTH))
|
||||
return;
|
||||
|
||||
uint8_t progIndx = dataPtr[1];
|
||||
prepareProgramm(progIndx);
|
||||
startShooting(infoBlock.hwInfo.timings.preRun);
|
||||
|
||||
SendResponse(dataPtr[0], 0, NULL, 0);
|
||||
}
|
||||
|
||||
@ -196,7 +197,6 @@ void UART3_DeleteAllData(uint8_t *dataPtr, uint8_t len) {
|
||||
EEPROM_EARSE();
|
||||
saveInfoBlock();
|
||||
|
||||
|
||||
SendResponse(dataPtr[0], 0, NULL, 0);
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ void UART3_SetServoOffset(uint8_t *dataPtr, uint8_t len) {
|
||||
uint8_t newDef = dataPtr[2];
|
||||
|
||||
printNumber(newDef);
|
||||
print("\n");
|
||||
print("\n");
|
||||
|
||||
newDef += 90; // from center
|
||||
if (newDef > 180)
|
||||
@ -452,26 +452,41 @@ void UART3_ReadStatistics(uint8_t *dataPtr, uint8_t len) {
|
||||
uint8_t macro_number;
|
||||
uint8_t program_number;
|
||||
uint8_t shot_number;
|
||||
uint8_t total_macro_done_HIGH;
|
||||
uint8_t total_macro_done_LOW;
|
||||
uint8_t total_program_done_HIGH;
|
||||
uint8_t total_macro_done_HIGH;
|
||||
uint8_t total_program_done_LOW;
|
||||
uint8_t total_shot_done_HIGH;
|
||||
uint8_t total_program_done_HIGH;
|
||||
uint8_t total_shot_done_LOW;
|
||||
uint8_t total_shot_done_HIGH;
|
||||
} StatusStruct;
|
||||
|
||||
StatusStruct res;
|
||||
uint8_t isRun = currentInfo.state == RUN;
|
||||
res.status = isRun;
|
||||
|
||||
res.status = currentInfo.state == RUN;
|
||||
res.shot_number = currentInfo.shot.index;
|
||||
res.program_number = currentInfo.program.index;
|
||||
res.macro_number = currentInfo.macro.index;
|
||||
res.shot_number = 0xFF;
|
||||
res.program_number = 0xFF;
|
||||
res.macro_number = 0xFF;
|
||||
|
||||
res.total_shot_done_HIGH = HIGHBIT(infoBlock.statInfo.totalShots);
|
||||
res.total_shot_done_LOW = LOWBIT(infoBlock.statInfo.totalShots);
|
||||
switch (currentInfo.mode) {
|
||||
case ShotMode:
|
||||
res.shot_number = isRun ? currentInfo.shot.index : 0xFF;
|
||||
break;
|
||||
case ProgramMode:
|
||||
res.program_number = isRun ? currentInfo.program.index : 0xFF;
|
||||
break;
|
||||
case MacroMode:
|
||||
res.macro_number = isRun ? currentInfo.macro.index : 0xFF;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
res.total_program_done_HIGH = HIGHBIT(infoBlock.statInfo.totalPrograms);
|
||||
res.total_program_done_LOW = LOWBIT(infoBlock.statInfo.totalPrograms);
|
||||
res.total_shot_done_HIGH = HIGHBIT(infoBlock.statInfo.shotsInShot);
|
||||
res.total_shot_done_LOW = LOWBIT(infoBlock.statInfo.shotsInShot);
|
||||
|
||||
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);
|
||||
|
Reference in New Issue
Block a user