-
Notifications
You must be signed in to change notification settings - Fork 0
/
paint-utills.h
57 lines (51 loc) · 1.19 KB
/
paint-utills.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
String lastState = "";
void doPaint()
{
//encoderLocation = abs(encoder.read());
// printind state to monitor
if (lastState != state)
{
Serial.println(String("state: ") + (state));
lastState = state;
}
// not continuing unless update update interval passed
// if (millis() - lastUpdate < SERVO_UPDATE_INTERVAL)
// {
// //Serial.println(String("millis() ") + (millis()) + String(" lastUpdate ") + (lastUpdate) + String(" = ") + (millis() - lastUpdate));
// return true;
// }
// entrance point. todo change to switch map<string, function> if possible
if (state == BEFORE_START)
{
initDataBeforeFirstRun();
}
else if (state == BEFORE_DRAWING_MAIN_BRANCH)
{
beforeDrawingMainBranch();
}
else if (state == DRAWING_MAIN_BRANCH)
{
drawMainBranch();
}
else if (state == CALCULATE_LEAFS_SETTINGS)
{
calculateLeafsSettings();
}
else if (state == MOVING_TO_NEXT_LEAF_CREATION_SPOT)
{
moveToNextLeafCreationSpot();
}
else if (state == DRAWING_LEAF_PART_A)
{
drawLeafPartA();
}
else if (state == DRAWING_LEAF_PART_B)
{
drawLeafPartB();
}
else if (state == FINISH)
{
finishPaint();
}
lastUpdate = millis();
}