setGasConfig method

void setGasConfig(
  1. HeaterProfile profile,
  2. int heaterTemperature,
  3. int heaterDuration
)

Sets the temperature profile, heaterDuration and the heaterTemperature of gas sensor.

  • Target heater profile, between 0 and 9
  • Target temperature in degrees celsius, between 200 and 400
  • Target duration in milliseconds, between 1 and 4032

Implementation

void setGasConfig(final HeaterProfile profile, final int heaterTemperature,
    final int heaterDuration) {
  if (_powerMode == PowerMode.forced) {
    // Select the heater profile
    setGasHeaterProfile(profile);

    // The index of the heater profile used
    // uint8_t gas_index;
    i2c.writeByteReg(
        i2cAddress,
        resistanceHeat0Address + profile.index,
        _calculateHeaterResistance(
            heaterTemperature, _ambientTemperature, _calibration));
    // uint16_t heatr_dur;
    i2c.writeByteReg(i2cAddress, gasWait0Address + profile.index,
        _calculateGasHeaterDuration(heaterDuration));

    // Bosch code only uses profile 0
    // dev->gas_sett.nb_conv = 0;
  }
}