summaryrefslogtreecommitdiff
path: root/trunk/users/adrian/FiveD_GCode.old/FiveD_GCode_Extruder/extruder.h
blob: 2cf1cbaf426504cd87f43e3ff53ee63b3cac11c2 (plain)
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
#ifndef EXTRUDER_H
#define EXTRUDER_H

#define REPLY_LENGTH 20

#define WAIT_T 'W'        // wait_for_temperature();
#define VALVE 'V'          // valve_set(bool open, int dTime);
#define DIRECTION 'D'   // set_direction(bool direction);
#define COOL 'C'           // set_cooler(byte e_speed);
#define SET_T 'T'           // set_temperature(int temp);
#define GET_T 't'           // get_temperature();
#define STEP 'S'             // step();
#define ENABLE 'E'       // enableStep();
#define DISABLE 'e'       // disableStep();
#define PING 'P'            // Just acknowledge

class extruder
{
private:
//********************************************************************************
// Stepper motor section

// We will half-step;  coilPosition will take values between 0 and 7 inclusive

  byte coilPosition;

// This variable stores the value (0..255) of the on-board potentiometer.  This is used 
// to vary the PWM mark-space values in analogWrites() to the enable pins, hence 
// controlling the effective motor current.

  byte potValue;
  bool h1Enable;
  bool h2Enable;
  bool forward;
  char reply[REPLY_LENGTH];

 
public:
   extruder();
   void wait_for_temperature();
   void valve_set(bool open);
   void set_direction(bool direction);
   void set_cooler(byte e_speed);
   void set_temperature(int temp);
   int get_temperature();
   void manage();
   void sStep();
   void enableStep();
   void disableStep();
   char* processCommand(char command[]);
   
};

#endif