indicator

This commit is contained in:
2024-09-27 17:28:15 +03:00
parent d088948a1d
commit e4cc2cecf5
6 changed files with 265 additions and 74 deletions

View File

@ -9,9 +9,9 @@
#include "pca9685.h"
#include "UART3_Handler.h"
#include "EEPROM.h"
#include "ShiftReg.h"
#include "Print.h"
#include "SimpleTimer.h"
#include "Indicator.h"
#define ballReact_value 10 // время реакции на вылет мяча
@ -80,65 +80,20 @@ void Robot_INIT() {
initPCA9685();
EEPROM_INIT();
UART3_START();
led_init();
setPosDefault();
Shiftreg[0] = 0x00;
Shiftreg[1] = 0x44;
Shiftreg[2] = 0x00;
SetShiftReg(Shiftreg);
HAL_Delay(10);
Shiftreg[0] = 0x00;
Shiftreg[1] = 0x66;
Shiftreg[2] = 0x00;
SetShiftReg(Shiftreg);
HAL_Delay(10);
Shiftreg[0] = 0x00;
Shiftreg[1] = 0x77;
Shiftreg[2] = 0x00;
SetShiftReg(Shiftreg);
HAL_Delay(10);
Shiftreg[0] = 0x01;
Shiftreg[1] = 0x77;
Shiftreg[2] = 0x01;
SetShiftReg(Shiftreg);
HAL_Delay(10);
Shiftreg[0] = 0x03;
Shiftreg[1] = 0x77;
Shiftreg[2] = 0x03;
SetShiftReg(Shiftreg);
HAL_Delay(10);
Shiftreg[0] = 0x07;
Shiftreg[1] = 0x77;
Shiftreg[2] = 0x07;
SetShiftReg(Shiftreg);
HAL_Delay(10);
Shiftreg[0] = 0x0F;
Shiftreg[1] = 0x77;
Shiftreg[2] = 0x0F;
SetShiftReg(Shiftreg);
HAL_Delay(10);
Shiftreg[0] = 0x1F;
Shiftreg[1] = 0x77;
Shiftreg[2] = 0x1F;
SetShiftReg(Shiftreg);
HAL_Delay(10);
Shiftreg[0] = 0x3F;
Shiftreg[1] = 0x77;
Shiftreg[2] = 0x3F;
SetShiftReg(Shiftreg);
HAL_Delay(10);
Shiftreg[0] = 0x7F;
Shiftreg[1] = 0x77;
Shiftreg[2] = 0x7F;
SetShiftReg(Shiftreg);
HAL_Delay(10);
Shiftreg[0] = 0x00;
Shiftreg[1] = 0x00;
Shiftreg[2] = 0x00;
SetShiftReg(Shiftreg);
HAL_Delay(10);
for (int i = 0; i < 10; ++i) {
// if ((i&1U)!=1 || i > 4) for test
{
led_writeMirror(i, 1);
HAL_Delay(10);
}
}
led_clear();
//testing
for (int i = 7; i < 13; ++i) {
led_blink_num(i, 100, 15);
}
}
@ -149,6 +104,7 @@ void BallEXT() {
void RobotTick() {
BallEXT_Handler();
led_tick();
// No Ball Handler
if (currentInfo.state == RUN && millis() - noBallTimer > noBallTimeout) {