Skip to content

Commit c99d1e9

Browse files
committed
Actualiza nuevas variables.
1 parent 17a291c commit c99d1e9

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

PIDfromBT.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ PIDfromBT::PIDfromBT(float* kp, float* ki, float* kd, int* vel, bool debug)
1515
_vel = vel; // V
1616

1717
_debug = debug;
18-
valor = "";
19-
letra = ' ';
20-
last_millis = millis();
18+
_value = "";
19+
_letter = ' ';
20+
_last_update = millis();
2121
_type = TYPE_PIDV;
2222
}
2323

@@ -32,9 +32,9 @@ PIDfromBT::PIDfromBT(float* kp, float* ki, float* kd, int* vel, int* ideal, bool
3232
_minIdeal = MIN_IDEAL;
3333

3434
_debug = debug;
35-
valor = "";
36-
letra = ' ';
37-
last_millis = millis();
35+
_value = "";
36+
_letter = ' ';
37+
_last_update = millis();
3838
_type = TYPE_PIDVI;
3939
}
4040

@@ -50,9 +50,9 @@ PIDfromBT::PIDfromBT(float* kp, float* ki, float* kd, int* vel, int* ideal, int*
5050
_minIdeal = MIN_IDEAL;
5151

5252
_debug = debug;
53-
valor = "";
54-
letra = ' ';
55-
last_millis = millis();
53+
_value = "";
54+
_letter = ' ';
55+
_last_update = millis();
5656
_type = TYPE_PIDVIS;
5757
}
5858

@@ -89,44 +89,44 @@ void PIDfromBT::execute_task(char letter, float value)
8989
switch (letter) {
9090
case 'P':
9191
if(_type < TYPE_PIDV)return;
92-
*_kp = valor;
93-
if (print) {
92+
*_kp = value;
93+
if (_debug) {
9494
Serial.println("Kp: " + String(value));
9595
}
9696
break;
9797
case 'I':
9898
if(_type < TYPE_PIDV)return;
9999
*_ki = value;
100-
if (print) {
100+
if (_debug) {
101101
Serial.println("Ki: " + String(value));
102102
}
103103
break;
104104
case 'D':
105105
if(_type < TYPE_PIDV)return;
106106
*_kd = value;
107-
if (print) {
107+
if (_debug) {
108108
Serial.println("Kd: " + String(value));
109109
}
110110
break;
111111
case 'V':
112112
if(_type < TYPE_PIDV)return;
113113
*_vel = value;
114-
if (print) {
115-
Serial.println("Vel: " + String(value));
114+
if (_debug) {
115+
Serial.println("Vel: " + String(*_vel));
116116
}
117117
break;
118118
case 'X':
119119
if(_type < TYPE_PIDVI)return;
120-
*_ideal = map(value, -1000, 1000, minIdeal, maxIdeal);;
121-
if (print) {
122-
Serial.println("Ideal: " + String(*ideal));
120+
*_ideal = map(value, -500, 500, _minIdeal, _maxIdeal);;
121+
if (_debug) {
122+
Serial.println("Ideal: " + String(*_ideal));
123123
}
124124
break;
125125
case 'S':
126-
if(_type < TYPE_PIDVS)return;
127-
*_suction = value.toInt();
128-
if (print) {
129-
Serial.println("Suc: " + String(value));
126+
if(_type < TYPE_PIDVIS)return;
127+
*_suction = value;
128+
if (_debug) {
129+
Serial.println("Suc: " + String(*_suction));
130130
}
131131
break;
132132
}

PIDfromBT.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ class PIDfromBT
3030

3131
void setMaxIdeal(int maxIdeal);
3232

33-
bool update();
33+
void update();
34+
35+
void execute_task(char letter, float value);
3436

3537
private:
3638
void execute_task();

0 commit comments

Comments
 (0)