valve measurement board
Dependencies: mbed ads1115_test SDFileSystem
Diff: main.cpp
- Branch:
- UplinkEnabled
- Revision:
- 38:67754c11cf6f
- Parent:
- 37:69eaa67338a9
- Child:
- 39:e5b10a982174
diff -r 69eaa67338a9 -r 67754c11cf6f main.cpp --- a/main.cpp Sun Mar 07 13:52:56 2021 +0900 +++ b/main.cpp Sun Mar 07 15:58:02 2021 +0900 @@ -94,14 +94,18 @@ temp2 = (float)((int16_t)data[0]) * TEMP_LSB; // Debug and Config section----------------------------------------------------------------- - if (pc.readable() > 0){ + if (pc.readable() > 0) + { wireless.putc(pc.getc()); - if(!ConfigFlag){ + if(!ConfigFlag) + { ConfigFlag = true; } } - if(ConfigFlag){ - while (wireless.readable() > 0){ + if(ConfigFlag) + { + while (wireless.readable() > 0) + { pc.putc(wireless.getc()); } continue; @@ -109,9 +113,11 @@ // ----------------------------------------------------------------------------------------- int time = timer.read_ms(); - if(time - dt >= 100){ + if(time - dt >= 100) + { // Debug and Config section----------------------------------------------------------------- - if (pc.readable() == 0 && wireless.readable() == 0){ + if (pc.readable() == 0 && wireless.readable() == 0) + { pc.printf("%d\t%d\t%d\t%f\t%f\r\n", timer.read_ms(), press_bit1, press_bit2, temp1, temp2); } // ----------------------------------------------------------------------------------------- @@ -120,8 +126,10 @@ dt = time; } //valvcontroler auto pressure limitation---------------------------------------------------- - if(APLFlug){ - if(press_bit1 > Threshold){ + if(APLFlug) + { + if(press_bit1 > Threshold) + { valve_controler1 = 1; valve_controler2 = 1; } @@ -130,7 +138,8 @@ valve_controler2 = 0; } } - else if(!APLFlug){ + else if(!APLFlug) + { wireless.printf("Auto Pressure Limitation is Disabled."); } //------------------------------------------------------------------------------------------ @@ -160,4 +169,8 @@ valve_controler2 = 0; APLFlug = false; } + else + { + wireless.printf("You send invaild command"); + } }