diff --git a/lambda-test/command-test.c b/lambda-test/command-test.c index 74c01ca..7089aa4 100644 --- a/lambda-test/command-test.c +++ b/lambda-test/command-test.c @@ -27,7 +27,7 @@ runCommand("se"); assertTrue(isSimulation()); assertTrue(getTime() == 0); - assertTrue(isHeaterOn()); + assertTrue(bit_is_set(PORTB, PB2)); runCommand("sd"); assertFalse(isSimulation()); assertTrue(getTime() == 0); @@ -50,11 +50,11 @@ setupPorts(); setHeaterState(heaterStateOff); - assertFalse(isHeaterOn()); + assertFalse(bit_is_set(PORTB, PB2)); runCommand("he"); - assertTrue(isHeaterOn()); + assertTrue(bit_is_set(PORTB, PB2)); runCommand("hd"); - assertFalse(isHeaterOn()); + assertFalse(bit_is_set(PORTB, PB2)); return true; } diff --git a/lambda-test/rules-test.c b/lambda-test/rules-test.c index b58a7aa..e35d79a 100644 --- a/lambda-test/rules-test.c +++ b/lambda-test/rules-test.c @@ -17,7 +17,7 @@ /* Module rules */ extern uint8_t measCount; -extern int8_t dir; +extern int8_t state; extern uint8_t airgate; extern Rule rules[]; @@ -25,26 +25,18 @@ Measurement meas = {0, 0, 0, 0}; - // prevent rule warmStart from kicking in - setHeaterState(heaterStateOn); - resetRules(true); - dir = burning_down; + state = burning_down; reason(meas); assertFalse(rules[0].fired); resetRules(true); - dir = none; + state = undefined; reason(meas); assertFalse(rules[0].fired); resetRules(true); - dir = firing_up; - reason(meas); - assertFalse(rules[0].fired); - - resetRules(true); - dir = burning; + state = firing_up; reason(meas); assertFalse(rules[0].fired); @@ -52,30 +44,30 @@ meas.lambda = LAMBDA_TOO_LEAN; resetRules(true); - dir = burning_down; + state = burning_down; reason(meas); assertFalse(rules[0].fired); resetRules(true); - dir = none; + state = undefined; reason(meas); assertFalse(rules[0].fired); resetRules(true); - dir = firing_up; + state = firing_up; reason(meas); assertTrue(rules[0].fired); assertTrue(50 == airgate); // should not fire if airgate == 50 resetRules(false); - dir = firing_up; + state = firing_up; reason(meas); assertFalse(rules[0].fired); assertTrue(50 == airgate); resetRules(true); - dir = burning; + // state = burning; reason(meas); assertTrue(rules[0].fired); assertTrue(50 == airgate); @@ -90,22 +82,17 @@ Measurement meas = {999, 0, 0, 0}; resetRules(true); - dir = firing_up; + state = firing_up; reason(meas); assertFalse(rules[1].fired); resetRules(true); - dir = none; + state = undefined; reason(meas); assertFalse(rules[1].fired); resetRules(true); - dir = burning_down; - reason(meas); - assertFalse(rules[1].fired); - - resetRules(true); - dir = burning; + state = burning_down; reason(meas); assertFalse(rules[1].fired); @@ -113,22 +100,17 @@ meas.lambda = LAMBDA_TOO_LEAN; resetRules(true); - dir = firing_up; + state = firing_up; reason(meas); assertFalse(rules[1].fired); resetRules(true); - dir = none; + state = undefined; reason(meas); assertFalse(rules[1].fired); resetRules(true); - dir = burning; - reason(meas); - assertFalse(rules[1].fired); - - resetRules(true); - dir = burning_down; + state = burning_down; reason(meas); assertTrue(rules[1].fired); assertTrue(25 == airgate); @@ -143,22 +125,17 @@ Measurement meas = {999, 0, 0, 0}; resetRules(true); - dir = firing_up; + state = firing_up; reason(meas); assertFalse(rules[2].fired); resetRules(true); - dir = none; + state = undefined; reason(meas); assertFalse(rules[2].fired); resetRules(true); - dir = burning_down; - reason(meas); - assertFalse(rules[2].fired); - - resetRules(true); - dir = burning; + state = burning_down; reason(meas); assertFalse(rules[2].fired); @@ -166,22 +143,17 @@ meas.lambda = LAMBDA_MAX; resetRules(true); - dir = firing_up; + state = firing_up; reason(meas); assertFalse(rules[2].fired); resetRules(true); - dir = none; + state = undefined; reason(meas); assertFalse(rules[2].fired); resetRules(true); - dir = burning; - reason(meas); - assertFalse(rules[2].fired); - - resetRules(true); - dir = burning_down; + state = burning_down; reason(meas); assertTrue(rules[2].fired); assertTrue(0 == airgate); @@ -194,7 +166,6 @@ static bool testTooRich(void) { Measurement meas = {0, 0, 0, 0}; - dir = none; setHeaterState(heaterStateReady); @@ -240,7 +211,6 @@ static bool testTooLean(void) { Measurement meas = {0, 0, 0, 0}; - dir = none; setHeaterState(heaterStateReady); @@ -282,7 +252,7 @@ Measurement meas = {0, 0, 0, 0}; resetRules(true); - dir = firing_up; + state = firing_up; meas.tempI = 50; measCount = 10; @@ -328,7 +298,7 @@ resetRules(true); setHeaterState(heaterStateOff); - dir = firing_up; + state = firing_up; reason(meas); assertTrue(100 == airgate); assertTrue(heaterStateOn == getHeaterState()); @@ -370,7 +340,7 @@ resetRules(true); resetTime(); Measurement meas = {0, 0, 0, 0}; - dir = firing_up; + state = firing_up; setHeaterState(heaterStateOn); meas.current = 0; @@ -387,7 +357,7 @@ resetRules(true); resetTime(); Measurement meas = {0, 0, 0, 0}; - dir = firing_up; + state = firing_up; setHeaterState(heaterStateOn); meas.current = 8000; @@ -404,7 +374,7 @@ resetRules(true); resetTime(); Measurement meas = {0, 0, 0, 0}; - dir = firing_up; + state = firing_up; setHeaterState(heaterStateOn); diff --git a/lambda-test/sensors-test.c b/lambda-test/sensors-test.c index 40f6e98..a534a14 100644 --- a/lambda-test/sensors-test.c +++ b/lambda-test/sensors-test.c @@ -185,24 +185,18 @@ return ! strcmp(info, MSG_RICH); } -static bool testSetHeaterOn(void) { +static bool testSetHeaterState(void) { setHeaterState(heaterStateOn); - assertTrue(isHeaterOn()); + assertTrue(bit_is_set(PORTB, PB2)); assertTrue(heaterStateOn == getHeaterState()); setHeaterState(heaterStateOff); - assertFalse(isHeaterOn()); + assertFalse(bit_is_set(PORTB, PB2)); assertTrue(heaterStateOff == getHeaterState()); - return true; -} - -static bool testSetHeaterState(void) { - setHeaterState(heaterStateOff); - assertFalse(isHeaterOn()); - assertTrue(heaterStateOff == getHeaterState()); - + setHeaterState(heaterStateOn); setHeaterState(heaterStateFault); + assertFalse(bit_is_set(PORTB, PB2)); assertTrue(heaterStateFault == getHeaterState()); return true; @@ -244,7 +238,6 @@ static const char testToInfoOkay_P[] PROGMEM = "testToInfoOkay"; static const char testToInfoIdeal_P[] PROGMEM = "testToInfoIdeal"; static const char testToInfoRich_P[] PROGMEM = "testToInfoRich"; -static const char testSetHeaterOn_P[] PROGMEM = "testSetHeaterOn"; static const char testSetHeaterState_P[] PROGMEM = "testSetHeaterState"; static const char testGetHeaterUptime_P[] PROGMEM = "testGetHeaterUptime"; @@ -270,7 +263,6 @@ {class, testToInfoOkay_P, testToInfoOkay}, {class, testToInfoIdeal_P, testToInfoIdeal}, {class, testToInfoRich_P, testToInfoRich}, - {class, testSetHeaterOn_P, testSetHeaterOn}, {class, testSetHeaterState_P, testSetHeaterState}, {class, testGetHeaterUptime_P, testGetHeaterUptime} }; diff --git a/lambda/Makefile b/lambda/Makefile index 0630869..4dd53cb 100644 --- a/lambda/Makefile +++ b/lambda/Makefile @@ -3,7 +3,7 @@ MCU = atmega328p # Currently supported are 1 MHz and 8 MHz -F_CPU = 8000000 +F_CPU = 1000000 # Also try BAUD = 19200 or 38400 if you're feeling lucky. BAUD = 9600 diff --git a/lambda/display.c b/lambda/display.c index 3f032c8..c782d54 100644 --- a/lambda/display.c +++ b/lambda/display.c @@ -134,9 +134,9 @@ displayTime(); } else { char* hint; - switch (getDir()) { + switch (getState()) { case firing_up: hint = " >"; break; - case burning: hint = " ^"; break; + // case burning: hint = " ^"; break; case burning_down: hint = " <"; break; default: hint = " -"; break; } diff --git a/lambda/rules.c b/lambda/rules.c index d6c8ce0..cd244b3 100644 --- a/lambda/rules.c +++ b/lambda/rules.c @@ -15,38 +15,47 @@ #include "usart.h" -FireDir dir = none; +uint8_t measCount = MEAS_INT; +FireState state = undefined; uint8_t airgate = 100; -uint8_t measCount = 10; -static int32_t tempIAvg = 0; -static int16_t tempIMax = 0; +static int32_t deltaAvg = 0; +static int16_t tempIMax = TEMP_INIT; static int16_t tempIOldQueue[QUEUE_SIZE]; /** - * Pushes the given new value in the given fixed-size queue of old temperature - * measurements and returns the oldest value being pushed off the queue. + * Pushes the given new value in the queue of old temperature measurements + * and returns the oldest value being pushed off the array. */ -static int16_t push(int16_t queue[], const size_t size, const int16_t value) { - int16_t last = queue[size - 1]; - for (size_t i = size - 1; i > 0; i--) { - queue[i] = queue[i - 1]; +static int16_t pushQueue(const int16_t value) { + int16_t last = tempIOldQueue[QUEUE_SIZE - 1]; + for (size_t i = QUEUE_SIZE - 1; i > 0; i--) { + tempIOldQueue[i] = tempIOldQueue[i - 1]; } - queue[0] = value; + tempIOldQueue[0] = value; return last; } /** + * Initializes all elements in the queue of old temperature measurements + * to the given value. + */ +static void initQueue(const int16_t value) { + for (size_t i = 0; i < QUEUE_SIZE; i++) { + tempIOldQueue[i] = value; + } +} + +/** * Reminds to set the air gate to 50% when the fire is still firing up * and the temperature has reached TEMP_AIRGATE_50. */ -static void airgate50(bool* const fired, int8_t const dir, - Measurement const meas) { - if ((dir == firing_up || dir == burning) && - meas.tempI >= TEMP_AIRGATE_50 && meas.lambda >= LAMBDA_TOO_LEAN && +static void airgate50(bool* const fired, Measurement const meas) { + if ((state == firing_up) && + meas.tempI >= TEMP_AIRGATE_50 && + meas.lambda >= LAMBDA_TOO_LEAN && airgate != 50) { - airgate = 50; alert_P(BEEPS, LENGTH, TONE, PSTR(MSG_AIRGATE_50_0), PSTR(""), false); *fired = true; @@ -57,9 +66,9 @@ * Reminds to set the air gate to 25% when the fire is burning down and the * temperature went below TEMP_AIRGATE_25. */ -static void airgate25(bool* const fired, int8_t const dir, - Measurement const meas) { - if (dir == burning_down && meas.tempI < TEMP_AIRGATE_25 && +static void airgate25(bool* const fired, Measurement const meas) { + if (state == burning_down && + meas.tempI < TEMP_AIRGATE_25 && meas.lambda >= LAMBDA_TOO_LEAN && airgate > 25) { airgate = 25; alert_P(BEEPS, LENGTH, TONE, PSTR(MSG_AIRGATE_25_0), PSTR(""), false); @@ -71,9 +80,8 @@ * Reminds to close the air gate when the fire is burning down and the * temperature went below TEMP_AIRGATE_0 (no more flames). */ -static void airgateClose(bool* const fired, int8_t const dir, - Measurement const meas) { - if (dir == burning_down && meas.tempI < TEMP_AIRGATE_0 && +static void airgateClose(bool* const fired, Measurement const meas) { + if (state == burning_down && meas.tempI < TEMP_AIRGATE_0 && meas.lambda >= LAMBDA_MAX && airgate > 0) { setHeaterState(heaterStateOff); airgate = 0; @@ -91,10 +99,8 @@ * exhaust gas going into the chimney rises, more heat appears to be thrown * out of the chimney. */ -static void tooRich(bool* const fired, int8_t const dir, - Measurement const meas) { - if (meas.tempI > TEMP_FIRE_OUT && - meas.lambda < LAMBDA_TOO_RICH && +static void tooRich(bool* const fired, Measurement const meas) { + if (meas.tempI > TEMP_FIRE_OUT && meas.lambda < LAMBDA_TOO_RICH && getHeaterState() == heaterStateReady && airgate < 50) { airgate = 50; alert_P(BEEPS, LENGTH, TONE, PSTR(MSG_AIRGATE_50_0), PSTR(""), false); @@ -106,10 +112,8 @@ * Notifies that the combustion is lean (again) and suggests to set the air * gate to 50%. */ -static void tooLean(bool* const fired, int8_t const dir, - Measurement const meas) { - if (meas.tempI > TEMP_AIRGATE_50 && - meas.lambda > LAMBDA_TOO_LEAN && +static void tooLean(bool* const fired, Measurement const meas) { + if (meas.tempI > TEMP_AIRGATE_50 && meas.lambda > LAMBDA_TOO_LEAN && getHeaterState() == heaterStateReady && airgate > 50) { airgate = 50; alert_P(BEEPS, LENGTH, TONE, PSTR(MSG_AIRGATE_50_0), PSTR(""), false); @@ -120,10 +124,10 @@ /** * Notifies that the fire might have gone out at the beginning of firing up. */ -static void fireOut(bool* const fired, int8_t const dir, - Measurement const meas) { - if (! *fired && dir == firing_up && meas.tempI < TEMP_FIRE_OUT && - tempIMax - meas.tempI > (TEMP_FIRE_OUT_RESET - TEMP_FIRE_OUT)) { +static void fireOut(bool* const fired, Measurement const meas) { + if (! *fired && meas.tempI < TEMP_FIRE_OUT && + tempIMax < TEMP_AIRGATE_50 && + tempIMax >= TEMP_FIRE_OUT_RESET) { alert_P(BEEPS, LENGTH, TONE, PSTR(MSG_FIRE_OUT_0), PSTR(""), false); *fired = true; } @@ -136,26 +140,29 @@ * Resets rules and some state and switches on the heating if it seems that * wood was added or the oven was fired up without resetting. * TODO make a complete reset including time? - * TODO come up with something better than using the state of the heater */ -static void warmStart(bool* const fired, int8_t const dir, - Measurement const meas) { - if (meas.tempI > TEMP_FIRE_OUT && (dir == firing_up || dir == burning) && - ! isHeaterOn() && (getHeaterState() != heaterStateFault)) { +static void warmStart(bool* const fired, Measurement const meas) { + if (! *fired && (state == firing_up) && + meas.tempI > TEMP_FIRE_OUT && tempIMax >= TEMP_AIRGATE_50) { resetRules(false); airgate = 100; tempIMax = meas.tempI; - setHeaterState(heaterStateOn); + if (getHeaterState() != heaterStateFault) { + setHeaterState(heaterStateOn); + } *fired = true; } + if (state == burning_down && meas.tempI < TEMP_AIRGATE_0) { + *fired = false; + } } /** * Notifies that the heater is ready and sets the corresponding state. */ -static void heaterReady(bool* const fired, int8_t const dir, - Measurement const meas) { - if (! isHeaterOn() || getHeaterState() == heaterStateReady) { +static void heaterReady(bool* const fired, Measurement const meas) { + if (getHeaterState() == heaterStateOff || + getHeaterState() == heaterStateReady) { return; } if (meas.current <= milliAmpsReady && meas.current > milliAmpsDisconn) { @@ -169,9 +176,9 @@ * Notifies that the heater or its connection is faulty and sets the * corresponding state. */ -static void heaterFault(bool* const fired, int8_t const dir, - Measurement const meas) { - if (! isHeaterOn() || getHeaterState() == heaterStateFault) { +static void heaterFault(bool* const fired, Measurement const meas) { + if (getHeaterState() == heaterStateOff || + getHeaterState() == heaterStateFault) { return; } if (meas.current > milliAmpsShort || meas.current < milliAmpsDisconn || @@ -187,9 +194,9 @@ * Switches the heater off if it is on for 30 mins or more and there does * not seem to be a fire, and notifies that the fire is out. */ -static void heaterTimeout(bool* const fired, int8_t const dir, - Measurement const meas) { - if (! isHeaterOn() || getHeaterState() == heaterStateFault) { +static void heaterTimeout(bool* const fired, Measurement const meas) { + if (getHeaterState() == heaterStateOff || + getHeaterState() == heaterStateFault) { return; } uint32_t heaterUptime = getHeaterUptime(); @@ -230,54 +237,47 @@ {false, tooRich}, {false, tooLean}, {false, fireOut}, - {false, warmStart} + {true, warmStart} }; -int8_t getDir(void) { - return dir; +int8_t getState(void) { + return state; } // called about every second -void reason(Measurement const meas) { +void reason(Measurement meas) { - // rules applied to each measurement + // rules applied at each measurement size_t heaterRulesSize = sizeof(heaterRules) / sizeof(heaterRules[0]); for (size_t i = 0; i < heaterRulesSize; i++) { - heaterRules[i].cond(&(heaterRules[i].fired), dir, meas); + heaterRules[i].cond(&(heaterRules[i].fired), meas); } - // rules applied to every 10th measurement - if (measCount == 10) { + // evaluation of the fire state and rules applied + // at every MEAS_INT'th measurement + if (measCount == MEAS_INT) { measCount = 0; size_t rulesSize = sizeof(rules) / sizeof(rules[0]); for (size_t i = 0; i < rulesSize; i++) { - rules[i].cond(&(rules[i].fired), dir, meas); + rules[i].cond(&(rules[i].fired), meas); } - tempIAvg = meas.tempI + tempIAvg - ((tempIAvg - 4) >> 3); - int16_t tempICur = tempIAvg >> 3; - int16_t tempIOld = push(tempIOldQueue, QUEUE_SIZE, tempICur); + // difference between current and previous temperature + int16_t tempIOld = pushQueue(meas.tempI); + int16_t delta = meas.tempI - tempIOld; - // simply skip if old temperature was 0°C - in practice it never goes - // below 3°C anyway. - if (tempIOld > 0) { - // try to figure out if the fire is building up, burning or burning - // down by comparing the current temperature value with one that is - // 3 minutes old - dir = none; - if ((tempICur - tempIOld) >= TEMP_DELTA_UP && - tempICur < TEMP_MIN && meas.lambda >= LAMBDA_BURNING) { - dir = firing_up; - } - if (tempICur >= TEMP_MIN || meas.lambda < LAMBDA_BURNING) { - dir = burning; - } - if ((tempIOld - tempICur) >= TEMP_DELTA_DOWN && - tempICur < TEMP_MIN && meas.lambda >= LAMBDA_BURNING && - tempIMax >= TEMP_AIRGATE_50) { - dir = burning_down; - } + // extra smoothing of the temperature difference + deltaAvg = delta + deltaAvg - (deltaAvg >> TEMP_DELTA_SMOOTH); + int16_t deltaSmooth = deltaAvg >> TEMP_DELTA_SMOOTH; + + // try to figure out if the fire is firing up or burning down + state = undefined; + if (deltaSmooth >= TEMP_DELTA_UP) { + state = firing_up; + } + if (deltaSmooth <= TEMP_DELTA_DOWN && tempIMax >= TEMP_AIRGATE_50) { + state = burning_down; } } @@ -285,14 +285,13 @@ tempIMax = MAX(tempIMax, meas.tempI); } -void resetRules(bool const state) { - if (state) { - tempIMax = 0; - measCount = 10; - for (size_t i = 0; i < QUEUE_SIZE; i++) { - tempIOldQueue[i] = 0; - } - dir = none; +void resetRules(bool const intState) { + if (intState) { + deltaAvg = 0; + tempIMax = TEMP_INIT; + initQueue(TEMP_INIT); + measCount = MEAS_INT; + state = undefined; airgate = 100; } @@ -300,6 +299,7 @@ for (size_t i = 0; i < rulesSize; i++) { rules[i].fired = false; } + rules[6].fired = true; size_t heaterRulesSize = sizeof(heaterRules) / sizeof(heaterRules[0]); for (size_t i = 0; i < heaterRulesSize; i++) { diff --git a/lambda/rules.h b/lambda/rules.h index 10f43e3..3f97b01 100644 --- a/lambda/rules.h +++ b/lambda/rules.h @@ -11,33 +11,40 @@ #include #include "sensors.h" -#define BEEPS 20 +#define BEEPS 10 #define LENGTH 10 #define TONE 31 -/** Exhaust reaches at least this temperature when the fire is burning */ -#define TEMP_MIN 700 -/** Min. increase in temperature during AGE_TEMPI_OLD when firing up */ +/** Some rules and the fire state is evaluated every so many measurements */ +#define MEAS_INT 10 +/** + * Last 18 firebox temperature values updated every MEAS_INT measurements + * (i.e. 18 * 10 = 3 minutes @ one measurement per second) + */ +#define QUEUE_SIZE 18 +/** Initial temperature value */ +#define TEMP_INIT 20 +/** Smoothing of the temperature difference used to determine the fire state */ +#define TEMP_DELTA_SMOOTH 6 +/** Min. increase in temp. during QUEUE_SIZE * MEAS_INT when firing up */ #define TEMP_DELTA_UP 10 -/** Min. decrease in temperature during AGE_TEMPI_OLD when burning down */ -#define TEMP_DELTA_DOWN 1 -/** Min. temperature at which to set the air gate to 50% when firing up */ +/** Min. decrease in temp. during QUEUE_SIZE * MEAS_INT when burning down */ +#define TEMP_DELTA_DOWN -3 +/** Temperature at which to set the air gate to 50% when firing up */ #define TEMP_AIRGATE_50 500 -/** Max. temperature at which to set the air gate to 25% when burning down */ +/** Temperature at which to set the air gate to 25% when burning down */ #define TEMP_AIRGATE_25 700 /** * Max. temperature at which to set the air gate to 0% and to switch off the * oxygen sensor heater when burning down */ #define TEMP_AIRGATE_0 450 -/** Max. temperature at which to consider the fire to have gone out */ +/** Temperature at which to consider the fire to have gone out */ #define TEMP_FIRE_OUT 100 /** Min. temperature at which to consider the fire to fire up again */ -#define TEMP_FIRE_OUT_RESET 125 +#define TEMP_FIRE_OUT_RESET 110 /** Max. lambda value that can be measured */ #define LAMBDA_MAX 2000 -/** Fire is considered fully burning if lambda is below this value */ -#define LAMBDA_BURNING 1900 /** Combustion is considered too rich if lambda is below this value */ #define LAMBDA_TOO_RICH 1100 /** @@ -46,29 +53,26 @@ */ #define LAMBDA_TOO_LEAN 1400 -/** Last 18 firebox temperature values updated every 10 seconds = 3 minutes */ -#define QUEUE_SIZE 18 - typedef enum { - none = 0, + undefined = 0, firing_up = 1, - burning = 2, + // burning = 2, burning_down = -1 -} FireDir; +} FireState; /** * An attempt to create some sort of rule "object". */ typedef struct { bool fired; - void (*cond)(bool* fired, int8_t dir, Measurement meas); + void (*cond)(bool* fired, Measurement meas); } Rule; /** - * Returns the "direction" of the fire, i.e. DIR_BURN_DOWN when it is burning + * Returns the current state of the fire, i.e. burning_down when it is burning * down. */ -int8_t getDir(void); +int8_t getState(void); /** * Applies all rules against the given measurements. diff --git a/lambda/sensors.c b/lambda/sensors.c index 183c2d3..501007a 100644 --- a/lambda/sensors.c +++ b/lambda/sensors.c @@ -192,12 +192,7 @@ } } -// TODO merge with getHeaterState() -bool isHeaterOn(void) { - return bit_is_set(PORTB, PB2); -} - -void setHeaterState(int8_t const state) { +void setHeaterState(HeaterState const state) { if (state == heaterStateOn) { PORTB |= (1 << PB2); heaterOnTime = getTime(); @@ -208,7 +203,8 @@ heaterState = state; } -int8_t getHeaterState(void) { +HeaterState getHeaterState(void) { + // bit_is_set(PORTB, PB2) return heaterState; } diff --git a/lambda/sensors.h b/lambda/sensors.h index c93ce3f..39e5829 100644 --- a/lambda/sensors.h +++ b/lambda/sensors.h @@ -19,9 +19,9 @@ * Oxygen sensor heater current limits at certain states in milliamps. */ typedef enum { + milliAmpsDisconn = 100, milliAmpsReady = 1350, - milliAmpsShort = 7500, - milliAmpsDisconn = 100 + milliAmpsShort = 7500 } HeaterMilliAmps; /** @@ -116,12 +116,6 @@ char* toInfo(uint16_t lambda); /** - * Returns true if the heater of the oxygen sensor is turned on, - * false otherwise. - */ -bool isHeaterOn(void); - -/** * Sets the state of the heater of the oxygen sensor to the given value. */ void setHeaterState(int8_t state);