farmbot-arduino-firmware/src/src.ino

61 lines
1.1 KiB
Arduino
Raw Permalink Normal View History

2019-12-02 14:07:28 -07:00
/*
Name: src.ino
Created: 11/14/2019 9:51:10 PM
Author: Tim Evers
*/
2020-01-10 14:49:44 -07:00
#include "TMC2130_Basics.h"
2019-12-02 14:07:28 -07:00
#include "farmbot_arduino_controller.h"
2020-01-05 14:20:48 -07:00
//#include <SPI.h>
//#include "Trinamic\Trinamic_TMC2130.h"
//#include "pins.h"
//#include "TMC2130.h"
2019-12-02 14:07:28 -07:00
// the setup function runs once when you press reset or power the board
void setup()
{
startSerial();
2020-01-05 14:20:48 -07:00
setPinInputOutput();
2019-12-02 14:07:28 -07:00
readParameters();
#if defined(FARMDUINO_EXP_V20) || defined(FARMDUINO_V30)
2019-12-02 14:07:28 -07:00
loadTMC2130drivers();
startupTmc();
loadTMC2130parameters();
2019-12-02 14:07:28 -07:00
#endif
2020-01-05 14:20:48 -07:00
//Serial.print("============");
//Serial.print(CRLF);
2019-12-02 14:07:28 -07:00
loadMovementSetting();
startMotor();
startPinGuard();
2020-02-13 09:21:51 -07:00
//startServo();
2019-12-02 14:07:28 -07:00
startInterrupt();
initLastAction();
homeOnBoot();
2020-01-06 14:06:59 -07:00
//setupTestForDebug();
2020-01-05 14:20:48 -07:00
2020-01-06 14:06:59 -07:00
Serial.print(COMM_REPORT_COMMENT);
Serial.print(SPACE);
Serial.print("ARDUINO STARTUP COMPLETE");
Serial.print(CRLF);
2019-12-02 14:07:28 -07:00
}
// the loop function runs over and over again until power down or reset
void loop()
{
2020-01-06 14:06:59 -07:00
//runTestForDebug();
2019-12-02 14:07:28 -07:00
2020-01-06 14:06:59 -07:00
checkEncoders();
checkPinGuard();
checkSerialInputs();
checkEmergencyStop();
checkParamsChanged();
periodicChecksAndReport();
2020-01-05 14:20:48 -07:00
2020-02-13 09:21:51 -07:00
}