diff --git a/include/define.h b/include/define.h index 6ed3cf5..eb3eb45 100644 --- a/include/define.h +++ b/include/define.h @@ -19,6 +19,6 @@ const double KP = 0.3; const double KI = 0.1; const double KD = 0; -#define DEBUG_SERIAL Serial3 - +// #define DEBUG_SERIAL Serial3 +#define DEBUG_SERIAL Serial #endif //GSAAIO_DEFINES_H \ No newline at end of file diff --git a/lib/AIOapp/AIOapp.cpp b/lib/AIOapp/AIOapp.cpp index 3da61bb..e0037f2 100644 --- a/lib/AIOapp/AIOapp.cpp +++ b/lib/AIOapp/AIOapp.cpp @@ -43,7 +43,10 @@ void AIOapp::airFlow(uint8_t speed) { } void AIOapp::printData(){ + f_ctler.printData(); sensorBoard.print(); + // _comm_ser->println("123"); + _dbg_ser->println(); } void AIOapp::startsample(){ diff --git a/lib/AIOapp/AIOapp.h b/lib/AIOapp/AIOapp.h index 0028ef2..9988cde 100644 --- a/lib/AIOapp/AIOapp.h +++ b/lib/AIOapp/AIOapp.h @@ -39,10 +39,12 @@ class AIOapp { if (cur - last_release >= UPDATE_INTERVAL){ last_release = cur; readSensor(); + f_ctler.update(); if (Sample_flag && (sample_count >= 0)){ sampling(); } printData(); + pump.set_speed(50);//should be removed } } @@ -54,6 +56,7 @@ class AIOapp { uint16_t sample_period = 0; // ELClient esp; + // ESPweb pidweb; Stream * _comm_ser; Stream * _dbg_ser; @@ -61,7 +64,7 @@ class AIOapp { Valve valve_switch; Pump pump; FlowController f_ctler; - AppConfig p_speed = {30, 30}; + AppConfig p_speed = {100, 100}; }; diff --git a/lib/FlowController/FlowController.cpp b/lib/FlowController/FlowController.cpp index 589c5a5..c79c00d 100644 --- a/lib/FlowController/FlowController.cpp +++ b/lib/FlowController/FlowController.cpp @@ -11,13 +11,11 @@ double FlowController::getFlowRate() { uint16_t rate; Wire.requestFrom(0x07, 2); // request 6 bytes from slave device #8 - while (Wire.available()) { // slave may send less than requested byte b1 = Wire.read(); byte b2 = Wire.read();// receive a byte as character rate = b1 << 8 | b2; } - return rate; #else double vout = analogRead(FLOW_METER_IN) * 5 / 1024.0; @@ -39,6 +37,7 @@ void FlowController::init(Pump *pump) { #ifdef FLOW_METER_ANALOG pinMode(FLOW_METER_IN, INPUT); #endif + Wire.begin(); this->initPump(pump); this->controller.SetOutputLimits(0, 255); // if PWM this->setFlowRate(DEFAULT_FLOW_RATE); // set default flow rate diff --git a/lib/FlowController/FlowController.h b/lib/FlowController/FlowController.h index 224fc3d..6a051b5 100644 --- a/lib/FlowController/FlowController.h +++ b/lib/FlowController/FlowController.h @@ -19,7 +19,7 @@ class FlowController { double getFlowRate(); - void setFlowRate(double target); + void setFlowRate(double target);//setpoint void drivePump() const; diff --git a/lib/SensorBoard/SensorBoard.cpp b/lib/SensorBoard/SensorBoard.cpp index fafd945..f55b9fa 100644 --- a/lib/SensorBoard/SensorBoard.cpp +++ b/lib/SensorBoard/SensorBoard.cpp @@ -38,7 +38,6 @@ void SensorBoard::print() { for (double i : _voltage_data){ _ser->print(i*0.001,7); _ser->print(","); } - _ser->println(); } void SensorBoard::_setResolution() { diff --git a/src/configWeb.html b/src/configWeb.html deleted file mode 100644 index 433e2dc..0000000 --- a/src/configWeb.html +++ /dev/null @@ -1,23 +0,0 @@ - - -
-

PID Setting

-
- -
-
- KP:
- KI:
- KD:
- Valve Status: - -
- Notifications -
- -
-
- diff --git a/src/pid.html b/src/pid.html new file mode 100644 index 0000000..ff1762c --- /dev/null +++ b/src/pid.html @@ -0,0 +1,51 @@ + + +
+

PID Setting

+
+ +
+
+ a_kd: + +
+
+
+ a_ki: + +
+
+
+ a_kp: + +
+
+
+ airspeed: + +
+
+
+ f_kd: + +
+
+
+ f_ki: + +
+
+
+ f_kp: + +
+
+
+ fragspeed: + +
+
+
+ + +