mirror of
https://github.com/adrigongv23/G26---Telemetry-Software.git
synced 2026-08-25 11:33:17 +02:00
Todo subido
This commit is contained in:
parent
f0db3a8aeb
commit
27026caf57
87 changed files with 83292 additions and 17 deletions
61
Tiempo_por_vuelta/receptor_pruebas/autox_endurance.cpp
Normal file
61
Tiempo_por_vuelta/receptor_pruebas/autox_endurance.cpp
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
#include <Arduino.h>
|
||||
|
||||
#include "autox_endurance.hpp"
|
||||
|
||||
unsigned long tiempo_acumulado=0;
|
||||
int vueltas_total=0;
|
||||
|
||||
void reiniciar_receptor_autox_endurance() {
|
||||
|
||||
if(tiempo_acumulado!=0 || vueltas_total!=0){
|
||||
|
||||
Serial.print("Tiempo total: ");
|
||||
Serial.print(tiempo_acumulado/1000.0, 3);
|
||||
Serial.println(" s");
|
||||
|
||||
unsigned long media_vueltas=tiempo_acumulado/vueltas_total;
|
||||
|
||||
Serial.print("Media de vueltas: ");
|
||||
Serial.print(media_vueltas/1000.0, 3);
|
||||
Serial.println(" s");
|
||||
|
||||
tiempo_acumulado=0;
|
||||
vueltas_total=0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void procesar_autox_endurance(const paquete_datos& datos) {
|
||||
switch (datos.estado) {
|
||||
case 1:
|
||||
if (datos.vuelta == 1) {
|
||||
Serial.println("Calentamiento: vuelta 1 iniciada");
|
||||
} else {
|
||||
Serial.print("Calentamiento: vuelta ");
|
||||
Serial.print(datos.vuelta - 1);
|
||||
Serial.print(" terminada, vuelta ");
|
||||
Serial.print(datos.vuelta);
|
||||
Serial.println(" iniciada");
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
Serial.println("Calentamiento terminado: primera vuelta oficial iniciada");
|
||||
break;
|
||||
|
||||
case 3:
|
||||
Serial.print("Vuelta ");
|
||||
Serial.print(datos.vuelta);
|
||||
Serial.print(": ");
|
||||
Serial.print(datos.tiempo / 1000.0, 3);
|
||||
tiempo_acumulado+=datos.tiempo;
|
||||
vueltas_total=datos.vuelta;
|
||||
Serial.println(" s");
|
||||
break;
|
||||
|
||||
default:
|
||||
Serial.println("Estado de Autocross / Endurance desconocido");
|
||||
break;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue