forked from section77/EggDuino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EBBHardware.h
72 lines (53 loc) · 1.8 KB
/
EBBHardware.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#pragma once
// no homing sequence, switch-on position of pen will be taken as reference point.
// No collision-detection!!
// Supported Servos: I do not know, I use Arduino Servo Lib with TG9e- standard servo.
// Note: Maximum-Speed in Inkscape is 1000 Steps/s. You could enter more, but then Pythonscript
// sends nonsense.
// EBB-Coordinates are coming in for 16th-Microstepmode. The number of steps per revolution
// can be adjusted in eggbot_conf.py from the inkscape plugin.
#include "config.h"
#include "EBBParser.h"
#include "Button.h"
#include "Stepper.h"
#include <VarSpeedServo.h>
class EBBHardware : public EBBParser {
public:
EBBHardware(Stream& stream);
void init();
virtual void processEvents();
protected:
virtual void enableMotor(int axis, bool state);
virtual void stepperMove(int duration, int numPenSteps, int numRotSteps);
virtual void setPenState(bool up, short delayMs);
virtual bool getPenState();
virtual void setPenUpPos(int percent);
virtual void setPenDownPos(int percent);
virtual void setServoRateUp(int percentPerSecond);
virtual void setServoRateDown(int percentPerSecond);
virtual bool getPrgButtonState();
virtual void setPinOutput(char port, int pin, int value);
virtual void setEngraverState(bool state, int power);
private:
void moveToDestination();
Stepper mRotMotor;
Stepper mPenMotor;
VarSpeedServo mPenServo;
bool mPenState;
short mPenUpPos; // eeprom!
short mPenDownPos; // eeprom!
short mServoRateUp; // eeprom
short mServoRateDown; // eeprom
bool mMotorEnabled;
bool mPrgButtonState;
// create Buttons
#ifdef PRG_BUTTON_PIN
Button mPrgButtonToggle;
#endif
#ifdef PEN_TOGGLE_BUTTON_PIN
Button mPenToggle;
#endif
#ifdef MOTORS_BUTTON_PIN
Button mMotorsToggle;
#endif
};