2 byte table axis #3045

This commit is contained in:
rusefillc 2021-12-20 02:07:03 -05:00
parent 96fb4b4638
commit 47cde8801c
4 changed files with 6 additions and 6 deletions

View File

@ -793,8 +793,8 @@ void setHellen72etb() {
void setHellenDefaultVrThresholds() {
for (int i = 0;i<VR_THRESHOLD_COUNT;i++) {
setLinearCurve(engineConfiguration->vrThreshold[i].rpmBins, 600 / RPM_1_BYTE_PACKING_MULT, 7000 / RPM_1_BYTE_PACKING_MULT, 100 / RPM_1_BYTE_PACKING_MULT);
setLinearCurve(engineConfiguration->vrThreshold[i].values, PACK_PERCENT_BYTE_MULT * 0.6, PACK_PERCENT_BYTE_MULT * 1.2, PACK_PERCENT_BYTE_MULT * 0.1);
setLinearCurve(engineConfiguration->vrThreshold[i].rpmBins, 600, 7000, 100);
setLinearCurve(engineConfiguration->vrThreshold[i].values, 0.6, 1.2, 0.1);
}
}

View File

@ -12,7 +12,7 @@ static void updateVrPwm(int rpm, size_t index) {
return;
}
float thresholdVoltage = interpolate2d(rpm / RPM_1_BYTE_PACKING_MULT, cfg.rpmBins, cfg.values) / PACK_PERCENT_BYTE_MULT;
float thresholdVoltage = interpolate2d(rpm, cfg.rpmBins, cfg.values);
// 0v threshold voltage = 3.3v output from mcu = 100% duty
// 2.5v threshold voltage = 0v output from mcu = 0% duty

View File

@ -983,8 +983,8 @@ custom maf_sensor_type_e 4 bits, S32, @OFFSET@, [0:1], @@maf_sensor_type_e_enum@
struct vr_threshold_s
brain_pin_e pin;
uint8_t[3] pad;;"",1,0,0,0,0
uint8_t[6] rpmBins;;"rpm", {@@RPM_1_BYTE_PACKING_MULT@@}, 0, 0, 12000, 0
uint8_t[6] values;;"volts", {1/@@PACK_PERCENT_BYTE_MULT@@}, 0, 0, 2.5, 2
uint8_t[6] autoscale rpmBins;;"rpm", @@RPM_1_BYTE_PACKING_MULT@@, 0, 0, 12000, 0
uint8_t[6] autoscale values;;"volts", {1/@@PACK_PERCENT_BYTE_MULT@@}, 0, 0, 2.5, 2
end_struct
! todo: should be '3' since we are dreaming of Honda triple-channel distributor

View File

@ -11,7 +11,7 @@ TEST(sensors, vrThreshold) {
EngineTestHelper eth(HELLEN_128_MERCEDES_4_CYL);
auto& cfg = engineConfiguration->vrThreshold[0];
ASSERT_FLOAT_EQ(0.8 * PACK_PERCENT_BYTE_MULT, cfg.values[2]);
ASSERT_FLOAT_EQ(0.8, cfg.values[2]);
}
TEST(sensors, mapDecoding) {