_ _ ( ) ( ) | | | | | | | | | (_) | (_____)
##### ## ## ## ## ##### ## ##
##### ## ## ## ## ##### ## #####
#### ## ## ## ## ## ## ####
|\ /| | ) ( | | (___) | | ___ | | ( ) | | ) ( | |/ \|
IMPORTANT: enter the case-INsensitive alphabetic (no numbers) code AND WRITE SOME SHORT summary of changes (below) if you are saving changes. (not required for previewing changes). Wiki-spamming is not tolerated, will be removed, so it does NOT even show up in history. Spammers go away now. Visit Preferences to set your user name Summary of change: ----- '''Marcell's Solution with my Comments''' ----- Actual Code http://cvs.sourceforge.net/viewcvs.py/megasquirtavr/firmware/boostcontrol.c?view=markup ----- There is the code sniplet: [code] // going to 12 bits: ''' boost += boost;''' '''if( (boost >> 4) > (uint16_t)config.boost_minpressure ){''' ''' uint16_t pid_result;''' // TODO: boostcut (above configurable boost) in fuelcalc.c ''' pid_set_target( &boostcontrol_pid, boost_target() );''' // with pid15() high-boost will decrease command (more DLOW) // which is consistent with DLOW above ''' pid_result = pid15( &boostcontrol_pid, boost ); ''' // pid_result useful range is -2048 .. +2047 (consider this in PID config) // offset going to 0..4095 ( 0.5 fixed offset should be OK ) ''' pid_result += 2048;''' // prevent underflow, overflow. // 3 outputs possible: always low, always high // and something between ''' if( pid_result >= 0x8000 || pid_result < BOOSTACT_MINTIME){''' // always OFF ''' schedule_needed = 0;''' ''' output = DLOW;''' ''' } else if( pid_result >= 4096 ){''' // compare against (4096 - BOOSTACT_MINTIME) ? // fully ON! good luck Mr. Gorsky! ''' schedule_needed = 0;''' ''' output = DHIGH;''' ''' } else {''' ''' schedule_needed = 1;''' // true !!! ''' output = DHIGH;''' // when pid_result is 4095, we want appr. // (BOOSTCONTROL_PWM_PERIOD_8MS * 2048) * 4 usec ON-time ''' command16 = mult16_8( pid_result, BOOSTCONTROL_PWM_PERIOD_8MS);''' ''' command16 >>= 1; ''' } ''' } else {''' /* Don't activate boost valve below/equal a configurable boost: there is no need to wear the valve at cruising at low boost where the wastegate is known not to open anyway. Without this, the pid15() would raise command, so DHIGH would be likely */ ''' schedule_needed = 0;''' ''' output = DLOW; ''' '''}''' [/code] Optional: Add document to category: Wiki formatting: * is Bullet list ** Bullet list subentry ... '''Bold''', ---- is horizontal ruler, <code> preformatted text... </code> See wiki editing HELP for tables and other formatting tips and tricks.