mirror of
https://github.com/DashyFox/StackSport.git
synced 2025-05-03 14:50:21 +00:00
fix rc debug and ir logic
This commit is contained in:
parent
6c3af6fbb5
commit
839da85dfe
@ -14,7 +14,7 @@
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactExtension="elf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.952459078" name="Debug" parent="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug" postbuildStep="STM32_Programmer_CLI -c port=SWD -w "${ProjName}.hex" -v -rst">
|
||||
<configuration artifactExtension="elf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GCCErrorParser" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.952459078" name="Debug" parent="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug" postbuildStep="STM32_Programmer_CLI -c port=SWD -w "${ProjName}.hex" -v -rst">
|
||||
<folderInfo id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.952459078." name="/" resourcePath="">
|
||||
<toolChain id="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.debug.1721750213" name="MCU ARM GCC" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.debug">
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu.1582155796" name="MCU" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu" useByScannerDiscovery="true" value="STM32F103C8Tx" valueType="string"/>
|
||||
@ -36,7 +36,7 @@
|
||||
</tool>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.400718382" name="MCU/MPU GCC Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler">
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.1282773953" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.value.g3" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.394842051" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.value.os" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.394842051" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.value.o3" valueType="enumerated"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols.1350178782" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="DEBUG"/>
|
||||
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
|
||||
|
@ -45,4 +45,6 @@ enum IR_CMD_LIST {
|
||||
IR_ENGINE_DOWM_DEC = 17
|
||||
};
|
||||
|
||||
void IR_CMD_Clear();
|
||||
|
||||
#endif /* INC_IR_CMD_HANDLER_H_ */
|
||||
|
@ -24,6 +24,7 @@ typedef enum ServoMap{
|
||||
|
||||
typedef enum Mode {
|
||||
NoneMode, ShotMode, ProgramMode, MacroMode,
|
||||
DebugShot,
|
||||
} Mode;
|
||||
|
||||
typedef enum State{
|
||||
@ -85,6 +86,7 @@ uint8_t prepareMacro(uint8_t number);
|
||||
|
||||
void startShooting(uint32_t delayTime);
|
||||
void stopShooting();
|
||||
void pauseShooting();
|
||||
|
||||
long map(long x, long in_min, long in_max, long out_min, long out_max);
|
||||
|
||||
|
@ -135,6 +135,7 @@ MemoryStatus saveInfoBlock() {
|
||||
}
|
||||
|
||||
MemoryStatus getInfoBlock() {
|
||||
memset(&infoBlock, 0x00, sizeof(InfoBlock));
|
||||
MemoryStatus status = FLASH_ReadBlock(START_ADR_STAT, 0,
|
||||
(uint8_t*) &infoBlock, sizeof(InfoBlock));
|
||||
|
||||
@ -155,6 +156,7 @@ MemoryStatus saveShot(unsigned char number, Shot *shot) {
|
||||
|
||||
MemoryStatus getShot(unsigned char number, Shot *shot) {
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
memset(shot, 0x00, sizeof(Shot));
|
||||
if (FLASH_ReadBlock(START_ADR_SHOT, number, (uint8_t*) shot, SHOT_BLOCKSIZE)
|
||||
!= EEPROM_OK) {
|
||||
return EEPROM_FAIL;
|
||||
@ -198,6 +200,7 @@ MemoryStatus saveProg(unsigned char number, Program *prog) {
|
||||
}
|
||||
|
||||
MemoryStatus getProg(unsigned char number, Program *prog) {
|
||||
memset(prog, 0x00, sizeof(Program));
|
||||
if (FLASH_ReadBlock(START_ADR_PROGRAM, number, (uint8_t*) prog,
|
||||
PROGRAM_BLOCKSIZE) != EEPROM_OK) {
|
||||
return EEPROM_FAIL;
|
||||
@ -245,6 +248,7 @@ MemoryStatus saveMacro(unsigned char number, Macro *macro) {
|
||||
}
|
||||
|
||||
MemoryStatus getMacro(unsigned char number, Macro *macro) {
|
||||
memset(macro, 0x00, sizeof(Macro));
|
||||
if (FLASH_ReadBlock(START_ADR_MACRO, number, (uint8_t*) macro,
|
||||
MACRO_BLOCKSIZE) != EEPROM_OK) {
|
||||
return EEPROM_FAIL;
|
||||
@ -364,7 +368,7 @@ MemoryStatus FLASH_ReadBlock(uint16_t startAddr, uint8_t number,
|
||||
return EEPROM_OUT_OF_RANGE;
|
||||
}
|
||||
|
||||
memset(readData, 0x00, dataSize);
|
||||
// memset(readData, 0x00, !!!!dataSize!!!!);
|
||||
|
||||
uint16_t blockAddr16 = (uint16_t) (startAddr
|
||||
+ (uint16_t) (number * dataSize));
|
||||
|
@ -74,6 +74,8 @@ uint8_t speedDown = 100;
|
||||
|
||||
void IR_Home_Process() {
|
||||
InputHandler = IR_Home_Process;
|
||||
uint8_t isshotRcOverride = currentInfo.mode == ShotMode
|
||||
&& currentInfo.state == RUN;
|
||||
switch (data.command) {
|
||||
case IR_SHOT:
|
||||
paramEnter(onSelectShot);
|
||||
@ -96,106 +98,104 @@ void IR_Home_Process() {
|
||||
|
||||
case IR_PAUSE:
|
||||
if (currentInfo.state == RUN) {
|
||||
currentInfo.state = PAUSE;
|
||||
pauseShooting();
|
||||
}
|
||||
break;
|
||||
|
||||
case IR_START:
|
||||
if (currentInfo.state == PAUSE) {
|
||||
currentInfo.state = RUN;
|
||||
switch (currentInfo.mode) {
|
||||
case DebugShot:
|
||||
case ShotMode:
|
||||
shotApply(¤tInfo.shot);
|
||||
break;
|
||||
case ProgramMode:
|
||||
shotApply(¤tInfo.program.currentShot);
|
||||
break;
|
||||
case MacroMode:
|
||||
shotApply(¤tInfo.macro.currentProgram.currentShot);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IR_ESC: {
|
||||
// if (EEPROM_EARSE() != EEPROM_OK) {
|
||||
// char errorMsg[] = "Error EEPROM_EARSE\n\n";
|
||||
// CDC_Transmit_FS((uint8_t*) errorMsg, strlen(errorMsg));
|
||||
// } else {
|
||||
// char doneMsg[] = "EEPROM_EARSE Done\n\n";
|
||||
// CDC_Transmit_FS((uint8_t*) doneMsg, strlen(doneMsg));
|
||||
// }
|
||||
IR_CMD_Clear();
|
||||
break;
|
||||
}
|
||||
|
||||
case IR_DEBUG: {
|
||||
if (!(currentInfo.state == STOP || currentInfo.state == PAUSE))
|
||||
break;
|
||||
|
||||
switch (currentInfo.mode) {
|
||||
case ShotMode:
|
||||
currentInfo.mode = DebugShot;
|
||||
currentInfo.state = RUN;
|
||||
shotApply(¤tInfo.shot);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case IR_NUM_1:
|
||||
|
||||
break;
|
||||
case IR_NUM_2:
|
||||
break;
|
||||
case IR_NUM_3:
|
||||
|
||||
break;
|
||||
|
||||
case IR_NUM_7:
|
||||
break;
|
||||
case IR_NUM_8:
|
||||
break;
|
||||
case IR_NUM_9:
|
||||
break;
|
||||
|
||||
case IR_NUM_5:
|
||||
break;
|
||||
|
||||
case IR_STOP: {
|
||||
speedUP = 100;
|
||||
speedDown = 100;
|
||||
screwSpeed = 0;
|
||||
print("***********************");
|
||||
stopShooting();
|
||||
break;
|
||||
}
|
||||
|
||||
case IR_TEMPO_INC:
|
||||
if (currentInfo.shot.shot.speedScrew < 100) {
|
||||
if (isshotRcOverride && currentInfo.shot.shot.speedScrew < 100) {
|
||||
currentInfo.shot.shot.speedScrew++;
|
||||
shotApply(¤tInfo.shot);
|
||||
// led_progressbar(10, 19, currentInfo.shot.shot.speedScrew); //todo: led_progressbarTMP
|
||||
onHoldRepeat = IR_Home_Process;
|
||||
}
|
||||
onHoldRepeat = IR_Home_Process;
|
||||
break;
|
||||
|
||||
case IR_TEMPO_DEC:
|
||||
if (currentInfo.shot.shot.speedScrew > 0) {
|
||||
if (isshotRcOverride && currentInfo.shot.shot.speedScrew > 0) {
|
||||
currentInfo.shot.shot.speedScrew--;
|
||||
shotApply(¤tInfo.shot);
|
||||
onHoldRepeat = IR_Home_Process;
|
||||
}
|
||||
onHoldRepeat = IR_Home_Process;
|
||||
break;
|
||||
|
||||
case IR_ENGINE_UP_INC:
|
||||
if (currentInfo.shot.shot.speedRollerTop < 200) {
|
||||
if (isshotRcOverride && currentInfo.shot.shot.speedRollerTop < 200) {
|
||||
currentInfo.shot.shot.speedRollerTop++;
|
||||
shotApply(¤tInfo.shot);
|
||||
onHoldRepeat = IR_Home_Process;
|
||||
}
|
||||
onHoldRepeat = IR_Home_Process;
|
||||
break;
|
||||
|
||||
case IR_ENGINE_UP_DEC:
|
||||
if (currentInfo.shot.shot.speedRollerTop > 0) {
|
||||
if (isshotRcOverride && currentInfo.shot.shot.speedRollerTop > 0) {
|
||||
currentInfo.shot.shot.speedRollerTop--;
|
||||
shotApply(¤tInfo.shot);
|
||||
onHoldRepeat = IR_Home_Process;
|
||||
}
|
||||
onHoldRepeat = IR_Home_Process;
|
||||
break;
|
||||
|
||||
case IR_ENGINE_DOWM_INC:
|
||||
if (currentInfo.shot.shot.speedRollerBottom < 200) {
|
||||
if (isshotRcOverride && currentInfo.shot.shot.speedRollerBottom < 200) {
|
||||
currentInfo.shot.shot.speedRollerBottom++;
|
||||
shotApply(¤tInfo.shot);
|
||||
onHoldRepeat = IR_Home_Process;
|
||||
}
|
||||
onHoldRepeat = IR_Home_Process;
|
||||
break;
|
||||
|
||||
case IR_ENGINE_DOWM_DEC:
|
||||
if (currentInfo.shot.shot.speedRollerBottom > 0) {
|
||||
if (isshotRcOverride && currentInfo.shot.shot.speedRollerBottom > 0) {
|
||||
currentInfo.shot.shot.speedRollerBottom--;
|
||||
shotApply(¤tInfo.shot);
|
||||
onHoldRepeat = IR_Home_Process;
|
||||
}
|
||||
onHoldRepeat = IR_Home_Process;
|
||||
break;
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
@ -293,13 +293,19 @@ void IR_Home_Process() {
|
||||
|
||||
void IR_ShootingStart() {
|
||||
InputHandler = IR_ShootingStart;
|
||||
|
||||
switch (data.command) {
|
||||
case IR_START:
|
||||
startShooting(infoBlock.hwInfo.timings.preRun);
|
||||
break;
|
||||
default:
|
||||
InputHandler();
|
||||
break;
|
||||
case IR_START: {
|
||||
InputHandler = IR_Home_Process;
|
||||
startShooting(infoBlock.hwInfo.timings.preRun);
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
InputHandler = IR_Home_Process;
|
||||
IR_Home_Process();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,8 @@ void IR_CMD_Handler() {
|
||||
lastRepeatTime = millis(); // Обновляем время последнего вызова
|
||||
// uint8_t blinkPeriod = 10;
|
||||
led_writeMirror(9, 1);
|
||||
|
||||
HAL_Delay(1);
|
||||
led_writeMirror(9,0);
|
||||
|
||||
onHoldRepeat(); // Вызываем функцию при удержании
|
||||
|
||||
@ -129,16 +130,13 @@ void IR_CMD_Clear() {
|
||||
inputInProgerss = 0;
|
||||
digitInputInProgerss = 0;
|
||||
inputParam = NULL_NumberParam;
|
||||
// SetShiftReg_inline(0, 0xff, 0);
|
||||
}
|
||||
|
||||
void IR_ParamEnter() {
|
||||
// SetShiftReg_inline(0x03, 0, 0);
|
||||
if (0 <= data.command && data.command <= 9) {
|
||||
if (digitInputInProgerss) {
|
||||
inputParam = inputParam * 10; // dec shift << 1
|
||||
inputParam += (data.command + 1) % 10;
|
||||
// SetShiftReg_inline(0xF0, 0, 0);
|
||||
} else {
|
||||
inputParam = (data.command + 1) % 10;
|
||||
}
|
||||
@ -151,13 +149,16 @@ void IR_ParamEnter() {
|
||||
if(inputParam != NULL_NumberParam){
|
||||
print("Enter: ");
|
||||
printNumber(inputParam);
|
||||
// SetShiftReg_inline(0, 0, inputParam);
|
||||
onParamEnter();
|
||||
}
|
||||
inputParam = NULL_NumberParam;
|
||||
digitInputInProgerss = 0;
|
||||
break;
|
||||
|
||||
case IR_START:
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
IR_Home_Process();
|
||||
break;
|
||||
|
@ -228,12 +228,10 @@ void led_progressbar_(uint8_t fromLed, uint8_t toLed, uint8_t progress, void (*l
|
||||
ledBlinkInfo[ledIndex].count = 0;
|
||||
|
||||
if (i < ledsToLight) {
|
||||
// Включаем светодиод, если он не включен
|
||||
if (!led_getState(ledMap.ALL[ledIndex])) {
|
||||
led_writeFunc(ledIndex, 1); // Используем переданную функцию для включения
|
||||
}
|
||||
} else {
|
||||
// Выключаем светодиод, если он включен
|
||||
if (led_getState(ledMap.ALL[ledIndex])) {
|
||||
led_writeFunc(ledIndex, 0); // Используем переданную функцию для выключения
|
||||
}
|
||||
@ -270,6 +268,7 @@ void led_PingPong_start(uint8_t fromLed, uint8_t toLed) {
|
||||
ledPingPongInfo.writeCallback = led_write;
|
||||
led_PingPong_start_(fromLed, toLed);
|
||||
}
|
||||
|
||||
void led_PingPong_start_(uint8_t fromLed, uint8_t toLed){
|
||||
if (fromLed < toLed) {
|
||||
ledPingPongInfo.start = fromLed;
|
||||
|
@ -23,7 +23,6 @@ unsigned char Shiftreg[3];
|
||||
extern InfoBlock infoBlock;
|
||||
uint8_t ballDetected = 0;
|
||||
uint32_t ballReact_timer = 0;
|
||||
uint8_t isDelayTimerRun = 0;
|
||||
uint32_t startDelay_timer;
|
||||
CurrentShot *postDelayShot = NULL;
|
||||
uint32_t lastIndicationTime = 0;
|
||||
@ -32,7 +31,7 @@ uint32_t noBallTimeout = 0xFFFFFFFF;
|
||||
|
||||
void BallEXT_Handler();
|
||||
void robotStateStart(uint32_t delayTime);
|
||||
void robotStatePause();
|
||||
void pauseShooting();
|
||||
void robotStateStop();
|
||||
float calculatePeriod(int pwm_value);
|
||||
uint8_t nextBallInShot(CurrentShot *shot);
|
||||
@ -47,10 +46,13 @@ void robotStateStart(uint32_t delayTime) {
|
||||
currentInfo.state = PRERUN_WAIT;
|
||||
currentInfo.startDelay = delayTime;
|
||||
startDelay_timer = millis();
|
||||
isDelayTimerRun = 1;
|
||||
}
|
||||
void robotStatePause() {
|
||||
void pauseShooting() {
|
||||
currentInfo.state = PAUSE;
|
||||
led_clear();
|
||||
setScrewkSpeed(0);
|
||||
setRollersSpeed(100, 100);
|
||||
|
||||
}
|
||||
|
||||
void robotStateStop() {
|
||||
@ -116,12 +118,14 @@ void RobotTick() {
|
||||
|
||||
// No Ball Handler
|
||||
if (currentInfo.state == RUN && millis() - noBallTimer > noBallTimeout) {
|
||||
if(currentInfo.mode == DebugShot){
|
||||
currentInfo.mode = ShotMode;
|
||||
}
|
||||
robotStateStop();
|
||||
led_clear();
|
||||
for (int i = 7; i <= 12; ++i) {
|
||||
led_blink_num(i, 250, 0xFFFF-1);
|
||||
led_blink_num(i, 250, 0xFFFF - 1);
|
||||
}
|
||||
isDelayTimerRun = 0;
|
||||
setScrewkSpeed(0);
|
||||
setRollersSpeed(100, 100);
|
||||
setPos(infoBlock.hwInfo.servos[SERVO_AXIAL].def,
|
||||
@ -131,20 +135,19 @@ void RobotTick() {
|
||||
}
|
||||
|
||||
// PreRun delay
|
||||
if (isDelayTimerRun) {
|
||||
if (currentInfo.state == PRERUN_WAIT) {
|
||||
uint32_t elapsedTime = millis() - startDelay_timer;
|
||||
|
||||
if (elapsedTime > currentInfo.startDelay) {
|
||||
isDelayTimerRun = 0;
|
||||
if (currentInfo.state == PRERUN_WAIT) {
|
||||
currentInfo.state = RUN;
|
||||
shotApply(postDelayShot);
|
||||
}
|
||||
|
||||
} else {
|
||||
uint32_t intervalStep = currentInfo.startDelay / NUMLEDS;
|
||||
if (elapsedTime - lastIndicationTime >= intervalStep) {
|
||||
lastIndicationTime = elapsedTime;
|
||||
uint8_t progress = 100 - (elapsedTime * 100) / currentInfo.startDelay;
|
||||
uint8_t progress = 100
|
||||
- (elapsedTime * 100) / currentInfo.startDelay;
|
||||
|
||||
uint8_t ledProgress = map(progress, 0, 70, 0, 100);
|
||||
if (ledProgress > 30) {
|
||||
@ -258,6 +261,14 @@ void BallEXT_Handler() {
|
||||
infoBlock.statInfo.shotInMacro++;
|
||||
saveInfoBlock();
|
||||
break;
|
||||
case DebugShot:
|
||||
currentInfo.mode = ShotMode;
|
||||
led_clear();
|
||||
robotStateStop();
|
||||
setScrewkSpeed(0);
|
||||
setRollersSpeed(100, 100);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -502,10 +513,13 @@ void startShooting(uint32_t delayTime) {
|
||||
}
|
||||
|
||||
void stopShooting() {
|
||||
if(currentInfo.mode == DebugShot){
|
||||
currentInfo.mode = ShotMode;
|
||||
}
|
||||
robotStateStop();
|
||||
|
||||
led_clear();
|
||||
|
||||
isDelayTimerRun = 0;
|
||||
robotStateStop();
|
||||
setScrewkSpeed(0);
|
||||
setRollersSpeed(100, 100);
|
||||
setPosDefault();
|
||||
|
@ -517,7 +517,7 @@ void UART3_ReadStatistics(uint8_t *dataPtr, uint8_t len) {
|
||||
} StatusStruct;
|
||||
|
||||
StatusStruct res;
|
||||
uint8_t isRun = currentInfo.state == RUN;
|
||||
uint8_t isRun = currentInfo.state == RUN || currentInfo.state == PRERUN_WAIT;
|
||||
res.status = isRun;
|
||||
|
||||
res.shot_number = 0xFF;
|
||||
|
@ -174,7 +174,36 @@ int main(void)
|
||||
|
||||
/* Infinite loop */
|
||||
/* USER CODE BEGIN WHILE */
|
||||
|
||||
const char* getStateString(State state) {
|
||||
switch (state) {
|
||||
case STOP:
|
||||
return "STOP";
|
||||
case RUN:
|
||||
return "RUN";
|
||||
case PAUSE:
|
||||
return "PAUSE";
|
||||
case PRERUN_WAIT:
|
||||
return "PRERUN_WAIT";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
const char* getModeString(Mode mode) {
|
||||
switch (mode) {
|
||||
case NoneMode:
|
||||
return "NoneMode";
|
||||
case ShotMode:
|
||||
return "ShotMode";
|
||||
case ProgramMode:
|
||||
return "ProgramMode";
|
||||
case MacroMode:
|
||||
return "MacroMode";
|
||||
case DebugShot:
|
||||
return "DebugShot";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
while (1) {
|
||||
|
||||
IR_CMD_Handler();
|
||||
@ -194,13 +223,18 @@ int main(void)
|
||||
// extern uint32_t vsk2;
|
||||
// extern uint16_t timing1;
|
||||
// extern uint16_t timing2;
|
||||
// // Форматируем строку для вывода timing1, timing2, vsk1, vsk2
|
||||
// sprintf(buffer,
|
||||
// "timing1: %u ms, timing2: %u ms, vsk1: %u RPM, vsk2: %u RPM\n",
|
||||
// timing1, timing2, vsk1, vsk2);
|
||||
//
|
||||
// // Отправляем строку через CDC (USB)
|
||||
// CDC_Transmit_FS((uint8_t*) buffer, strlen(buffer));
|
||||
|
||||
char buffer[64];
|
||||
sprintf(buffer, "Current mode: %s, Current state: %s\n",
|
||||
getModeString(currentInfo.mode),
|
||||
getStateString(currentInfo.state));
|
||||
CDC_Transmit_FS((uint8_t*)buffer, strlen(buffer));
|
||||
|
||||
}
|
||||
|
||||
/* USER CODE END WHILE */
|
||||
|
33
TODO.md
33
TODO.md
@ -1,10 +1,17 @@
|
||||
Баги:
|
||||
При сбоях UART вешает его и иногда не переинициализирует даже после рестарта контроллера
|
||||
|
||||
Логика:
|
||||
Ограничение скорости роликов!
|
||||
Ограничение углов сервы
|
||||
Уточнить, в ТЗ только обработка 201 команды и учитывается только макс угол
|
||||
Начальное смещение:
|
||||
Корректировать макс углы ?
|
||||
Не корректировать углы ?
|
||||
V Ограничение углов сервы
|
||||
V Начальное смещение
|
||||
|
||||
Исправлено:
|
||||
V+- В некоторый момент PID регулятор выдаёт 0 и двигатель не запускается не зависимо от входного значенияPWM
|
||||
V rc debug button
|
||||
Оранж:
|
||||
V Программы:
|
||||
V Есл стоит "Настроить темп ударов", во все удары приходят нули.
|
||||
|
||||
Рефактор:
|
||||
Сделать static все локальные функции
|
||||
@ -36,10 +43,10 @@ IR:
|
||||
|
||||
Индикация:
|
||||
V Текущий буфер индикации
|
||||
Функция отображения скорости
|
||||
Обратный отсчёт
|
||||
Индикация ошибок
|
||||
Процесс удаления
|
||||
V Функция отображения скорости
|
||||
V Обратный отсчёт
|
||||
V Индикация ошибок
|
||||
V Процесс удаления
|
||||
|
||||
Звук:
|
||||
Звук приёма IR
|
||||
@ -47,12 +54,6 @@ IR:
|
||||
Звук включения
|
||||
|
||||
|
||||
|
||||
Ошибки:
|
||||
V+- В некоторый момент PID регулятор выдаёт 0 и двигатель не запускается не зависимо от входного значенияPWM
|
||||
Оранж:
|
||||
При сбоях UART вешает его и иногда не переинициализирует даже после рестарта контроллера
|
||||
Программы:
|
||||
Есл стоит "Настроить темп ударов", во все удары приходят нули.
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user