Skip to content

Commit

Permalink
test_result_normal
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaonian72 committed May 31, 2021
1 parent fb20be9 commit 41efcf4
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 30 deletions.
4 changes: 2 additions & 2 deletions include/define.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions lib/AIOapp/AIOapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down
5 changes: 4 additions & 1 deletion lib/AIOapp/AIOapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand All @@ -54,14 +56,15 @@ class AIOapp {
uint16_t sample_period = 0;

// ELClient esp;
// ESPweb pidweb;
Stream * _comm_ser;
Stream * _dbg_ser;

SensorBoard sensorBoard;
Valve valve_switch;
Pump pump;
FlowController f_ctler;
AppConfig p_speed = {30, 30};
AppConfig p_speed = {100, 100};

};

Expand Down
3 changes: 1 addition & 2 deletions lib/FlowController/FlowController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/FlowController/FlowController.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FlowController {

double getFlowRate();

void setFlowRate(double target);
void setFlowRate(double target);//setpoint

void drivePump() const;

Expand Down
1 change: 0 additions & 1 deletion lib/SensorBoard/SensorBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
23 changes: 0 additions & 23 deletions src/configWeb.html

This file was deleted.

51 changes: 51 additions & 0 deletions src/pid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!-- EspLink will add header here -->
<html><body>
<div class="header">
<h1>PID Setting</h1>
</div>

<div class="content">
<form>
a_kd:<input id="a_kd" name="a_kd" type="number" min="0.00" max="50.00" step="0.01"/>
<input type="submit">
<br>
</form>
<form>
a_ki: <input id="a_ki" name="a_ki" type="number" min="0.00" max="50.00" step="0.01"/>
<input type="submit">
<br>
</form>
<form>
a_kp: <input id="a_kp" name="a_kp" type="number" min="0.00" max="50.00" step="0.01"/>
<input type="submit">
<br>
</form>
<form>
airspeed: <input id="airspeed" name="airspeed" type="number" min="0" max="255" step="1"/>
<input type="submit">
<br>
</form>
<form>
f_kd:<input id="f_kd" name="f_kd" type="number" min="0.00" max="50.00" step="0.01"/>
<input type="submit">
<br>
</form>
<form>
f_ki: <input id="f_ki" name="f_ki" type="number" min="0.00" max="50.00" step="0.01"/>
<input type="submit">
<br>
</form>
<form>
f_kp: <input id="f_kp" name="f_kp" type="number" min="0.00" max="50.00" step="0.01"/>
<input type="submit">
<br>
</form>
<form>
fragspeed: <input id="fragspeed" name="fragspeed" type="number" min="0" max="255" step="1"/>
<input type="submit">
<br>
</form>
</div>
<button id="Valve_on" type="button">Valve_on</button>
<button id="Valve_off" type="button">Valve_off</button>
<!-- </body></html> -->

0 comments on commit 41efcf4

Please sign in to comment.