Fixing indentation
This commit is contained in:
104
EggDuino.ino
104
EggDuino.ino
@@ -1,10 +1,10 @@
|
|||||||
/* Eggduino-Firmware by Joachim Cerny, 2014
|
/* Eggduino-Firmware by Joachim Cerny, 2014
|
||||||
|
|
||||||
Thanks for the nice libs ACCELSTEPPER and SERIALCOMMAND, which made this project much easier.
|
Thanks for the nice libs ACCELSTEPPER and SERIALCOMMAND, which made this project much easier.
|
||||||
Thanks to the Eggbot-Team for such a funny and enjoable concept!
|
Thanks to the Eggbot-Team for such a funny and enjoable concept!
|
||||||
Thanks to my wife and my daughter for their patience. :-)
|
Thanks to my wife and my daughter for their patience. :-)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// implemented Eggbot-Protocol-Version v13
|
// implemented Eggbot-Protocol-Version v13
|
||||||
// EBB-Command-Reference, I sourced from: http://www.schmalzhaus.com/EBB/EBBCommands.html
|
// EBB-Command-Reference, I sourced from: http://www.schmalzhaus.com/EBB/EBBCommands.html
|
||||||
@@ -15,9 +15,9 @@ Thanks to my wife and my daughter for their patience. :-)
|
|||||||
// EBB-Coordinates are coming in for 16th-Microstepmode. The Coordinate-Transforms are done in weired integer-math. Be careful, when you diecide to modify settings.
|
// EBB-Coordinates are coming in for 16th-Microstepmode. The Coordinate-Transforms are done in weired integer-math. Be careful, when you diecide to modify settings.
|
||||||
|
|
||||||
/* TODOs:
|
/* TODOs:
|
||||||
1 collision control via penMin/penMax
|
1 collision control via penMin/penMax
|
||||||
2 implement homing sequence via microswitch or optical device
|
2 implement homing sequence via microswitch or optical device
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "AccelStepper.h" // nice lib from http://www.airspayce.com/mikem/arduino/AccelStepper/
|
#include "AccelStepper.h" // nice lib from http://www.airspayce.com/mikem/arduino/AccelStepper/
|
||||||
#include <Servo.h>
|
#include <Servo.h>
|
||||||
@@ -27,17 +27,17 @@ Thanks to my wife and my daughter for their patience. :-)
|
|||||||
|
|
||||||
#define initSting "EBBv13_and_above Protocol emulated by Eggduino-Firmware V1.6"
|
#define initSting "EBBv13_and_above Protocol emulated by Eggduino-Firmware V1.6"
|
||||||
//Rotational Stepper:
|
//Rotational Stepper:
|
||||||
#define step1 11
|
#define step1 11
|
||||||
#define dir1 10
|
#define dir1 10
|
||||||
#define enableRotMotor 9
|
#define enableRotMotor 9
|
||||||
#define rotMicrostep 16 //MicrostepMode, only 1,2,4,8,16 allowed, because of Integer-Math in this Sketch
|
#define rotMicrostep 16 //MicrostepMode, only 1,2,4,8,16 allowed, because of Integer-Math in this Sketch
|
||||||
//Pen Stepper:
|
//Pen Stepper:
|
||||||
#define step2 8
|
#define step2 8
|
||||||
#define dir2 7
|
#define dir2 7
|
||||||
#define enablePenMotor 6
|
#define enablePenMotor 6
|
||||||
#define penMicrostep 16 //MicrostepMode, only 1,2,4,8,16 allowed, because of Integer-Math in this Sketch
|
#define penMicrostep 16 //MicrostepMode, only 1,2,4,8,16 allowed, because of Integer-Math in this Sketch
|
||||||
|
|
||||||
#define servoPin 3 //Servo
|
#define servoPin 3 //Servo
|
||||||
|
|
||||||
// EXTRAFEATURES - UNCOMMENT TO USE THEM -------------------------------------------------------------------
|
// EXTRAFEATURES - UNCOMMENT TO USE THEM -------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -47,42 +47,42 @@ Thanks to my wife and my daughter for their patience. :-)
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
#define penUpPosEEAddress ((uint16_t *)0)
|
#define penUpPosEEAddress ((uint16_t *)0)
|
||||||
#define penDownPosEEAddress ((uint16_t *)2)
|
#define penDownPosEEAddress ((uint16_t *)2)
|
||||||
|
|
||||||
//make Objects
|
//make Objects
|
||||||
AccelStepper rotMotor(1, step1, dir1);
|
AccelStepper rotMotor(1, step1, dir1);
|
||||||
AccelStepper penMotor(1, step2, dir2);
|
AccelStepper penMotor(1, step2, dir2);
|
||||||
Servo penServo;
|
Servo penServo;
|
||||||
SerialCommand SCmd;
|
SerialCommand SCmd;
|
||||||
//create Buttons
|
//create Buttons
|
||||||
#ifdef prgButton
|
#ifdef prgButton
|
||||||
Button prgButtonToggle(prgButton, setprgButtonState);
|
Button prgButtonToggle(prgButton, setprgButtonState);
|
||||||
#endif
|
#endif
|
||||||
#ifdef penToggleButton
|
#ifdef penToggleButton
|
||||||
Button penToggle(penToggleButton, doTogglePen);
|
Button penToggle(penToggleButton, doTogglePen);
|
||||||
#endif
|
#endif
|
||||||
#ifdef motorsButton
|
#ifdef motorsButton
|
||||||
Button motorsToggle(motorsButton, toggleMotors);
|
Button motorsToggle(motorsButton, toggleMotors);
|
||||||
#endif
|
#endif
|
||||||
// Variables... be careful, by messing around here, everything has a reason and crossrelations...
|
// Variables... be careful, by messing around here, everything has a reason and crossrelations...
|
||||||
int penMin=0;
|
int penMin=0;
|
||||||
int penMax=0;
|
int penMax=0;
|
||||||
int penUpPos=5; //can be overwritten from EBB-Command SC
|
int penUpPos=5; //can be overwritten from EBB-Command SC
|
||||||
int penDownPos=20; //can be overwritten from EBB-Command SC
|
int penDownPos=20; //can be overwritten from EBB-Command SC
|
||||||
int servoRateUp=0; //from EBB-Protocol not implemented on machine-side
|
int servoRateUp=0; //from EBB-Protocol not implemented on machine-side
|
||||||
int servoRateDown=0;//from EBB-Protocol not implemented on machine-side
|
int servoRateDown=0; //from EBB-Protocol not implemented on machine-side
|
||||||
long rotStepError=0;
|
long rotStepError=0;
|
||||||
long penStepError=0;
|
long penStepError=0;
|
||||||
int penState=penUpPos;
|
int penState=penUpPos;
|
||||||
uint32_t nodeCount=0;
|
uint32_t nodeCount=0;
|
||||||
unsigned int layer=0;
|
unsigned int layer=0;
|
||||||
boolean prgButtonState=0;
|
boolean prgButtonState=0;
|
||||||
uint8_t rotStepCorrection = 16/rotMicrostep ; //devide EBB-Coordinates by this factor to get EGGduino-Steps
|
uint8_t rotStepCorrection = 16/rotMicrostep ; //devide EBB-Coordinates by this factor to get EGGduino-Steps
|
||||||
uint8_t penStepCorrection = 16/penMicrostep ; //devide EBB-Coordinates by this factor to get EGGduino-Steps
|
uint8_t penStepCorrection = 16/penMicrostep ; //devide EBB-Coordinates by this factor to get EGGduino-Steps
|
||||||
float rotSpeed=0;
|
float rotSpeed=0;
|
||||||
float penSpeed=0; // these are local variables for Function SteppermotorMove-Command, but for performance-reasons it will be initialized here
|
float penSpeed=0; // these are local variables for Function SteppermotorMove-Command, but for performance-reasons it will be initialized here
|
||||||
boolean motorsEnabled = 0;
|
boolean motorsEnabled = 0;
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
@@ -95,15 +95,15 @@ void loop() {
|
|||||||
|
|
||||||
SCmd.readSerial();
|
SCmd.readSerial();
|
||||||
|
|
||||||
#ifdef penToggleButton
|
#ifdef penToggleButton
|
||||||
penToggle.check();
|
penToggle.check();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef motorsButton
|
#ifdef motorsButton
|
||||||
motorsToggle.check();
|
motorsToggle.check();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef prgButton
|
#ifdef prgButton
|
||||||
prgButtonToggle.check();
|
prgButtonToggle.check();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ void setLayer() {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
sendError();
|
sendError();
|
||||||
}
|
}
|
||||||
|
|
||||||
void queryNodeCount() {
|
void queryNodeCount() {
|
||||||
Serial.print(String(nodeCount) +"\r\n");
|
Serial.print(String(nodeCount) +"\r\n");
|
||||||
@@ -195,8 +195,8 @@ void enableMotors(){
|
|||||||
default:
|
default:
|
||||||
sendError();
|
sendError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//the following implementaion is a little bit cheated, because i did not know, how to implement different values for first and second argument.
|
//the following implementaion is a little bit cheated, because i did not know, how to implement different values for first and second argument.
|
||||||
if ((arg != NULL) && (val != NULL)){
|
if ((arg != NULL) && (val != NULL)){
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case 0: motorsOff();
|
case 0: motorsOff();
|
||||||
|
|||||||
Reference in New Issue
Block a user