forked from Hephaestus-Arm/HephaestusArm2-firmware
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathLewanSoulPlanner.h
48 lines (44 loc) · 1.24 KB
/
LewanSoulPlanner.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
/*
* LewanSoulPlanner.h
*
* Created on: May 11, 2020
* Author: hephaestus
*/
#ifndef SRC_PID_LEWANSOULPLANNER_H_
#define SRC_PID_LEWANSOULPLANNER_H_
#include <lx16a-servo.h>
#include <Preferences.h>
#define HOME_SWITCH_PIN 0
#define INDICATOR 13
#define MOTOR_DISABLE 12
#define plannerLoopTimeMs 15
#define FLASHKEY 37
#define SERIAL_BUS0 14
#define SERIAL_BUS1 27
enum LewanSoulState_t {
StartupSerial, WaitForHomePress,WaitForHomeRelease,WaitingForCalibrationToFinish,WaitingToRun,running,disabled,waitingToreadPreferences,readPreferrences,waitingtoWritePreferences,writePreferences
// Add more states here and be sure to add them to the cycle
};
class LewanSoulPlanner {
Preferences preferences;
LX16ABus servoBus;
LX16AServo ** motors;
int numberOfServos=0;
long timeOfLastRun = 0;
long timeOfHomingPressed=0;
bool blinkState = false;
long timeOfLastBlink = 0;
void update(int startIndex,int endIndex);
void read(int startIndex,int endIndex);
bool calibrate(int startIndex,int endIndex);
int channel=0;
public:
LewanSoulPlanner( int num, int channel);
~LewanSoulPlanner();
void loop();
int indexSplit=3;
LewanSoulState_t state=StartupSerial;
int targets[10]={0,};
int positions[10]={0,};
};
#endif /* SRC_PID_LEWANSOULPLANNER_H_ */