/* Curve: array of Y values + separate axis array */
/* A2L type: CURVE */
#define THROTTLE_CURVE_SIZE 16
/* Axis breakpoints (X values) — stored separately, also calibratable */
volatile uint8 throttle_axis[THROTTLE_CURVE_SIZE]
__attribute__((section(".cal_data"))) =
{0, 7, 13, 20, 27, 33, 40, 47, 53, 60, 67, 73, 80, 87, 93, 100};
/* Y values indexed by throttle_axis */
volatile uint16 throttle_torque[THROTTLE_CURVE_SIZE]
__attribute__((section(".cal_data"))) =
{0, 22, 50, 85, 125, 168, 212, 256, 292, 325, 352, 370, 385, 393, 398, 400};
/* ECU lookup (with linear interpolation between breakpoints) */
uint16 Get_TorqueDemand(uint8 throttle_pct) {
return Interp_1D(throttle_torque, throttle_axis, THROTTLE_CURVE_SIZE, throttle_pct);
}