including homing sensor
This commit is contained in:
+19
-3
@@ -26,10 +26,12 @@
|
||||
#include "ethernet_init.h"
|
||||
#include "esp_netif.h"
|
||||
#include "esp_eth.h"
|
||||
|
||||
// Component header
|
||||
#include "Task.hpp"
|
||||
#include "PwmExpanderPca9685.hpp"
|
||||
#include "StepperDrv8833.hpp"
|
||||
#include "stepperMotor.hpp"
|
||||
|
||||
static const char *TAG = "Watch";
|
||||
static esp_eth_handle_t s_eth_handle = NULL;
|
||||
@@ -151,17 +153,31 @@ void MovementTask() {
|
||||
StepperDriverDrv8833 stepperDriver(stepperPins, MicroSteps);
|
||||
stepperDriver.setPos(0);
|
||||
|
||||
while (true) {
|
||||
StepperMotor::Config stepperCfg{1.8F, MicroSteps};
|
||||
InputPort initSens(GPIO_NUM_33);
|
||||
initSens.setLogic(GpioPort::Logic::Inverted);
|
||||
StepperMotor stepper(stepperCfg, stepperDriver, initSens);
|
||||
|
||||
int i = 0;
|
||||
while (i++ < 80) {
|
||||
stepperDriver.step(1);
|
||||
stepperDriver.getSubPos();
|
||||
fos::Task::delayMs(100);
|
||||
}
|
||||
|
||||
ESP_LOGI("Stepper", "Find Home");
|
||||
stepper.findRef();
|
||||
ESP_LOGI(TAG, "Fist Position is %f.2", stepper.getScaledPos() * 6);
|
||||
fos::Task::delayMs(1000);
|
||||
|
||||
while (true) {
|
||||
fos::Task::delayMs(100);
|
||||
}
|
||||
}
|
||||
|
||||
void IoTest()
|
||||
{
|
||||
ESP_LOGI(TAG, "Start IO");
|
||||
InputPort in1(GPIO_NUM_33);
|
||||
InputPort in2(GPIO_NUM_32);
|
||||
InputPort mFault(GPIO_NUM_35);
|
||||
|
||||
@@ -169,7 +185,7 @@ void IoTest()
|
||||
OutputPort nReset(GPIO_NUM_5);
|
||||
|
||||
while (true) {
|
||||
ESP_LOGI("Light", "InValues %i %i %i", in1.read(), in2.read(), mFault.read());
|
||||
ESP_LOGI("Light", "InValues %i %i", in2.read(), mFault.read());
|
||||
nEnable.write(true);
|
||||
nReset.write(true);
|
||||
fos::Task::delayMs(500);
|
||||
|
||||
Reference in New Issue
Block a user