Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • avn/swd/skyward-boardcore
  • emilio.corigliano/skyward-boardcore
  • ettore.pane/skyward-boardcore
  • giulia.facchi/skyward-boardcore
  • valerio.flamminii/skyward-boardcore
  • nicolo.caruso/skyward-boardcore
6 results
Select Git revision
Show changes
Showing
with 415 additions and 431 deletions
......@@ -49,8 +49,7 @@ void program_startup()
// enabled
__disable_irq();
miosix::IRQconfigureCache((const unsigned int *)0xd0000000,
8 * 1024 * 1024);
miosix::IRQconfigureCache((const unsigned int*)0xd0000000, 8 * 1024 * 1024);
// These are defined in the linker script
extern unsigned char _etext asm("_etext");
......
......@@ -257,80 +257,80 @@ void IRQbspInit()
userLed4::mode(Mode::OUTPUT);
// RIG stuff
interfaces::spi1::sck::mode(Mode::ALTERNATE);
interfaces::spi1::sck::alternateFunction(5);
interfaces::spi1::miso::mode(Mode::ALTERNATE);
interfaces::spi1::sck::mode(Mode::ALTERNATE);
interfaces::spi1::miso::alternateFunction(5);
interfaces::spi1::mosi::mode(Mode::ALTERNATE);
interfaces::spi1::miso::mode(Mode::ALTERNATE);
interfaces::spi1::mosi::alternateFunction(5);
interfaces::spi1::mosi::mode(Mode::ALTERNATE);
interfaces::spi2::sck::mode(Mode::ALTERNATE);
interfaces::spi2::sck::alternateFunction(5);
interfaces::spi2::miso::mode(Mode::ALTERNATE);
interfaces::spi2::sck::mode(Mode::ALTERNATE);
interfaces::spi2::miso::alternateFunction(5);
interfaces::spi2::mosi::mode(Mode::ALTERNATE);
interfaces::spi2::miso::mode(Mode::ALTERNATE);
interfaces::spi2::mosi::alternateFunction(5);
interfaces::spi2::mosi::mode(Mode::ALTERNATE);
interfaces::spi3::sck::mode(Mode::ALTERNATE);
interfaces::spi3::sck::alternateFunction(6);
interfaces::spi3::miso::mode(Mode::ALTERNATE);
interfaces::spi3::sck::mode(Mode::ALTERNATE);
interfaces::spi3::miso::alternateFunction(6);
interfaces::spi3::mosi::mode(Mode::ALTERNATE);
interfaces::spi3::miso::mode(Mode::ALTERNATE);
interfaces::spi3::mosi::alternateFunction(5);
interfaces::spi3::mosi::mode(Mode::ALTERNATE);
/* Do not enable Flavio's bullshit
interfaces::spi4::sck::mode(Mode::ALTERNATE);
interfaces::spi4::sck::alternateFunction(5);
interfaces::spi4::miso::mode(Mode::ALTERNATE);
interfaces::spi4::sck::mode(Mode::ALTERNATE);
interfaces::spi4::miso::alternateFunction(5);
interfaces::spi4::mosi::mode(Mode::ALTERNATE);
interfaces::spi4::miso::mode(Mode::ALTERNATE);
interfaces::spi4::mosi::alternateFunction(5);
interfaces::spi4::mosi::mode(Mode::ALTERNATE);
*/
interfaces::spi6::sck::mode(Mode::ALTERNATE);
interfaces::spi6::sck::alternateFunction(5);
interfaces::spi6::miso::mode(Mode::ALTERNATE);
interfaces::spi6::sck::mode(Mode::ALTERNATE);
interfaces::spi6::miso::alternateFunction(5);
interfaces::spi6::mosi::mode(Mode::ALTERNATE);
interfaces::spi6::miso::mode(Mode::ALTERNATE);
interfaces::spi6::mosi::alternateFunction(5);
interfaces::spi6::mosi::mode(Mode::ALTERNATE);
// We do not need to setup the miosix usart
interfaces::uart4::tx::mode(Mode::ALTERNATE);
interfaces::uart4::tx::alternateFunction(8);
interfaces::uart4::rx::mode(Mode::ALTERNATE);
interfaces::uart4::tx::mode(Mode::ALTERNATE);
interfaces::uart4::rx::alternateFunction(8);
interfaces::uart4::rx::mode(Mode::ALTERNATE);
interfaces::can1::tx::mode(Mode::ALTERNATE);
interfaces::can1::tx::alternateFunction(9);
interfaces::can1::rx::mode(Mode::ALTERNATE);
interfaces::can1::tx::mode(Mode::ALTERNATE);
interfaces::can1::rx::alternateFunction(9);
interfaces::can1::rx::mode(Mode::ALTERNATE);
interfaces::can2::tx::mode(Mode::ALTERNATE);
interfaces::can2::tx::alternateFunction(9);
interfaces::can2::rx::mode(Mode::ALTERNATE);
interfaces::can2::tx::mode(Mode::ALTERNATE);
interfaces::can2::rx::alternateFunction(9);
interfaces::can2::rx::mode(Mode::ALTERNATE);
interfaces::timers::tim1ch1::mode(Mode::ALTERNATE);
interfaces::timers::tim1ch1::alternateFunction(1);
interfaces::timers::tim3ch3::mode(Mode::ALTERNATE);
interfaces::timers::tim1ch1::mode(Mode::ALTERNATE);
interfaces::timers::tim3ch3::alternateFunction(2);
interfaces::timers::tim4ch1::mode(Mode::ALTERNATE);
interfaces::timers::tim3ch3::mode(Mode::ALTERNATE);
interfaces::timers::tim4ch1::alternateFunction(2);
interfaces::timers::tim5ch3::mode(Mode::ALTERNATE);
interfaces::timers::tim4ch1::mode(Mode::ALTERNATE);
interfaces::timers::tim5ch3::alternateFunction(2);
interfaces::timers::tim8ch1::mode(Mode::ALTERNATE);
interfaces::timers::tim5ch3::mode(Mode::ALTERNATE);
interfaces::timers::tim8ch1::alternateFunction(3);
interfaces::timers::tim8ch2::mode(Mode::ALTERNATE);
interfaces::timers::tim8ch1::mode(Mode::ALTERNATE);
interfaces::timers::tim8ch2::alternateFunction(3);
interfaces::timers::tim9ch2::mode(Mode::ALTERNATE);
interfaces::timers::tim8ch2::mode(Mode::ALTERNATE);
interfaces::timers::tim9ch2::alternateFunction(3);
interfaces::timers::tim10ch1::mode(Mode::ALTERNATE);
interfaces::timers::tim9ch2::mode(Mode::ALTERNATE);
interfaces::timers::tim10ch1::alternateFunction(3);
interfaces::timers::tim11ch1::mode(Mode::ALTERNATE);
interfaces::timers::tim10ch1::mode(Mode::ALTERNATE);
interfaces::timers::tim11ch1::alternateFunction(3);
interfaces::timers::tim12ch2::mode(Mode::ALTERNATE);
interfaces::timers::tim11ch1::mode(Mode::ALTERNATE);
interfaces::timers::tim12ch2::alternateFunction(9);
interfaces::timers::tim12ch2::mode(Mode::ALTERNATE);
interfaces::adcs::adc12in9::mode(Mode::INPUT_ANALOG);
interfaces::adcs::adc123in11::mode(Mode::INPUT_ANALOG);
......
......@@ -238,8 +238,8 @@ void calibrateAccelerometer()
{
bmx160->sample();
uint8_t fifoSize = bmx160->getLastFifoSize();
auto& fifo = bmx160->getLastFifo();
uint16_t fifoSize;
const auto fifo = bmx160->getLastFifo(fifoSize);
for (uint8_t ii = 0; ii < fifoSize; ii++)
{
......@@ -333,9 +333,8 @@ void calibrateMagnetometer()
[&]()
{
bmx160->sample();
uint8_t fifoSize = bmx160->getLastFifoSize();
auto& fifo = bmx160->getLastFifo();
uint16_t fifoSize;
const auto fifo = bmx160->getLastFifo(fifoSize);
for (uint8_t i = 0; i < fifoSize; i++)
{
......@@ -409,8 +408,8 @@ void calibrateGyroscope()
{
bmx160->sample();
uint8_t fifoSize = bmx160->getLastFifoSize();
auto& fifo = bmx160->getLastFifo();
uint16_t fifoSize;
const auto fifo = bmx160->getLastFifo(fifoSize);
for (uint8_t i = 0; i < fifoSize; i++)
{
......
......@@ -299,9 +299,7 @@ void sd_test()
}
if (f != NULL)
{
fclose(f);
}
if (ok)
{
......@@ -344,19 +342,13 @@ void sd_test()
}
if (f != NULL)
{
fclose(f);
}
if (ok)
{
puts("*** SD test succesfull!");
}
else
{
puts("*** SD test failed!");
}
}
void xram_test()
{
......@@ -365,9 +357,7 @@ void xram_test()
// First clear the whole RAM
for (volatile uint16_t* iter = START; iter != END; iter++)
{
*iter = 0;
}
__DMB(); // Flush cache
......@@ -392,13 +382,9 @@ void xram_test()
}
if (ok)
{
puts("*** XRAM basic test succesfull!");
}
else
{
puts("*** XRAM basic test failed!");
}
puts("*** Starting XRAM mirroring test...");
ok = true;
......@@ -417,9 +403,7 @@ void xram_test()
{
// Skip the written address
if (iter == other)
{
continue;
}
// Check for mirroring
if (*iter == 0xdead)
......@@ -435,21 +419,15 @@ void xram_test()
}
if (ok)
{
puts("*** XRAM mirror test succesfull!");
}
else
{
puts("*** XRAM mirror test failed!");
}
}
void pin_continuity_test()
{
for (auto& a : PIN_DEFS)
{
a.pin.mode(Mode::INPUT_PULL_DOWN);
}
puts("*** Starting pin continuity test...");
bool ok = true;
......@@ -479,14 +457,10 @@ void pin_continuity_test()
}
if (ok)
{
puts("*** Pin continuity test succesfull!");
}
else
{
puts("*** Pin continuity test failed!");
}
}
void pin_semi_test()
{
......
......@@ -85,13 +85,9 @@ int main()
bool configStatus = gamma.configure(newConf);
if (configStatus == true)
{
printf("New configuration set!\n");
}
else
{
printf("Failed to set new configuration!\n");
}
Thread::sleep(500);
}
......@@ -104,8 +100,6 @@ int main()
void waitForButton()
{
while (1)
{
if (button::value() == 1)
break; // Wait for button
}
}
......@@ -390,11 +390,9 @@ void process_test_file_concurrency()
remove("/file1.bin");
remove("/file2.bin");
ElfProgram prog1(
reinterpret_cast<const unsigned int *>(testsuite_file1_elf),
ElfProgram prog1(reinterpret_cast<const unsigned int*>(testsuite_file1_elf),
testsuite_file1_elf_len);
ElfProgram prog2(
reinterpret_cast<const unsigned int *>(testsuite_file2_elf),
ElfProgram prog2(reinterpret_cast<const unsigned int*>(testsuite_file2_elf),
testsuite_file2_elf_len);
pid_t p1 = Process::create(prog1);
......@@ -438,8 +436,7 @@ void process_test_file_concurrency()
void process_test_process_ret()
{
test_name("Process return value");
ElfProgram prog(
reinterpret_cast<const unsigned int *>(testsuite_simple_elf),
ElfProgram prog(reinterpret_cast<const unsigned int*>(testsuite_simple_elf),
testsuite_simple_elf_len);
int ret = 0;
pid_t p = Process::create(prog);
......@@ -516,12 +513,13 @@ void syscall_test_system()
SystemMap::instance().getElfProgram("test");
if (sysret.first == 0 || sysret.second == 0)
{
fail(
"The system lookup table has returned an invalid process size or "
"an invalid elf pointer for the process");
}
ElfProgram prog(
reinterpret_cast<const unsigned int *>(testsuite_system_elf),
ElfProgram prog(reinterpret_cast<const unsigned int*>(testsuite_system_elf),
testsuite_system_elf_len);
int ret = 0;
......@@ -1110,7 +1108,9 @@ static void t5_p1(void *argv __attribute__((unused)))
break;
t5_v1 = true;
if (t5_v2)
{
Thread::wait();
}
else
{
disableInterrupts();
......@@ -1779,7 +1779,9 @@ static void test_7()
if (llabs(duration_cast<milliseconds>(steadyEnd - steadyStart).count() -
i) > 4)
{
fail_time("steady_clock not precise ", i);
}
auto sysStart = system_clock::now();
Thread::sleep(i);
......@@ -1787,8 +1789,10 @@ static void test_7()
if (llabs(duration_cast<milliseconds>(sysEnd - sysStart).count() - i) >
4)
{
fail_time("system_clock not precise ", i);
}
}
pass();
}
......@@ -2833,8 +2837,8 @@ void __attribute__((noinline)) check32(unsigned int a, unsigned int b)
fail("swapBytes32");
}
void __attribute__((noinline))
check64(unsigned long long a, unsigned long long b)
void __attribute__((noinline)) check64(unsigned long long a,
unsigned long long b)
{
if (swapBytes64(a) != b)
fail("swapBytes64");
......@@ -2847,10 +2851,14 @@ static void test_18()
fail("swapBytes16");
if (swapBytes32(0x12345678) != 0x78563412 ||
swapBytes32(0x55aa00ff) != 0xff00aa55)
{
fail("swapBytes32");
}
if (swapBytes64(0x0123456789abcdefull) != 0xefcdab8967452301ull ||
swapBytes64(0x55aa00ffcc33ab56ull) != 0x56ab33ccff00aa55ull)
{
fail("swapBytes64");
}
check16(0x1234, 0x3412);
check16(0x55aa, 0xaa55);
check32(0x12345678, 0x78563412);
......@@ -2869,40 +2877,56 @@ static void test_18()
if (toBigEndian16(0x0123) != 0x0123 ||
toBigEndian32(0x01234567) != 0x01234567 ||
toBigEndian64(0x0123456789abcdef) != 0x0123456789abcdef)
{
fail("toBigEndian");
}
if (fromBigEndian16(0x0123) != 0x0123 ||
fromBigEndian32(0x01234567) != 0x01234567 ||
fromBigEndian64(0x0123456789abcdef) != 0x0123456789abcdef)
{
fail("fromBigEndian");
}
if (toLittleEndian16(0x0123) != 0x2301 ||
toLittleEndian32(0x01234567) != 0x67452301 ||
toLittleEndian64(0x0123456789abcdef) != 0xefcdab8967452301)
{
fail("toLittleEndian");
}
if (fromLittleEndian16(0x0123) != 0x2301 ||
fromLittleEndian32(0x01234567) != 0x67452301 ||
fromLittleEndian64(0x0123456789abcdef) != 0xefcdab8967452301)
{
fail("fromLittleEndian");
}
}
else
{
// Runtime check says our CPU is little endian
if (toLittleEndian16(0x0123) != 0x0123 ||
toLittleEndian32(0x01234567) != 0x01234567 ||
toLittleEndian64(0x0123456789abcdef) != 0x0123456789abcdef)
{
fail("toLittleEndian");
}
if (fromLittleEndian16(0x0123) != 0x0123 ||
fromLittleEndian32(0x01234567) != 0x01234567 ||
fromLittleEndian64(0x0123456789abcdef) != 0x0123456789abcdef)
{
fail("fromLittleEndian");
}
if (toBigEndian16(0x0123) != 0x2301 ||
toBigEndian32(0x01234567) != 0x67452301 ||
toBigEndian64(0x0123456789abcdef) != 0xefcdab8967452301)
{
fail("toBigEndian");
}
if (fromBigEndian16(0x0123) != 0x2301 ||
fromBigEndian32(0x01234567) != 0x67452301 ||
fromBigEndian64(0x0123456789abcdef) != 0xefcdab8967452301)
{
fail("fromBigEndian");
}
}
pass();
}
......@@ -4107,7 +4131,9 @@ void dma2s0irq()
waiting->IRQwakeup();
if (waiting->IRQgetPriority() >
Thread::IRQgetCurrentThread()->IRQgetPriority())
{
Scheduler::IRQfindNextThread();
}
waiting = nullptr;
}
......@@ -4528,7 +4554,9 @@ static void fs_test_1()
fseek(f, 21 + 17, SEEK_SET); // Seek to 002\n
if ((fgetc(f) != '0') | (fgetc(f) != '0') | (fgetc(f) != '2') |
(fgetc(f) != '\n'))
{
fail("fgetc SEEK_SET");
}
if (ftell(f) != (21 * 2))
{
iprintf("ftell=%ld\n", ftell(f));
......@@ -4537,7 +4565,9 @@ static void fs_test_1()
fseek(f, 21 * 50 + 17, SEEK_CUR); // Seek to 053\n
if ((fgetc(f) != '0') | (fgetc(f) != '5') | (fgetc(f) != '3') |
(fgetc(f) != '\n'))
{
fail("fgetc SEEK_CUR");
}
if (ftell(f) != (21 * 53))
{
iprintf("ftell=%ld\n", ftell(f));
......@@ -4772,7 +4802,9 @@ unsigned int checkInodes(const char *dir, unsigned int curInode,
fail("parent dev");
}
else if (st.st_dev != curDev)
{
fail("cur dev");
}
if (mustBeDir)
{
......@@ -4781,9 +4813,7 @@ unsigned int checkInodes(const char *dir, unsigned int curInode,
if (!S_ISDIR(st.st_mode))
fail("st_mode");
}
else
{
if (!S_ISDIR(st.st_mode))
else if (!S_ISDIR(st.st_mode))
{
int fd = open(de->d_name, O_RDONLY);
if (fd < 0)
......@@ -4795,7 +4825,6 @@ unsigned int checkInodes(const char *dir, unsigned int curInode,
if (memcmp(&st, &st2, sizeof(struct stat)))
fail("stat/fstat mismatch");
}
}
if ((de->d_type == DT_DIR) ^ (S_ISDIR(st.st_mode)))
fail("dir mismatch");
......@@ -5131,12 +5160,14 @@ static void benchmark_3()
if (diff > max)
max = diff;
for (unsigned j = 0; j < BUFSIZE; j++)
{
if (buf[j] != '0')
{
iprintf("Read error 2\n");
goto quit;
}
}
}
quit:
endTotal = system_clock::now();
if (fclose(f) != 0)
......@@ -5267,10 +5298,8 @@ unsigned int *memAllocation(unsigned int size)
bool memCheck(unsigned int* base, unsigned int size)
{
for (unsigned int i = 0; i < size / 4; i++)
{
if (*(base + i) != WATERMARK_FILL)
return false;
}
return true;
}
......@@ -5305,9 +5334,7 @@ int runProgram(const unsigned char *filename, unsigned int file_length)
bool isSignaled(int exit_code)
{
if (WIFSIGNALED(exit_code) && WTERMSIG(exit_code) == SIGSEGV)
{
return true;
}
return false;
}
......@@ -5320,14 +5347,20 @@ void mpuTest1()
if (isSignaled(ec))
{
if (*addr == 0xbbbbbbbb)
{
iprintf(
"...not passed! The process has written a forbidden memory "
"location.\n\n");
}
else if (*addr == WATERMARK_FILL)
{
iprintf("...passed!\n\n");
}
else
{
iprintf("...not passed! Memory has been somehow corrupted.\n\n");
}
}
else
{
iprintf("...not passed! Process exited normally.\n\n");
......@@ -5341,17 +5374,13 @@ void mpuTest2()
iprintf("Executing MPU Test 2...\n");
ec = runProgram(test2_elf, test2_elf_len);
if (isSignaled(ec))
{
if (*addr == WATERMARK_FILL)
iprintf("...passed!\n\n");
else
iprintf("...not passed! Memory has been somehow corrupted.\n\n");
}
else
{
iprintf("...not passed! Process exited normally.\n\n");
}
}
void mpuTest3()
{
......@@ -5362,12 +5391,16 @@ void mpuTest3()
if (isSignaled(ec))
{
if (*addr == 0xbbbbbbbb)
{
iprintf(
"...not passed! The process has written a forbidden memory "
"location.\n\n");
}
else
{
iprintf("...passed!\n\n");
}
}
else
{
iprintf("...not passed! Process exited normally.\n\n");
......@@ -5380,14 +5413,10 @@ void mpuTest4()
iprintf("Executing MPU Test 4...\n");
ec = runProgram(test4_elf, test4_elf_len);
if (isSignaled(ec))
{
iprintf("...passed!.\n\n");
}
else
{
iprintf("...not passed! Process exited normally.\n\n");
}
}
void mpuTest5()
{
......@@ -5398,12 +5427,16 @@ void mpuTest5()
if (isSignaled(ec))
{
if (*addr == 0xbbbbbbbb)
{
iprintf(
"...not passed! The process has written a forbidden memory "
"location.\n\n");
}
else
{
iprintf("...passed!.\n\n");
}
}
else
{
iprintf("...not passed! Process exited normally.\n\n");
......@@ -5419,12 +5452,16 @@ void mpuTest6()
if (isSignaled(ec))
{
if (*addr == 0xbbbbbbbb)
{
iprintf(
"...not passed! The process has written a forbidden memory "
"location.\n\n");
}
else
{
iprintf("...passed!.\n\n");
}
}
else
{
iprintf("...not passed! Process exited normally.\n\n");
......@@ -5478,12 +5515,16 @@ void mpuTest8()
if (WIFSIGNALED(ec2) && (WTERMSIG(ec2) == SIGSEGV) && WIFEXITED(ec1))
{
if (*addr == 0xbbbbbbbb)
{
iprintf(
"...not passed! The process has written a forbidden memory "
"location.\n\n");
}
else
{
iprintf("...passed!.\n\n");
}
}
else
{
iprintf("...not passed!\n\n");
......@@ -5540,12 +5581,8 @@ void mpuTest10()
Process::waitpid(child2, &ec2, 0);
if (!isSignaled(ec1) && isSignaled(ec2))
{
iprintf("...passed!.\n\n");
}
else
{
iprintf("...not passed!\n\n");
}
}
#endif // WITH_PROCESSES
......@@ -47,19 +47,17 @@ int main()
GpioPin tx(GPIOB_BASE, 6);
GpioPin rx(GPIOB_BASE, 7);
tx.mode(Mode::ALTERNATE);
rx.mode(Mode::ALTERNATE);
tx.alternateFunction(7);
rx.alternateFunction(7);
tx.mode(Mode::ALTERNATE);
rx.mode(Mode::ALTERNATE);
USART usart1(USART1, 115200);
Runcam test(usart1);
if (!test.init())
{
return -1;
}
char c;
while (true)
......@@ -72,18 +70,12 @@ int main()
test.selectSetting();
test.openMenu();
if (c == 'd')
{
test.moveDown();
}
else if (c == 'c')
{
test.selectSetting();
}
else if (c == 'o')
{
test.openMenu();
}
}
test.close();
......
......@@ -76,11 +76,15 @@ int main()
for (size_t bufferSize : BUFFER_SIZES)
{
if (benchmark(bufferSize, data))
{
printResults(bufferSize, data);
}
else
{
printf("Error while performing the benchmark (buffer size: %lu)\n",
(unsigned long)bufferSize);
}
}
printf("Test completed\n");
......
......@@ -220,11 +220,9 @@ void sendLoop()
auto serial = miosix::DefaultConsole::instance().get();
int len = serial->readBlock(msg, sizeof(msg), 0);
if (len > 0)
{
sx1278->send(msg, len);
}
}
}
Boardcore::SPIBus sx1278_bus(SX1278_SPI);
......
......@@ -37,7 +37,6 @@ namespace Boardcore
*/
class ActiveObject
{
public:
/**
* Constructor. This will create the AO, but will NOT start the thread
......@@ -125,9 +124,7 @@ inline bool ActiveObject::start()
miosix::Thread::JOINABLE);
if (thread == nullptr)
{
running = false;
}
return running;
}
......
......@@ -45,26 +45,18 @@ Stepper::Stepper(miosix::GpioPin stepPin, miosix::GpioPin directionPin,
void Stepper::enable()
{
if (pinConfig == PinConfiguration::COMMON_CATHODE)
{
enablePin.low();
}
else
{
enablePin.high();
}
enabled = true;
}
void Stepper::disable()
{
if (pinConfig == PinConfiguration::COMMON_CATHODE)
{
enablePin.high();
}
else
{
enablePin.low();
}
enabled = false;
}
......@@ -138,24 +130,16 @@ void Stepper::move(int16_t steps)
for (int i = 0; i < stepsAbs; i++)
{
if (pinConfig == PinConfiguration::COMMON_CATHODE)
{
stepPin.high();
}
else
{
stepPin.low();
}
miosix::delayUs(halfStepDelay);
if (pinConfig == PinConfiguration::COMMON_CATHODE)
{
stepPin.low();
}
else
{
stepPin.high();
}
miosix::delayUs(halfStepDelay);
}
......
......@@ -149,12 +149,18 @@ float AirBrakesInterp::controlInterp(TrajectoryPoint currentPosition)
// trjPointOpen.vz);
if (currentPosition.vz <= trjPointClosed.vz)
{
return 0;
}
else if (currentPosition.vz >= trjPointOpen.vz)
{
return 1;
}
else
{
return (currentPosition.vz - trjPointClosed.vz) /
(trjPointOpen.vz - trjPointClosed.vz);
}
}
} // namespace Boardcore