-
Notifications
You must be signed in to change notification settings - Fork 3
/
thc.c
39 lines (36 loc) · 766 Bytes
/
thc.c
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
/**
* thc.c THC control
* */
#include "grbl.h"
//THC Initialize
void thc_initialize()
{
// Set default values
hysteresis = 1;
analogSetVal = 3;
thcWorking = false;
}
// THC Control
void thc_update()
{
// Skip if THC is't on
if (thcWorking)
{
if ((analogVal > (analogSetVal - hysteresis)) && (analogVal < (analogSetVal + hysteresis))) //We are within our ok range
{
jog_z_up = false;
jog_z_down = false;
}
else //We are not in range and need to deterimine direction needed to put us in range
{
if (analogVal > analogSetVal) //Torch is too high
{
jog_z_down = true;
}
else //Torch is too low
{
jog_z_up = true;
}
}
}
}