Modificación en la telemetría para añadir velocidad y frenos

This commit is contained in:
adrigongv23 2026-07-27 12:50:46 +02:00
parent c4ebde74f2
commit d3f2d1596e
3 changed files with 20 additions and 6 deletions

View file

@ -22,21 +22,27 @@ void TaskUdpSender(void *pvParameters){
float battActual = dataProcessor.current_vbatt_value;
float tpsActual = dataProcessor.current_tps_value;
int marchaActual = dataProcessor.current_marcha_value;
float frenoDelActual = dataProcessor.current_freno_del_value; // freno delantero (instalado)
float pcombActual = dataProcessor.current_pcomb_value;
float taceiteActual = dataProcessor.current_taceite_value;
float paceiteActual = dataProcessor.current_paceite_value;
float mapActual = dataProcessor.current_map_value;
float lambdaActual = dataProcessor.current_lambda_value;
float lambdaObjActual = dataProcessor.current_lambda_obj_value;
// Pendientes de montar/configurar en el coche. Cuando se instalen, descomentar aquí
// y añadir su campo al snprintf; mientras no lleguen, el monitor los muestra como "--".
//float velocidadActual = dataProcessor.current_velocidad_value;
//float frenoTraActual = dataProcessor.current_freno_tra_value; // freno trasero
//Formato "clave=valor" separado por ';'
char mensaje[256];
snprintf(mensaje, sizeof(mensaje),
"ect=%d;rpm=%d;vbatt=%.2f;tps=%.1f;marcha=%d;"
"ect=%d;rpm=%d;vbatt=%.2f;tps=%.1f;freno_del=%.1f;"
"pcomb=%.2f;taceite=%.1f;paceite=%.2f;map=%.1f;lambda=%.3f;lambda_obj=%.3f",
tempActual, rpmActual, battActual, tpsActual, marchaActual,
tempActual, rpmActual, battActual, tpsActual, frenoDelActual,
pcombActual, taceiteActual, paceiteActual, mapActual, lambdaActual, lambdaObjActual);
// Al añadir los pendientes: sumar ";velocidad=%.0f;freno_tra=%.1f" al formato
// y velocidadActual, frenoTraActual al final de los argumentos.
//Enviamos el paquete por broadcast a toda la red local (no hace falta conocer la IP del portátil)
udp.beginPacket(IPAddress(255,255,255,255), UDP_PORT);

View file

@ -17,7 +17,7 @@ public:
volatile float current_vbatt_value = 0.0;
volatile float current_tps_value = 0.0;
//volatile int current_marcha_value = 0;
volatile float current_freno_del_value = 0.0; // presion freno delantero, bar (instalado)
volatile float current_pcomb_value = 0.0; // bar
volatile float current_taceite_value = 0.0; // grados C
volatile float current_paceite_value = 0.0; // bar
@ -25,6 +25,9 @@ public:
volatile float current_lambda_value = 0.0;
volatile float current_lambda_obj_value = 0.0;
// Pendientes de montar/configurar en el coche
volatile float current_freno_tra_value = 0.0; // presion freno trasero, bar
volatile float current_velocidad_value = 0.0; // km/h
//Métodos de recepción de CAN

View file

@ -49,15 +49,20 @@ void DataProcessor::send_serial_frame_1(int lmbh, int lmbl, int lmbth, int lmbtl
}
void DataProcessor::send_serial_frame_2(int shut, int fan, int lmbch, int lmbcl, int brakeh, int brakel, int aux1){
float freno = (brakeh * 256) + brakel;
//Serial.printf("TRAMA: 2\n");
//Serial.printf("FRENO: %f\n", freno);
this->current_freno_del_value = freno;
}
void DataProcessor::send_serial_frame_3(int aux3, int aux4, int aux5, int aux6, int aux7, int aux8, int dig1){
void DataProcessor::send_serial_frame_3(int oilth, int oiltl, int oilph, int oilpl, int maph, int mapl, int dig1){
float tempOil = ((oilth * 256) + oiltl) / 100.0;
float presionOil = ((oilph * 256) + oilpl) / 100.0;
float map = ((maph * 256) + mapl) / 100.0;
//Serial.printf("TRAMA: 2\n");
//Serial.printf("TRAMA: 3\n");
//Serial.printf("TEMP OIL: %f | PRESION OIL: %f | MAP: %f\n", tempOil, presionOil, map);
this->current_taceite_value = tempOil;