pumpe ok
This commit is contained in:
parent
d5a772f36b
commit
750012a9fb
14
gui/main.py
14
gui/main.py
@ -153,8 +153,8 @@ class PHControllerGUI(QMainWindow):
|
|||||||
self.set_controls_enabled(True)
|
self.set_controls_enabled(True)
|
||||||
|
|
||||||
# Request initial data
|
# Request initial data
|
||||||
self.send_command("<114>") # Request pH value
|
self.send_command("<14>") # Request pH value
|
||||||
self.send_command("<113>") # Request tube size
|
self.send_command("<13>") # Request tube size
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
QMessageBox.critical(self, "Fehler", f"Verbindungsfehler: {str(e)}")
|
QMessageBox.critical(self, "Fehler", f"Verbindungsfehler: {str(e)}")
|
||||||
|
|
||||||
@ -186,23 +186,23 @@ class PHControllerGUI(QMainWindow):
|
|||||||
|
|
||||||
def send_pump_command(self, state):
|
def send_pump_command(self, state):
|
||||||
if state == 1:
|
if state == 1:
|
||||||
self.send_command("<111>") # Pump on
|
self.send_command("<11>") # Pump on
|
||||||
self.pump_status.setText("Pumpe: Ein")
|
self.pump_status.setText("Pumpe: Ein")
|
||||||
else:
|
else:
|
||||||
self.send_command("<112>") # Pump off
|
self.send_command("<12>") # Pump off
|
||||||
self.pump_status.setText("Pumpe: Aus")
|
self.pump_status.setText("Pumpe: Aus")
|
||||||
|
|
||||||
def send_tube_command(self, index):
|
def send_tube_command(self, index):
|
||||||
# The Arduino expects the tube index (0-25)
|
# The Arduino expects the tube index (0-25)
|
||||||
self.send_command(f"<11{index+3}>") # <11[3-28]>
|
self.send_command(f"<1{index+3}>") # <11[3-28]>
|
||||||
|
|
||||||
def send_calibration_command(self, ph):
|
def send_calibration_command(self, ph):
|
||||||
if ph == 4:
|
if ph == 4:
|
||||||
self.send_command("<114>") # Start pH4 calibration
|
self.send_command("<15>") # Start pH4 calibration
|
||||||
QMessageBox.information(self, "Kalibrierung",
|
QMessageBox.information(self, "Kalibrierung",
|
||||||
"pH4 Kalibrierung gestartet. Sensor in pH4-Lösung tauchen und warten bis der Wert stabil ist.")
|
"pH4 Kalibrierung gestartet. Sensor in pH4-Lösung tauchen und warten bis der Wert stabil ist.")
|
||||||
else:
|
else:
|
||||||
self.send_command("<115>") # Start pH7 calibration
|
self.send_command("<16>") # Start pH7 calibration
|
||||||
QMessageBox.information(self, "Kalibrierung",
|
QMessageBox.information(self, "Kalibrierung",
|
||||||
"pH7 Kalibrierung gestartet. Sensor in pH7-Lösung tauchen und warten bis der Wert stabil ist.")
|
"pH7 Kalibrierung gestartet. Sensor in pH7-Lösung tauchen und warten bis der Wert stabil ist.")
|
||||||
|
|
||||||
|
|||||||
@ -136,7 +136,7 @@ int read_LCD_buttons(){ // read the buttons
|
|||||||
int hys = 1; // Hysterese zur Messwertglättung
|
int hys = 1; // Hysterese zur Messwertglättung
|
||||||
int lcv = 0;
|
int lcv = 0;
|
||||||
|
|
||||||
void reading(){ // Reading LM35 and PH Data
|
int reading(){ // Reading LM35 and PH Data
|
||||||
// Samplin LM35 and PH Value
|
// Samplin LM35 and PH Value
|
||||||
//TempTotal= TempTotal - TempReadings[Index]; // subtract the last reading:
|
//TempTotal= TempTotal - TempReadings[Index]; // subtract the last reading:
|
||||||
PhTotal= PhTotal - PhReadings[Index]; // subtract the last reading:
|
PhTotal= PhTotal - PhReadings[Index]; // subtract the last reading:
|
||||||
@ -248,41 +248,39 @@ if (Serial.available()) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (RxCmd[1] == '1') {
|
if ( RxCmd[1] == '1' ){
|
||||||
switch (RxCmd[2]) {
|
switch (RxCmd[2]) {
|
||||||
case '1': // Pump on
|
case '1':{ // Pumpe an
|
||||||
pinMode(MOTOR1, HIGH);
|
pinMode(MOTOR1,HIGH);
|
||||||
pinMode(MOTOR2, HIGH);
|
pinMode(MOTOR2,HIGH);
|
||||||
Pumpe = 2;
|
Pumpe=2;
|
||||||
Serial.println("<P1>"); // Bestätigung
|
|
||||||
break;
|
break;
|
||||||
case '2': // Pump off
|
}
|
||||||
pinMode(MOTOR1, HIGH);
|
case '2':{ // Pumpe aus
|
||||||
pinMode(MOTOR2, LOW);
|
pinMode(MOTOR1,HIGH);
|
||||||
Pumpe = 1;
|
pinMode(MOTOR2,LOW);
|
||||||
Serial.println("<P0>"); // Bestätigung
|
Pumpe=1;
|
||||||
break;
|
break;
|
||||||
case '3': // Tube selection (3-28)
|
}
|
||||||
tubid = RxCmd[3] - '3'; // Convert to 0-25
|
case '3':{ // Schlauchdaten anfordern
|
||||||
if (tubid >= 0 && tubid <= MAXTUB) {
|
Serial.print('<');
|
||||||
EEPROM.put(ee_tubid, tubid);
|
Serial.print('#');
|
||||||
Serial.print("<T");
|
double mlpersec =( ml[tubid]*korrf*2)/6; // tube * 20 Um/min * korecturfaktor durch 60 sec
|
||||||
Serial.print(tubid);
|
mlpersec = mlpersec*100000;
|
||||||
Serial.println(">"); // Bestätigung
|
Serial.print(mlpersec); // Return PH Data
|
||||||
}
|
|
||||||
|
Serial.println('>');
|
||||||
break;
|
break;
|
||||||
case '4': // Send pH value
|
}
|
||||||
Serial.print("<#");
|
case '4':{// PH - Daten anfordern
|
||||||
Serial.print(PhValue, 2);
|
Serial.print('<');
|
||||||
Serial.println(">");
|
Serial.print(PhValue,2); // Return PH Data
|
||||||
break;
|
Serial.println('>');
|
||||||
case '5': // Start calibration (4 or 7)
|
|
||||||
// Implement calibration mode
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -507,7 +505,7 @@ if (CurrentMode == 12) { // Auto modus stopped
|
|||||||
CurrentMode = 0;
|
CurrentMode = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case btnSELECT:{
|
case btnSELECT:{
|
||||||
if (CurrentMode == 0){ // Automodus starten
|
if (CurrentMode == 0){ // Automodus starten
|
||||||
pinMode(MOTOR1,HIGH);
|
pinMode(MOTOR1,HIGH);
|
||||||
@ -530,7 +528,88 @@ if (CurrentMode == 12) { // Auto modus stopped
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
// if (adc_key_prev != lcd_key)
|
||||||
|
// {
|
||||||
|
// //Serial.println("Key Press Change Detected");
|
||||||
|
// switch (lcd_key){ // depending on which button was pushed, we perform an action
|
||||||
|
// case btnRIGHT:{ // push button "RIGHT" and show the word on the screen
|
||||||
|
// //lcd.print("RIGHT");
|
||||||
|
// if ( CurrentMode == 0 ){
|
||||||
|
// lcd.clear();
|
||||||
|
// CurrentMode = 2;
|
||||||
|
// }
|
||||||
|
// if ( CurrentMode == 3){
|
||||||
|
// lcd.clear();
|
||||||
|
// if ( CalSelect == 0 ){
|
||||||
|
// CurrentMode = 4;
|
||||||
|
// }
|
||||||
|
// if ( CalSelect == 1){
|
||||||
|
// CurrentMode = 5;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// case btnLEFT:{
|
||||||
|
// //lcd.print("LEFT "); // push button "LEFT" and show the word on the screen
|
||||||
|
// if ( CurrentMode == 2 ){
|
||||||
|
// lcd.clear();
|
||||||
|
// CurrentMode = 0;
|
||||||
|
// }
|
||||||
|
// if ( CurrentMode == 3 ){
|
||||||
|
// lcd.clear();
|
||||||
|
// CurrentMode = 0;
|
||||||
|
// }
|
||||||
|
// if ( CurrentMode == 4 || CurrentMode == 5 ){
|
||||||
|
// lcd.clear();
|
||||||
|
// CurrentMode = 3;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// case btnUP:{
|
||||||
|
// //lcd.print("UP "); // push button "UP" and show the word on the screen
|
||||||
|
// if ( CurrentMode == 0 ){
|
||||||
|
// lcd.clear();
|
||||||
|
// CurrentMode = 1;
|
||||||
|
// }
|
||||||
|
// if ( CurrentMode == 3 ){
|
||||||
|
// lcd.clear();
|
||||||
|
// CalSelect = 0;
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// case btnDOWN:{
|
||||||
|
// //lcd.print("DOWN "); // push button "DOWN" and show the word on the screen
|
||||||
|
// if ( CurrentMode == 1){
|
||||||
|
// lcd.clear();
|
||||||
|
// CurrentMode = 0;
|
||||||
|
// }
|
||||||
|
// if ( CurrentMode == 3 ){
|
||||||
|
// lcd.clear();
|
||||||
|
// CalSelect = 1;
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// case btnSELECT:{
|
||||||
|
// //lcd.print("SEL. "); // push button "SELECT" and show the word on the screen
|
||||||
|
// if ( CurrentMode == 0 ){
|
||||||
|
// lcd.clear();
|
||||||
|
// CurrentMode = 3;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// if ( CurrentMode == 3 ){
|
||||||
|
// lcd.clear();
|
||||||
|
// CurrentMode = 0;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// case btnNONE:{
|
||||||
|
// //lcd.print("NONE "); // No action will show "None" on the screen
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user