Limpieza y datalogging SD

Se han eliminado todos los componentes del data_processor que no iban a ser usados y se ha comenzado a guardar en la SD algunos datos (por ahora, solo tiempo y temperatura. Los demas datos son procesados, pero aun no guardados)
This commit is contained in:
Alejandro Guerrero 2025-12-04 12:55:35 +01:00
parent 7f90889a4a
commit 2cbffe21e2
5 changed files with 85 additions and 219 deletions

View file

@ -1,38 +1,33 @@
#ifndef DATAPROCESSOR_HPP
#define DATAPROCESSOR_HPP
#include "common/common_libraries.hpp"
#include "common/display_id.hpp"
#include "led_strip.hpp"
#include "crowpanel_controller.hpp"
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include <Arduino.h>
#include "SdFat.h"
#include <vector>
class DataProcessor {
public:
DataProcessor() = default;
char* process(std::vector<float> data);
void send_serial(byte type, unsigned int value);
void send_serial_frame_0(int rpmh, int rpml, int tpsh, int tpsl, int ecth, int ectl, int gear);
void send_serial_frame_1(int lfws, int rfws, int lrws, int rrws, int maph, int mapl, int ect);
void send_serial_frame_2(int lambh, int lambl, int lamth, int lamtl, int bvolth, int bvoltl, int iat);
void send_serial_frame_3(int aux1, int aux2, int aux3, int aux4, int aux5, int aux6, int aux7);
void send_serial_frame_4(int aux1, int aux2, int aux3, int aux4, int aux5, int aux6, int aux7);
void send_serial_change_display(int display);
void send_serial_screen_test(int test);
void set_led_strip(LedStrip *led_strip){
_led_strip = led_strip;
}
void set_crow_panel_controller(CrowPanelController *crow_panel_controller) {
_crow_panel_controller = crow_panel_controller;
// Configuración SD
void setLogSystem(SdFat* sd_inst, SdFile* file_inst) {
_sd = sd_inst;
_logFile = file_inst;
}
void send_serial_frame_0(int rpmh, int rpml, int tpsh, int tpsl, int vbatth, int vbattl, int ect);
void send_serial_frame_1(int lmbh, int lmbl, int lmbth, int lmbtl, int fuelh, int fuell, int gear);
void send_serial_frame_2(int shut, int fan, int lmbch, int lmbcl, int brakeh, int brakel, int aux1);
void send_serial_frame_3(int aux3, int aux4, int aux5, int aux6, int aux7, int aux8, int dig1);
void send_serial_frame_4(int dig3, int dig4, int dig5, int dig6, int dig7, int dig8, int dig9);
private:
LedStrip *_led_strip;
CrowPanelController *_crow_panel_controller;
int current_display=0;
bool change_screen_requested=false;
SdFat* _sd;
SdFile* _logFile;
CarState car;
void flushToSD(); // Guardado físico
};
#endif