Assorted todos (#2762)
* gpiochip todos * fuel computer * this was already done
This commit is contained in:
parent
ec8e1eee69
commit
526f1f97a0
|
@ -21,7 +21,6 @@ mass_t FuelComputerBase::getCycleFuel(mass_t airmass, int rpm, float load) const
|
|||
FuelComputer::FuelComputer(const ValueProvider3D& lambdaTable) : m_lambdaTable(&lambdaTable) {}
|
||||
|
||||
float FuelComputer::getStoichiometricRatio() const {
|
||||
// TODO: vary this with ethanol content/configured setting/whatever
|
||||
float primary = (float)CONFIG(stoichRatioPrimary) / PACK_MULT_AFR_CFG;
|
||||
|
||||
// Config compatibility: this field may be zero on ECUs with old defaults
|
||||
|
|
|
@ -20,8 +20,8 @@ constexpr float convertToGramsPerSecond(float ccPerMinute) {
|
|||
expected<float> InjectorModel::getAbsoluteRailPressure() const {
|
||||
switch (CONFIG(injectorCompensationMode)) {
|
||||
case ICM_FixedRailPressure:
|
||||
// TODO: should this add baro pressure instead of 1atm?
|
||||
return (CONFIG(fuelReferencePressure) + 101.325f);
|
||||
// Add barometric pressure, as "fixed" really means "fixed pressure above atmosphere"
|
||||
return CONFIG(fuelReferencePressure) + Sensor::get(SensorType::BarometricPressure).value_or(101.325f);
|
||||
case ICM_SensedRailPressure:
|
||||
if (!Sensor::hasSensor(SensorType::FuelPressureInjector)) {
|
||||
firmwareError(OBD_PCM_Processor_Fault, "Fuel pressure compensation is set to use a pressure sensor, but none is configured.");
|
||||
|
|
|
@ -133,8 +133,6 @@ static int mc33972_spi_w(mc33972_priv *chip, uint32_t tx)
|
|||
/* Slave Select assertion. */
|
||||
spiSelect(spi);
|
||||
/* Atomic transfer operations. */
|
||||
/* TODO: check why spiExchange transfers invalid data on STM32F7xx, DMA issue? */
|
||||
//spiExchange(spi, 3, txb, rxb);
|
||||
for (i = 0; i < 3; i++)
|
||||
rxb[i] = spiPolledExchange(spi, txb[i]);
|
||||
/* Slave Select de-assertion. */
|
||||
|
@ -156,15 +154,7 @@ static int mc33972_spi_w(mc33972_priv *chip, uint32_t tx)
|
|||
|
||||
static int mc33972_update_status(mc33972_priv *chip)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* TODO: lock? */
|
||||
|
||||
ret = mc33972_spi_w(chip, CMD_STATUS);
|
||||
|
||||
/* TODO: unlock? */
|
||||
|
||||
return ret;
|
||||
return mc33972_spi_w(chip, CMD_STATUS);
|
||||
}
|
||||
|
||||
static int mc33972_update_pullups(mc33972_priv *chip)
|
||||
|
|
|
@ -137,8 +137,6 @@ static int tle6240_spi_rw(tle6240_priv *chip, uint16_t tx, uint16_t *rx)
|
|||
/* Slave Select assertion. */
|
||||
spiSelect(spi);
|
||||
/* Atomic transfer operations. */
|
||||
/* TODO: check why spiExchange transfers invalid data on STM32F7xx, DMA issue? */
|
||||
//spiExchange(spi, 2, &tx, &rxb);
|
||||
rxb = spiPolledExchange(spi, tx);
|
||||
/* Slave Select de-assertion. */
|
||||
spiUnselect(spi);
|
||||
|
@ -162,8 +160,6 @@ static int tle6240_update_output_and_diag(tle6240_priv *chip)
|
|||
int ret;
|
||||
uint16_t out_data;
|
||||
|
||||
/* TODO: lock? */
|
||||
|
||||
/* atomic */
|
||||
/* set value only for non-direct driven pins */
|
||||
out_data = chip->o_state & (~chip->o_direct_mask);
|
||||
|
@ -185,8 +181,6 @@ static int tle6240_update_output_and_diag(tle6240_priv *chip)
|
|||
chip->diag_8_reguested = true;
|
||||
}
|
||||
|
||||
/* TODO: unlock? */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -387,12 +381,15 @@ static int tle6240_writePad(void *data, unsigned int pin, int value)
|
|||
|
||||
chip = (tle6240_priv *)data;
|
||||
|
||||
/* TODO: lock */
|
||||
if (value)
|
||||
chip->o_state |= (1 << pin);
|
||||
else
|
||||
chip->o_state &= ~(1 << pin);
|
||||
/* TODO: unlock */
|
||||
{
|
||||
chibios_rt::CriticalSectionLocker csl;
|
||||
|
||||
if (value)
|
||||
chip->o_state |= (1 << pin);
|
||||
else
|
||||
chip->o_state &= ~(1 << pin);
|
||||
}
|
||||
|
||||
/* direct driven? */
|
||||
if (chip->o_direct_mask & (1 << pin)) {
|
||||
int n = (pin < 8) ? pin : (pin - 4);
|
||||
|
|
|
@ -427,8 +427,6 @@ static int tle8888_update_output(tle8888_priv *chip)
|
|||
int i;
|
||||
int ret;
|
||||
|
||||
/* TODO: lock? */
|
||||
|
||||
uint8_t briconfig0 = 0;
|
||||
|
||||
/* calculate briconfig0 */
|
||||
|
@ -466,8 +464,6 @@ static int tle8888_update_output(tle8888_priv *chip)
|
|||
};
|
||||
ret = tle8888_spi_rw_array(chip, tx, NULL, ARRAY_SIZE(tx));
|
||||
|
||||
/* TODO: unlock? */
|
||||
|
||||
if (ret == 0) {
|
||||
/* atomic */
|
||||
chip->o_data_cached = o_data;
|
||||
|
@ -499,9 +495,7 @@ static int tle8888_update_status_and_diag(tle8888_priv *chip)
|
|||
};
|
||||
uint16_t rx[ARRAY_SIZE(tx)];
|
||||
|
||||
/* TODO: lock? */
|
||||
ret = tle8888_spi_rw_array(chip, tx, rx, ARRAY_SIZE(tx));
|
||||
/* TODO: unlock? */
|
||||
|
||||
if (ret == 0) {
|
||||
/* the address and content of the selected register is transmitted with the
|
||||
|
@ -680,9 +674,8 @@ static int tle8888_chip_init(tle8888_priv *chip)
|
|||
/* enable outputs */
|
||||
CMD_OE_SET
|
||||
};
|
||||
/* TODO: lock? */
|
||||
|
||||
ret = tle8888_spi_rw_array(chip, tx, NULL, ARRAY_SIZE(tx));
|
||||
/* TODO: unlock? */
|
||||
|
||||
if (ret == 0) {
|
||||
const tle8888_config *cfg = chip->cfg;
|
||||
|
@ -940,13 +933,16 @@ static int tle8888_writePad(void *data, unsigned int pin, int value) {
|
|||
|
||||
tle8888_priv *chip = (tle8888_priv *)data;
|
||||
|
||||
/* TODO: lock */
|
||||
if (value) {
|
||||
chip->o_state |= (1 << pin);
|
||||
} else {
|
||||
chip->o_state &= ~(1 << pin);
|
||||
{
|
||||
chibios_rt::CriticalSectionLocker csl;
|
||||
|
||||
if (value) {
|
||||
chip->o_state |= (1 << pin);
|
||||
} else {
|
||||
chip->o_state &= ~(1 << pin);
|
||||
}
|
||||
}
|
||||
/* TODO: unlock */
|
||||
|
||||
/* direct driven? */
|
||||
if (chip->o_direct_mask & (1 << pin)) {
|
||||
return tle8888_update_direct_output(chip, pin, value);
|
||||
|
|
Loading…
Reference in New Issue