float getLEValue(Engine *engine, calc_stack_t *s, le_action_e action) { efiAssert(engine!=NULL, "getLEValue", NAN); switch (action) { case LE_METHOD_FAN: return getOutputPinValue(FAN_RELAY); case LE_METHOD_AC_TOGGLE: return getAcToggle(engine); case LE_METHOD_COOLANT: return getCoolantTemperature(engine); case LE_METHOD_INTAKE_AIR: return getIntakeAirTemperature(engine); case LE_METHOD_RPM: return engine->rpmCalculator.rpm(); case LE_METHOD_TIME_SINCE_BOOT: return getTimeNowSeconds(); case LE_METHOD_FAN_OFF_SETTING: return engine->engineConfiguration->fanOffTemperature; case LE_METHOD_FAN_ON_SETTING: return engine->engineConfiguration->fanOnTemperature; case LE_METHOD_VBATT: return getVBatt(engine->engineConfiguration); default: firmwareError("No value for %d", action); return NAN; } }
char * appendPinStatus(char *buffer, io_pin_e pin) { char *ptr = appendStr(buffer, getPinShortName(pin)); int state = getOutputPinValue(pin); // todo: should we handle INITIAL_PIN_STATE? if (state) { return appendStr(ptr, ":Y "); } else { return appendStr(ptr, ":n "); } }