interpret value from openLoopMap according to boostOpenLoopYAxis constant (fixes #4778)

This commit is contained in:
kifir 2024-05-15 19:03:39 +03:00 committed by rusefillc
parent 867fd3d746
commit f4b3b00d4d
2 changed files with 3 additions and 2 deletions

View File

@ -10,6 +10,7 @@
#include "boost_control.h"
#include "electronic_throttle.h"
#include "gppwm_channel_reader.h"
#define NO_PIN_PERIOD 500
@ -96,7 +97,7 @@ expected<percent_t> BoostController::getOpenLoop(float target) {
UNUSED(target);
float rpm = Sensor::getOrZero(SensorType::Rpm);
auto driverIntent = Sensor::get(SensorType::DriverThrottleIntent);
auto driverIntent = readGppwmChannel(engineConfiguration->boostOpenLoopYAxis);
isTpsInvalid = !driverIntent.Valid;

View File

@ -64,7 +64,7 @@ TEST(BoostControl, OpenLoop) {
bc.init(nullptr, &openMap, nullptr, nullptr);
// Should pass TPS value thru
Sensor::setMockValue(SensorType::DriverThrottleIntent, 47.0f);
Sensor::setMockValue(SensorType::Tps1, 47.0f);
EXPECT_FLOAT_EQ(bc.getOpenLoop(0).value_or(-1), 47.0f);
}