fix rc debug and ir logic

This commit is contained in:
2024-10-01 22:34:01 +03:00
parent 6c3af6fbb5
commit 839da85dfe
11 changed files with 154 additions and 91 deletions

View File

@ -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 */