add minvoltage and voltage to display

This commit is contained in:
interfisch 2024-07-17 00:02:48 +02:00
parent 890daa9702
commit 07d6aa5e3e
3 changed files with 21 additions and 6 deletions

View File

@ -132,6 +132,8 @@ float max_filtered_wattAll;
float min_filtered_wattAll;
float max_meanSpeed;
float min_voltage;
float minSpeedms; //speed in m/s of slowest wheel
double overallTrip; //m. trip with read distance from sd card
double trip; //m. trip distance since boot

View File

@ -248,10 +248,15 @@ void display_standingDisplay(ESCSerialComm& escFront, ESCSerialComm& escRear) {
//Row 1
display.print(F("Vbat:")); display.print(escFront.getFeedback_batVoltage());
display.print(F("/")); display.print(escRear.getFeedback_batVoltage());
if (!_displayOverall) {
display.print(F("Vbat:")); display.print(escFront.getFeedback_batVoltage());
display.print(F("/")); display.print(escRear.getFeedback_batVoltage());
}else{
display.print(F("Vmin:")); display.print(min_voltage);
}
display.print(" V");
display.println();
//Row 2
@ -322,10 +327,10 @@ void display_standingDisarmedDisplay(ESCSerialComm& escFront, ESCSerialComm& esc
//Row2
display.print("Throttle ");
display.print(F("Throttle "));
dtostrf(ads_throttle_A_raw,1,0,buf);
display.print((String)buf);
display.print("/");
display.print(F("/"));
dtostrf(ads_throttle_B_raw,1,0,buf);
display.print((String)buf);
display.println();
@ -335,6 +340,11 @@ void display_standingDisarmedDisplay(ESCSerialComm& escFront, ESCSerialComm& esc
display.print("Brake ");
dtostrf(ads_brake_raw,1,0,buf);
display.print((String)buf);
display.setCursor(6*10,0);
dtostrf((escFront.getFeedback_batVoltage()+escRear.getFeedback_batVoltage())/2.0,1,1,buf);
display.print((String)buf);
display.print(F('V'));
display.println();

View File

@ -232,14 +232,17 @@ void loop() {
max_filtered_currentAll=max(max_filtered_currentAll,filtered_currentAll);
min_filtered_currentAll=min(min_filtered_currentAll,filtered_currentAll);
max_filtered_wattAll=max(max_filtered_wattAll,filtered_currentAll*(escFront.getFeedback_batVoltage()+escRear.getFeedback_batVoltage())/2.0);
min_filtered_wattAll=min(min_filtered_wattAll,filtered_currentAll*(escFront.getFeedback_batVoltage()+escRear.getFeedback_batVoltage())/2.0);
float _meanVoltage=(escFront.getFeedback_batVoltage()+escRear.getFeedback_batVoltage())/2.0;
max_filtered_wattAll=max(max_filtered_wattAll,filtered_currentAll*_meanVoltage);
min_filtered_wattAll=min(min_filtered_wattAll,filtered_currentAll*_meanVoltage);
min_voltage=min(min_voltage,_meanVoltage);
max_meanSpeed=max(max_meanSpeed,(escFront.getMeanSpeed()+escRear.getMeanSpeed())/2);
if (!armed) { //reset statistics if disarmed
max_filtered_currentAll=0;
min_filtered_currentAll=0;
max_filtered_wattAll=0;
min_filtered_wattAll=0;
min_voltage=99;
max_meanSpeed=0;
}
}