auto-sync

This commit is contained in:
rusEfi 2015-04-26 11:09:43 -04:00
parent f39894f592
commit 74a1c2d9fe
5 changed files with 15 additions and 7 deletions

View File

@ -109,8 +109,7 @@ void Engine::init() {
static bool stopPin(NamedOutputPin *output) {
#if EFI_PROD_CODE || defined(__DOXYGEN__)
bool_t isInitialized = output->port != NULL;
if (isInitialized && output->getLogicValue()) {
if (output->isInitialized() && output->getLogicValue()) {
output->setValue(false);
scheduleMsg(&logger, "turning off %s", output->name);
return true;

View File

@ -237,7 +237,7 @@ static void setPinState(const char * msg, OutputPin *pin, LEElement *element, En
warning(OBD_PCM_Processor_Fault, "invalid expression for %s", msg);
} else {
int value = calc.getValue2(element, engine);
if (value != pin->getLogicValue()) {
if (pin->isInitialized() && value != pin->getLogicValue()) {
if (isRunningBenchTest())
return; // let's not mess with bench testing
scheduleMsg(logger, "setPin %s %s", msg, value ? "on" : "off");

View File

@ -35,6 +35,14 @@ OutputPin::OutputPin() {
#endif
}
bool_t OutputPin::isInitialized() {
#if EFI_PROD_CODE || defined(__DOXYGEN__)
return port != NULL;
#else
return false;
#endif
}
void OutputPin::setValue(int logicValue) {
doSetOutputPinValue2(this, logicValue);
}

View File

@ -21,6 +21,7 @@
class OutputPin {
public:
OutputPin();
bool_t isInitialized();
void setValue(int logicValue);
void setDefaultPinState(pin_output_mode_e *defaultState);
bool_t getLogicValue();

View File

@ -47,12 +47,12 @@
static MemoryStream intermediateLoggingBuffer;
static uint8_t intermediateLoggingBufferData[INTERMEDIATE_LOGGING_BUFFER_SIZE] CCM_OPTIONAL;
//todo define max-printf-buffer
static bool intermediateLoggingBufferInited = FALSE;
static bool_t intermediateLoggingBufferInited = false;
/**
* @returns true if data does not fit into this buffer
*/
static INLINE bool validateBuffer(Logging *logging, uint32_t extraLen) {
static INLINE bool_t validateBuffer(Logging *logging, uint32_t extraLen) {
if (logging->buffer == NULL) {
firmwareError("Logging not initialized: %s", logging->name);
return true;
@ -60,7 +60,7 @@ static INLINE bool validateBuffer(Logging *logging, uint32_t extraLen) {
if (remainingSize(logging) < extraLen + 1) {
#if EFI_PROD_CODE
warning(OBD_PCM_Processor_Fault, "buffer overflow %s", logging->name);
warning(OBD_PCM_Processor_Fault, "output overflow %s", logging->name);
#endif
return true;
}
@ -70,7 +70,7 @@ static INLINE bool validateBuffer(Logging *logging, uint32_t extraLen) {
void append(Logging *logging, const char *text) {
efiAssertVoid(text != NULL, "append NULL");
uint32_t extraLen = efiStrlen(text);
int isError = validateBuffer(logging, extraLen);
bool_t isError = validateBuffer(logging, extraLen);
if (isError) {
return;
}