/*
 * fuel_map.h
 *
 *  Created on: Oct 18, 2024
 *      Author: herli
 */

#ifndef FUEL_MAP_H_
#define FUEL_MAP_H_
#include <id.h>
#include <stdint.h>

//extern float PHIAD_TEIN;
// Function declarations
extern void init_FuelMap(float* PHIAD);

float GetAlpha(float RPM, float ME, float Tein, float Temp);
float GetBeta(float RPM, float Tein);

float FM_GET_PHIAD(float RPM, float ME, float Temp);

struct AlphaStruct {
    //float ME_RPM_Beta_array[N_ME][N_RPM];
    float ME_RPM_Beta_array[FM_N_RPM][FM_N_ME]; //para la transpuesta
};
extern struct AlphaStruct fuelmap_m12;
//extern struct AlphaStruct fuelmap_m5;
extern struct AlphaStruct fuelmap_10;
extern struct AlphaStruct fuelmap_25;
extern struct AlphaStruct fuelmap_60;
extern struct AlphaStruct fuelmap_80;
extern struct fuelMapIndexes fuelMapI;

static const struct AlphaStruct* g_FuelMaps[] = {
    &fuelmap_m12,
    //&fuelmap_m5,
	&fuelmap_10,
	&fuelmap_25,
	&fuelmap_60,
	&fuelmap_80

    // add/remove as needed; order must match fuelMapI.T_Index_array
};

struct fuelMapIndexes {
    float RPM_Index_array[FM_N_RPM];
    float ME_Index_array[FM_N_ME];
    float T_Index_array[FM_N_T];
};

// Declare the lookup table
//extern struct AlphaStruct fuelmap;

extern float BoostMultiplier(uint8_t mode, float RPM, float ME);

#endif /* FUEL_MAP2_H_ */
