Page 1 of 1

Proper source of engine status in code.

Posted: Thu Dec 04, 2014 8:58 pm
by spags
Hi,
I've been looking at the engine status detection code going in the last few days.

Would RpmCalculator::isRunning() be the proper source for this the engine status going forward? Or will it be broken out to a unbound function like isCranking()

I'm asking because I'm looking to fix http://sourceforge.net/p/rusefi/tickets/117 and isRunning() and isCranking() are key.

Re: Proper source of engine status in code.

Posted: Thu Dec 04, 2014 9:03 pm
by AndreyB
C'mon, there is NO way to predict the future of this. No plans to change much around here through.

Code: Select all

	/**
	 * Please note that this is a relatively heavy method due to getTimeNowNt usage 
	 */
	bool isRunning(DECLARE_ENGINE_PARAMETER_F);

Code: Select all

	/**
	 * This is public because sometimes we cannot afford to call isRunning() and the value is good enough
	 */
	volatile int rpmValue;
Re: #117: current status: the code is there, time to check it if works - see applyIdleSolenoidPinState

Re: Proper source of engine status in code.

Posted: Thu Dec 04, 2014 9:53 pm
by spags
C'mon, there is NO way to predict the future of this. No plans to change much around here through.
<sarcasm> You're telling me there is _NO_ api definition document for this project, But how dare you lay a single line of code without it. </sarcasm> :lol:

Meh, no plans to change works for me. Will have the a/c code use those as well.

Will also test that ICV code later on so you have an extra data point.

Re: Proper source of engine status in code.

Posted: Fri Dec 05, 2014 2:07 am
by spags
Re: Bug 117, I tested with the following results.

Frankenso:
set_idle_enabled 1
Engine not running, switch in the on position a there is a fixed pwm value going into the ICV. Voltmeter sees about 10.3v

Stock ECU:
Engine not running, switch on the on position: Fixed pwm going into the icv. Reads about 11.2v on the voltmeter.

If we move DEFAULT_IDLE_DUTY up a little it should mirror stock perfectly, so AFIK this is mimics stock close to perfect.

Re: Proper source of engine status in code.

Posted: Fri Dec 05, 2014 2:09 am
by AndreyB
Looks like it does not work as intended - I was hoping it would not be doing anything while the engine is not spinning.

(It might be a problem by itself since it would mean idle solenoid would have to open while you are already cranking, but that's off-topic for the purposes of #117)

Re: Proper source of engine status in code.

Posted: Fri Dec 05, 2014 2:15 am
by spags
Agreed, I imagine to do that the PWM would have to stop happening and the output voltage brought to 0. Not very familiar with the PWM code, but i think it's all in software. There must be a nice way to tell a pwm channel to stop.