void bc_indication_mode(struct ecudata_t *d) { uint8_t i = 5; if (!IOCFG_CHECK(IOP_BC_INPUT)) return; //normal program execution //Check 5 times do { if (IOCFG_GET(IOP_BC_INPUT)) return; //normal program execution }while(--i); //We are entered to the blink codes indication mode _DISABLE_INTERRUPT(); ce_set_state(CE_STATE_OFF); vent_turnoff(d); //turn off ventilator starter_set_blocking_state(1); //block starter IOCFG_INIT(IOP_FL_PUMP, 0); //turn off fuel pump IOCFG_INIT(IOP_IE, 0); //turn off IE valve solenoid IOCFG_INIT(IOP_FE, 0); //turn off power valve solenoid wdt_reset_timer(); //delay 2 sec. delay_hom(20); //main loop for(;;) { uint16_t errors = 0; disp_start(); delay_hom(7); //read errors eeprom_read(&errors, EEPROM_ECUERRORS_START, sizeof(uint16_t)); for(i = 0; i < 16; ++i) { if (0 == PGM_GET_BYTE(&blink_codes[i])) continue; if (errors & (1 << i)) { disp_code(PGM_GET_BYTE(&blink_codes[i])); delay_hom(20); } } delay_hom(20); wdt_reset_timer(); } }
void pwrrelay_control(struct ecudata_t* d) { //if this feature is disabled, then do nothing if (!IOCFG_CHECK(IOP_PWRRELAY)) return; //apply power management logic if (pwrs.pwrdown) { //ignition is off //We will wait while temperature is high only if temperature sensor is enabled //and control of electric cooling fan is used. uint8_t temperature_ok = 1; if (d->param.tmp_use && IOCFG_CHECK(IOP_ECF)) { #ifdef COOLINGFAN_PWM if (d->param.vent_pwm) //PWM is available and enabled temperature_ok = (d->sens.temperat <= (d->param.vent_on - TEMPERATURE_MAGNITUDE(2.0))); else //PWM is available, but disabled temperature_ok = (d->sens.temperat <= (d->param.vent_off)); #else //PWM is not available temperature_ok = (d->sens.temperat <= (d->param.vent_off)); #endif //set timeout if (0==pwrs.state) { pwrs.state = 1; s_timer16_set(powerdown_timeout_counter, 6000); //60 sec. } } if ((temperature_ok && eeprom_is_idle() #ifdef SM_CONTROL && choke_is_ready() #endif ) || s_timer16_is_action(powerdown_timeout_counter)) IOCFG_SET(IOP_PWRRELAY, 0); //turn off relay } else pwrs.state = 0; //if IGN input is not available, then we will check board voltage pwrs.pwrdown = IOCFG_CHECK(IOP_IGN) ? (!IOCFG_GET(IOP_IGN)) : (d->sens.voltage < VOLTAGE_MAGNITUDE(4.5)); }