Correct typos found by codespell (#880)
This commit is contained in:
parent
dc87795718
commit
540b3a4fa2
|
@ -391,7 +391,7 @@ void boostControl()
|
||||||
if ( (configPage9.boostByGearEnabled > 0) && (configPage2.vssMode > 1) ){ boostByGear(); }
|
if ( (configPage9.boostByGearEnabled > 0) && (configPage2.vssMode > 1) ){ boostByGear(); }
|
||||||
else{ currentStatus.boostTarget = get3DTableValue(&boostTable, (currentStatus.TPS * 2), currentStatus.RPM) << 1; } //Boost target table is in kpa and divided by 2
|
else{ currentStatus.boostTarget = get3DTableValue(&boostTable, (currentStatus.TPS * 2), currentStatus.RPM) << 1; } //Boost target table is in kpa and divided by 2
|
||||||
}
|
}
|
||||||
if(((configPage15.boostControlEnable == EN_BOOST_CONTROL_BARO) & (currentStatus.MAP >= currentStatus.baro)) | ((configPage15.boostControlEnable == EN_BOOST_CONTROL_FIXED) & (currentStatus.MAP >= configPage15.boostControlEnableThreshold))) //Only enables boost control above baro pressure or above user defined threshold (User defined level is ususally set to boost with wastegate actuator only boost level)
|
if(((configPage15.boostControlEnable == EN_BOOST_CONTROL_BARO) & (currentStatus.MAP >= currentStatus.baro)) | ((configPage15.boostControlEnable == EN_BOOST_CONTROL_FIXED) & (currentStatus.MAP >= configPage15.boostControlEnableThreshold))) //Only enables boost control above baro pressure or above user defined threshold (User defined level is usually set to boost with wastegate actuator only boost level)
|
||||||
{
|
{
|
||||||
//If flex fuel is enabled, there can be an adder to the boost target based on ethanol content
|
//If flex fuel is enabled, there can be an adder to the boost target based on ethanol content
|
||||||
if( configPage2.flexEnabled == 1 )
|
if( configPage2.flexEnabled == 1 )
|
||||||
|
@ -435,7 +435,7 @@ void boostControl()
|
||||||
boostPID.Initialize(); //This resets the ITerm value to prevent rubber banding
|
boostPID.Initialize(); //This resets the ITerm value to prevent rubber banding
|
||||||
//Boost control needs to have a high duty cycle if control is below threshold (baro or fixed value). This ensures the waste gate is closed as much as possible, this build boost as fast as possible.
|
//Boost control needs to have a high duty cycle if control is below threshold (baro or fixed value). This ensures the waste gate is closed as much as possible, this build boost as fast as possible.
|
||||||
currentStatus.boostDuty = configPage15.boostDCWhenDisabled*100;
|
currentStatus.boostDuty = configPage15.boostDCWhenDisabled*100;
|
||||||
boost_pwm_target_value = ((unsigned long)(currentStatus.boostDuty) * boost_pwm_max_count) / 10000; //Convert boost duty (Which is a % multipled by 100) to a pwm count
|
boost_pwm_target_value = ((unsigned long)(currentStatus.boostDuty) * boost_pwm_max_count) / 10000; //Convert boost duty (Which is a % multiplied by 100) to a pwm count
|
||||||
ENABLE_BOOST_TIMER(); //Turn on the compare unit (ie turn on the interrupt) if boost duty >0
|
ENABLE_BOOST_TIMER(); //Turn on the compare unit (ie turn on the interrupt) if boost duty >0
|
||||||
if(currentStatus.boostDuty==0){
|
if(currentStatus.boostDuty==0){
|
||||||
//If boost control does nothing disable PWM completely
|
//If boost control does nothing disable PWM completely
|
||||||
|
|
|
@ -67,7 +67,7 @@ extern "C" char* sbrk(int incr);
|
||||||
#ifndef PB11 //Hack for F4 BlackPills
|
#ifndef PB11 //Hack for F4 BlackPills
|
||||||
#define PB11 PB10
|
#define PB11 PB10
|
||||||
#endif
|
#endif
|
||||||
//Hack to alow compile on small STM boards
|
//Hack to allow compilation on small STM boards
|
||||||
#ifndef A10
|
#ifndef A10
|
||||||
#define A10 PA0
|
#define A10 PA0
|
||||||
#define A11 PA1
|
#define A11 PA1
|
||||||
|
|
|
@ -74,7 +74,7 @@ void DashMessage(uint16_t DashMessageID)
|
||||||
outMsg.buf[0] = 0x00; //Check engine light (binary 10), Cruise light (binary 1000), EML (binary 10000).
|
outMsg.buf[0] = 0x00; //Check engine light (binary 10), Cruise light (binary 1000), EML (binary 10000).
|
||||||
outMsg.buf[1] = 0x00; //LSB Fuel consumption
|
outMsg.buf[1] = 0x00; //LSB Fuel consumption
|
||||||
outMsg.buf[2] = 0x00; //MSB Fuel Consumption
|
outMsg.buf[2] = 0x00; //MSB Fuel Consumption
|
||||||
if (currentStatus.coolant > 159) { outMsg.buf[3] = 0x08; } //Turn on overheat light if coolant temp hits 120 degrees celcius.
|
if (currentStatus.coolant > 159) { outMsg.buf[3] = 0x08; } //Turn on overheat light if coolant temp hits 120 degrees celsius.
|
||||||
else { outMsg.buf[3] = 0x00; } //Overheat light off at normal engine temps.
|
else { outMsg.buf[3] = 0x00; } //Overheat light off at normal engine temps.
|
||||||
outMsg.buf[4] = 0x7E; //this is oil temp
|
outMsg.buf[4] = 0x7E; //this is oil temp
|
||||||
break;
|
break;
|
||||||
|
@ -113,4 +113,4 @@ void DashMessage(uint16_t DashMessageID)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -73,7 +73,7 @@ void secondserial_Command()
|
||||||
Glow = Gdata[(configPage9.caninput_source_start_byte[destcaninchannel]&7)];
|
Glow = Gdata[(configPage9.caninput_source_start_byte[destcaninchannel]&7)];
|
||||||
if ((BIT_CHECK(configPage9.caninput_source_num_bytes,destcaninchannel) > 0)) //if true then num bytes is 2
|
if ((BIT_CHECK(configPage9.caninput_source_num_bytes,destcaninchannel) > 0)) //if true then num bytes is 2
|
||||||
{
|
{
|
||||||
if ((configPage9.caninput_source_start_byte[destcaninchannel]&7) < 8) //you cant have a 2 byte value starting at byte 7(8 on the list)
|
if ((configPage9.caninput_source_start_byte[destcaninchannel]&7) < 8) //you can't have a 2 byte value starting at byte 7(8 on the list)
|
||||||
{
|
{
|
||||||
Ghigh = Gdata[((configPage9.caninput_source_start_byte[destcaninchannel]&7)+1)];
|
Ghigh = Gdata[((configPage9.caninput_source_start_byte[destcaninchannel]&7)+1)];
|
||||||
}
|
}
|
||||||
|
@ -423,7 +423,7 @@ void sendCancommand(uint8_t cmdtype, uint16_t canaddress, uint8_t candata1, uint
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // requests via serial3
|
case 2: // requests via serial3
|
||||||
CANSerial.print("R"); //send "R" to request data from the sourcecanAddress whos value is sent next
|
CANSerial.print("R"); //send "R" to request data from the sourcecanAddress whose value is sent next
|
||||||
CANSerial.write(candata1); //the currentStatus.current_caninchannel
|
CANSerial.write(candata1); //the currentStatus.current_caninchannel
|
||||||
CANSerial.write(lowByte(sourcecanAddress) ); //send lsb first
|
CANSerial.write(lowByte(sourcecanAddress) ); //send lsb first
|
||||||
CANSerial.write(highByte(sourcecanAddress) );
|
CANSerial.write(highByte(sourcecanAddress) );
|
||||||
|
|
|
@ -527,7 +527,7 @@ void processSerialCommand()
|
||||||
serialPayload[13] = 0;
|
serialPayload[13] = 0;
|
||||||
serialPayload[14] = 0;
|
serialPayload[14] = 0;
|
||||||
|
|
||||||
//Unkown purpose for last 2 bytes
|
//Unknown purpose for last 2 bytes
|
||||||
serialPayload[15] = 0;
|
serialPayload[15] = 0;
|
||||||
serialPayload[16] = 0;
|
serialPayload[16] = 0;
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ extern bool serialWriteInProgress;
|
||||||
extern bool serialReceivePending; /**< Whether or not a serial request has only been partially received. This occurs when a the length has been received in the serial buffer, but not all of the payload or CRC has yet been received. */
|
extern bool serialReceivePending; /**< Whether or not a serial request has only been partially received. This occurs when a the length has been received in the serial buffer, but not all of the payload or CRC has yet been received. */
|
||||||
|
|
||||||
|
|
||||||
void parseSerial();//This is the heart of the Command Line Interpeter. All that needed to be done was to make it human readable.
|
void parseSerial();//This is the heart of the Command Line Interpreter. All that needed to be done was to make it human readable.
|
||||||
void processSerialCommand();
|
void processSerialCommand();
|
||||||
void sendSerialReturnCode(byte returnCode);
|
void sendSerialReturnCode(byte returnCode);
|
||||||
void sendSerialPayload(void*, uint16_t payloadLength);
|
void sendSerialPayload(void*, uint16_t payloadLength);
|
||||||
|
|
|
@ -293,7 +293,7 @@ uint16_t correctionCranking()
|
||||||
return crankingValue;
|
return crankingValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Afer Start Enrichment calculation.
|
/** After Start Enrichment calculation.
|
||||||
* This is a short period (Usually <20 seconds) immediately after the engine first fires (But not when cranking)
|
* This is a short period (Usually <20 seconds) immediately after the engine first fires (But not when cranking)
|
||||||
* where an additional amount of fuel is added (Over and above the WUE amount).
|
* where an additional amount of fuel is added (Over and above the WUE amount).
|
||||||
*
|
*
|
||||||
|
|
|
@ -21,7 +21,7 @@ int rpmDelta;
|
||||||
*
|
*
|
||||||
* Currently 4 methods are planned and/or available:
|
* Currently 4 methods are planned and/or available:
|
||||||
* 1) Last interval based on a full revolution
|
* 1) Last interval based on a full revolution
|
||||||
* 2) Last interval based on the time between the last 2 teeth (Crank Pattern dependant)
|
* 2) Last interval based on the time between the last 2 teeth (Crank Pattern dependent)
|
||||||
* 3) Closed loop error correction (Alpha-beta filter)
|
* 3) Closed loop error correction (Alpha-beta filter)
|
||||||
* 4) 2nd derivative prediction (Speed + acceleration)
|
* 4) 2nd derivative prediction (Speed + acceleration)
|
||||||
*/
|
*/
|
||||||
|
@ -55,7 +55,7 @@ unsigned long angleToTime(int16_t angle, byte method)
|
||||||
* Convert a time (uS) into an angle at current speed
|
* Convert a time (uS) into an angle at current speed
|
||||||
* Currently 4 methods are planned and/or available:
|
* Currently 4 methods are planned and/or available:
|
||||||
* 1) Last interval based on a full revolution
|
* 1) Last interval based on a full revolution
|
||||||
* 2) Last interval based on the time between the last 2 teeth (Crank Pattern dependant)
|
* 2) Last interval based on the time between the last 2 teeth (Crank Pattern dependent)
|
||||||
* 3) Closed loop error correction (Alpha-beta filter)
|
* 3) Closed loop error correction (Alpha-beta filter)
|
||||||
* 4) 2nd derivative prediction (Speed + acceleration)
|
* 4) 2nd derivative prediction (Speed + acceleration)
|
||||||
*/
|
*/
|
||||||
|
@ -134,7 +134,7 @@ void doCrankSpeedCalcs()
|
||||||
rpmDelta = (toothDeltaV << 10) / (6 * toothDeltaT);
|
rpmDelta = (toothDeltaV << 10) / (6 * toothDeltaT);
|
||||||
}
|
}
|
||||||
|
|
||||||
timePerDegreex16 = ldiv( 2666656L, currentStatus.RPM + rpmDelta).quot; //This give accuracy down to 0.1 of a degree and can provide noticably better timing results on low res triggers
|
timePerDegreex16 = ldiv( 2666656L, currentStatus.RPM + rpmDelta).quot; //This gives accuracy down to 0.1 of a degree and can provide noticeably better timing results on low resolution triggers
|
||||||
timePerDegree = timePerDegreex16 / 16;
|
timePerDegree = timePerDegreex16 / 16;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -155,10 +155,10 @@ void doCrankSpeedCalcs()
|
||||||
{
|
{
|
||||||
//long timeThisRevolution = (micros_safe() - toothOneTime);
|
//long timeThisRevolution = (micros_safe() - toothOneTime);
|
||||||
interrupts();
|
interrupts();
|
||||||
//Take into account any likely accleration that has occurred since the last full revolution completed:
|
//Take into account any likely acceleration that has occurred since the last full revolution completed:
|
||||||
//long rpm_adjust = (timeThisRevolution * (long)currentStatus.rpmDOT) / 1000000;
|
//long rpm_adjust = (timeThisRevolution * (long)currentStatus.rpmDOT) / 1000000;
|
||||||
long rpm_adjust = 0;
|
long rpm_adjust = 0;
|
||||||
timePerDegreex16 = ldiv( 2666656L, currentStatus.RPM + rpm_adjust).quot; //The use of a x16 value gives accuracy down to 0.1 of a degree and can provide noticeably better timing results on low res triggers
|
timePerDegreex16 = ldiv( 2666656L, currentStatus.RPM + rpm_adjust).quot; //The use of a x16 value gives accuracy down to 0.1 of a degree and can provide noticeably better timing results on low resolution triggers
|
||||||
timePerDegree = timePerDegreex16 / 16;
|
timePerDegree = timePerDegreex16 / 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3227,7 +3227,7 @@ void triggerSetEndTeeth_Daihatsu()
|
||||||
|
|
||||||
/** Harley Davidson (V2) with 2 unevenly Spaced Teeth.
|
/** Harley Davidson (V2) with 2 unevenly Spaced Teeth.
|
||||||
Within the decoder code, the sync tooth is referred to as tooth #1. Derived from GMX7 and adapted for Harley.
|
Within the decoder code, the sync tooth is referred to as tooth #1. Derived from GMX7 and adapted for Harley.
|
||||||
Only rising Edge is used for simplicity.The second input is ignored, as it does not help to desolve cam position.
|
Only rising Edge is used for simplicity.The second input is ignored, as it does not help to resolve cam position.
|
||||||
* @defgroup dec_harley Harley Davidson
|
* @defgroup dec_harley Harley Davidson
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -808,7 +808,7 @@ struct config2 {
|
||||||
|
|
||||||
//config2 in ini
|
//config2 in ini
|
||||||
byte fuelAlgorithm : 3;///< Fuel algorithm - 0=Manifold pressure/MAP (LOAD_SOURCE_MAP, default, proven), 1=Throttle/TPS (LOAD_SOURCE_TPS), 2=IMAP/EMAP (LOAD_SOURCE_IMAPEMAP)
|
byte fuelAlgorithm : 3;///< Fuel algorithm - 0=Manifold pressure/MAP (LOAD_SOURCE_MAP, default, proven), 1=Throttle/TPS (LOAD_SOURCE_TPS), 2=IMAP/EMAP (LOAD_SOURCE_IMAPEMAP)
|
||||||
byte fixAngEnable : 1; ///< Whether fixed/locked timing is enabled (0=diable, 1=enable, See @ref configPage4.FixAng)
|
byte fixAngEnable : 1; ///< Whether fixed/locked timing is enabled (0=disable, 1=enable, See @ref configPage4.FixAng)
|
||||||
byte nInjectors : 4; ///< Number of injectors
|
byte nInjectors : 4; ///< Number of injectors
|
||||||
|
|
||||||
|
|
||||||
|
@ -818,8 +818,8 @@ struct config2 {
|
||||||
byte legacyMAP : 1; ///< Legacy MAP reading behaviour
|
byte legacyMAP : 1; ///< Legacy MAP reading behaviour
|
||||||
byte baroCorr : 1; // Unused ?
|
byte baroCorr : 1; // Unused ?
|
||||||
byte injLayout : 2; /**< Injector Layout - 0=INJ_PAIRED (number outputs == number cyls/2, timed over 1 crank rev), 1=INJ_SEMISEQUENTIAL (like paired, but number outputs == number cyls, only for 4 cyl),
|
byte injLayout : 2; /**< Injector Layout - 0=INJ_PAIRED (number outputs == number cyls/2, timed over 1 crank rev), 1=INJ_SEMISEQUENTIAL (like paired, but number outputs == number cyls, only for 4 cyl),
|
||||||
2=INJ_BANKED (2 outputs are used), 3=INJ_SEQUENTIAL (number ouputs == number cyls, timed over full cycle, 2 crank revs) */
|
2=INJ_BANKED (2 outputs are used), 3=INJ_SEQUENTIAL (number outputs == number cyls, timed over full cycle, 2 crank revs) */
|
||||||
byte perToothIgn : 1; ///< Experimental / New ign. mode ... (?) (See decoders.ino)
|
byte perToothIgn : 1; ///< Experimental / New ignition mode ... (?) (See decoders.ino)
|
||||||
byte dfcoEnabled : 1; ///< Whether or not DFCO (deceleration fuel cut-off) is turned on
|
byte dfcoEnabled : 1; ///< Whether or not DFCO (deceleration fuel cut-off) is turned on
|
||||||
|
|
||||||
byte aeColdTaperMax; ///< AE cold modifier, taper end temp (no modifier applied, was primePulse in early versions)
|
byte aeColdTaperMax; ///< AE cold modifier, taper end temp (no modifier applied, was primePulse in early versions)
|
||||||
|
@ -1397,7 +1397,7 @@ struct config13 {
|
||||||
uint8_t outputDelay[8]; ///< Output write delay for each programmable I/O (Unit: 0.1S)
|
uint8_t outputDelay[8]; ///< Output write delay for each programmable I/O (Unit: 0.1S)
|
||||||
uint8_t firstDataIn[8]; ///< Set of first I/O vars to compare
|
uint8_t firstDataIn[8]; ///< Set of first I/O vars to compare
|
||||||
uint8_t secondDataIn[8];///< Set of second I/O vars to compare
|
uint8_t secondDataIn[8];///< Set of second I/O vars to compare
|
||||||
uint8_t outputTimeLimit[8]; ///< Output delay for each programmable I/O, kindOfLimiting bit dependant(Unit: 0.1S)
|
uint8_t outputTimeLimit[8]; ///< Output delay for each programmable I/O, kindOfLimiting bit dependent(Unit: 0.1S)
|
||||||
uint8_t unused_13[8]; // Unused
|
uint8_t unused_13[8]; // Unused
|
||||||
int16_t firstTarget[8]; ///< first target value to compare with numeric comp
|
int16_t firstTarget[8]; ///< first target value to compare with numeric comp
|
||||||
int16_t secondTarget[8];///< second target value to compare with bitwise op
|
int16_t secondTarget[8];///< second target value to compare with bitwise op
|
||||||
|
@ -1528,7 +1528,7 @@ extern byte pinFuelPressure;
|
||||||
extern byte pinOilPressure;
|
extern byte pinOilPressure;
|
||||||
extern byte pinWMIEmpty; // Water tank empty sensor
|
extern byte pinWMIEmpty; // Water tank empty sensor
|
||||||
extern byte pinWMIIndicator; // No water indicator bulb
|
extern byte pinWMIIndicator; // No water indicator bulb
|
||||||
extern byte pinWMIEnabled; // ON-OFF ouput to relay/pump/solenoid
|
extern byte pinWMIEnabled; // ON-OFF output to relay/pump/solenoid
|
||||||
extern byte pinMC33810_1_CS;
|
extern byte pinMC33810_1_CS;
|
||||||
extern byte pinMC33810_2_CS;
|
extern byte pinMC33810_2_CS;
|
||||||
#ifdef USE_SPI_EEPROM
|
#ifdef USE_SPI_EEPROM
|
||||||
|
|
|
@ -30,7 +30,7 @@ struct StepperIdle
|
||||||
int curIdleStep; //Tracks the current location of the stepper
|
int curIdleStep; //Tracks the current location of the stepper
|
||||||
int targetIdleStep; //What the targeted step is
|
int targetIdleStep; //What the targeted step is
|
||||||
volatile StepperStatus stepperStatus;
|
volatile StepperStatus stepperStatus;
|
||||||
volatile unsigned long stepStartTime; //The time the curren
|
volatile unsigned long stepStartTime;
|
||||||
byte lessAirDirection;
|
byte lessAirDirection;
|
||||||
byte moreAirDirection;
|
byte moreAirDirection;
|
||||||
};
|
};
|
||||||
|
|
|
@ -544,7 +544,7 @@ void idleControl()
|
||||||
|
|
||||||
idle_cl_target_rpm = (uint16_t)currentStatus.CLIdleTarget * 10; //Multiply the byte target value back out by 10
|
idle_cl_target_rpm = (uint16_t)currentStatus.CLIdleTarget * 10; //Multiply the byte target value back out by 10
|
||||||
if( BIT_CHECK(LOOP_TIMER, BIT_TIMER_1HZ) ) { idlePID.SetTunings(configPage6.idleKP, configPage6.idleKI, configPage6.idleKD); } //Re-read the PID settings once per second
|
if( BIT_CHECK(LOOP_TIMER, BIT_TIMER_1HZ) ) { idlePID.SetTunings(configPage6.idleKP, configPage6.idleKI, configPage6.idleKD); } //Re-read the PID settings once per second
|
||||||
if((currentStatus.RPM - idle_cl_target_rpm > configPage2.iacRPMlimitHysteresis*10) || (currentStatus.TPS > configPage2.iacTPSlimit)){ //reset integral to zero when TPS is bigger than set value in TS (opening throttle so not idle anymore). OR when RPM higher than Idle Target + RPM Histeresis (comming back from high rpm with throttle closed)
|
if((currentStatus.RPM - idle_cl_target_rpm > configPage2.iacRPMlimitHysteresis*10) || (currentStatus.TPS > configPage2.iacTPSlimit)){ //reset integral to zero when TPS is bigger than set value in TS (opening throttle so not idle anymore). OR when RPM higher than Idle Target + RPM Histeresis (coming back from high rpm with throttle closed)
|
||||||
idlePID.ResetIntegeral();
|
idlePID.ResetIntegeral();
|
||||||
}
|
}
|
||||||
PID_computed = idlePID.Compute(true, FeedForwardTerm);
|
PID_computed = idlePID.Compute(true, FeedForwardTerm);
|
||||||
|
|
|
@ -1482,7 +1482,7 @@ void setPinMapping(byte boardID)
|
||||||
//https://github.com/stm32duino/Arduino_Core_STM32/blob/master/variants/Generic_F411Cx/variant.h#L28
|
//https://github.com/stm32duino/Arduino_Core_STM32/blob/master/variants/Generic_F411Cx/variant.h#L28
|
||||||
//pins PA12, PA11 are used for USB or CAN couldn't be used for GPIO
|
//pins PA12, PA11 are used for USB or CAN couldn't be used for GPIO
|
||||||
//pins PB12, PB13, PB14 and PB15 are used to SPI FLASH
|
//pins PB12, PB13, PB14 and PB15 are used to SPI FLASH
|
||||||
//PB2 can't be used as input becuase is BOOT pin
|
//PB2 can't be used as input because it's the BOOT pin
|
||||||
pinInjector1 = PB7; //Output pin injector 1 is on
|
pinInjector1 = PB7; //Output pin injector 1 is on
|
||||||
pinInjector2 = PB6; //Output pin injector 2 is on
|
pinInjector2 = PB6; //Output pin injector 2 is on
|
||||||
pinInjector3 = PB5; //Output pin injector 3 is on
|
pinInjector3 = PB5; //Output pin injector 3 is on
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
typedef uint8_t byte;
|
typedef uint8_t byte;
|
||||||
|
|
||||||
/** @brief Represents a 16-bit value as a byte. Useful for I/O.
|
/** @brief Represents a 16-bit value as a byte. Useful for I/O.
|
||||||
*
|
*
|
||||||
* Often we need to deal internally with values that fit in 16-bits but do
|
* Often we need to deal internally with values that fit in 16-bits but do
|
||||||
* not require much accuracy. E.g. table axes in RPM. For these values we can
|
* not require much accuracy. E.g. table axes in RPM. For these values we can
|
||||||
* save storage space (EEPROM) by scaling to/from 8-bits using a fixed divisor.
|
* save storage space (EEPROM) by scaling to/from 8-bits using a fixed divisor.
|
||||||
|
@ -23,11 +23,12 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Construct
|
* @brief Construct
|
||||||
|
*
|
||||||
* @param factor The factor to multiply when converting \c byte to \c int16_t
|
* @param factor The factor to multiply when converting \c byte to \c int16_t
|
||||||
* @param divider The factor to divide by when converting \c int16_t to \c byte
|
* @param divider The factor to divide by when converting \c int16_t to \c byte
|
||||||
*
|
*
|
||||||
* \c divider could be computed from \c factor, but including it as a parameter
|
* \c divider could be computed from \c factor, but including it as a parameter
|
||||||
* allows callers to create \c factor instances at compile tiem.
|
* allows callers to create \c factor instances at compile time.
|
||||||
*/
|
*/
|
||||||
constexpr int16_byte(uint8_t factor, const libdivide::libdivide_s16_t ÷r)
|
constexpr int16_byte(uint8_t factor, const libdivide::libdivide_s16_t ÷r)
|
||||||
: _factor(factor), _divider(divider)
|
: _factor(factor), _divider(divider)
|
||||||
|
@ -45,4 +46,4 @@ private:
|
||||||
libdivide::libdivide_s16_t _divider;
|
libdivide::libdivide_s16_t _divider;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -108,7 +108,7 @@ void setIgnitionSchedule8(void (*startCallback)(), unsigned long timeout, unsign
|
||||||
|
|
||||||
inline void refreshIgnitionSchedule1(unsigned long timeToEnd) __attribute__((always_inline));
|
inline void refreshIgnitionSchedule1(unsigned long timeToEnd) __attribute__((always_inline));
|
||||||
|
|
||||||
//The ARM cores use seprate functions for their ISRs
|
//The ARM cores use separate functions for their ISRs
|
||||||
#if defined(ARDUINO_ARCH_STM32) || defined(CORE_TEENSY)
|
#if defined(ARDUINO_ARCH_STM32) || defined(CORE_TEENSY)
|
||||||
static inline void fuelSchedule1Interrupt();
|
static inline void fuelSchedule1Interrupt();
|
||||||
static inline void fuelSchedule2Interrupt();
|
static inline void fuelSchedule2Interrupt();
|
||||||
|
|
|
@ -1250,7 +1250,7 @@ static inline void ignitionSchedule4Interrupt() //Most ARM chips can simply call
|
||||||
ignitionSchedule4.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
ignitionSchedule4.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
||||||
ignitionSchedule4.startTime = micros();
|
ignitionSchedule4.startTime = micros();
|
||||||
if(ignitionSchedule4.endScheduleSetByDecoder == true) { SET_COMPARE(IGN4_COMPARE, ignitionSchedule4.endCompare); } //If the decoder has set the end compare value, assign it to the next compare
|
if(ignitionSchedule4.endScheduleSetByDecoder == true) { SET_COMPARE(IGN4_COMPARE, ignitionSchedule4.endCompare); } //If the decoder has set the end compare value, assign it to the next compare
|
||||||
else { SET_COMPARE(IGN4_COMPARE, IGN4_COUNTER + uS_TO_TIMER_COMPARE(ignitionSchedule4.duration) ); } //If the decoder based timing isn't set, doing this here prevents a potential overflow tha
|
else { SET_COMPARE(IGN4_COMPARE, IGN4_COUNTER + uS_TO_TIMER_COMPARE(ignitionSchedule4.duration) ); } //If the decoder based timing isn't set, doing this here prevents a potential overflow that can occur at low RPMs
|
||||||
}
|
}
|
||||||
else if (ignitionSchedule4.Status == RUNNING)
|
else if (ignitionSchedule4.Status == RUNNING)
|
||||||
{
|
{
|
||||||
|
@ -1291,7 +1291,7 @@ static inline void ignitionSchedule5Interrupt() //Most ARM chips can simply call
|
||||||
ignitionSchedule5.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
ignitionSchedule5.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
||||||
ignitionSchedule5.startTime = micros();
|
ignitionSchedule5.startTime = micros();
|
||||||
if(ignitionSchedule5.endScheduleSetByDecoder == true) { SET_COMPARE(IGN5_COMPARE, ignitionSchedule5.endCompare); } //If the decoder has set the end compare value, assign it to the next compare
|
if(ignitionSchedule5.endScheduleSetByDecoder == true) { SET_COMPARE(IGN5_COMPARE, ignitionSchedule5.endCompare); } //If the decoder has set the end compare value, assign it to the next compare
|
||||||
else { SET_COMPARE(IGN5_COMPARE, IGN5_COUNTER + uS_TO_TIMER_COMPARE(ignitionSchedule5.duration) ); } //If the decoder based timing isn't set, doing this here prevents a potential overflow tha
|
else { SET_COMPARE(IGN5_COMPARE, IGN5_COUNTER + uS_TO_TIMER_COMPARE(ignitionSchedule5.duration) ); } //If the decoder based timing isn't set, doing this here prevents a potential overflow that can occur at low RPMs
|
||||||
}
|
}
|
||||||
else if (ignitionSchedule5.Status == RUNNING)
|
else if (ignitionSchedule5.Status == RUNNING)
|
||||||
{
|
{
|
||||||
|
@ -1332,7 +1332,7 @@ static inline void ignitionSchedule6Interrupt() //Most ARM chips can simply call
|
||||||
ignitionSchedule6.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
ignitionSchedule6.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
||||||
ignitionSchedule6.startTime = micros();
|
ignitionSchedule6.startTime = micros();
|
||||||
if(ignitionSchedule6.endScheduleSetByDecoder == true) { SET_COMPARE(IGN6_COMPARE, ignitionSchedule6.endCompare); } //If the decoder has set the end compare value, assign it to the next compare
|
if(ignitionSchedule6.endScheduleSetByDecoder == true) { SET_COMPARE(IGN6_COMPARE, ignitionSchedule6.endCompare); } //If the decoder has set the end compare value, assign it to the next compare
|
||||||
else { SET_COMPARE(IGN6_COMPARE, IGN6_COUNTER + uS_TO_TIMER_COMPARE(ignitionSchedule6.duration) ); } //If the decoder based timing isn't set, doing this here prevents a potential overflow tha
|
else { SET_COMPARE(IGN6_COMPARE, IGN6_COUNTER + uS_TO_TIMER_COMPARE(ignitionSchedule6.duration) ); } //If the decoder based timing isn't set, doing this here prevents a potential overflow that can occur at low RPMs
|
||||||
}
|
}
|
||||||
else if (ignitionSchedule6.Status == RUNNING)
|
else if (ignitionSchedule6.Status == RUNNING)
|
||||||
{
|
{
|
||||||
|
@ -1373,7 +1373,7 @@ static inline void ignitionSchedule7Interrupt() //Most ARM chips can simply call
|
||||||
ignitionSchedule7.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
ignitionSchedule7.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
||||||
ignitionSchedule7.startTime = micros();
|
ignitionSchedule7.startTime = micros();
|
||||||
if(ignitionSchedule7.endScheduleSetByDecoder == true) { SET_COMPARE(IGN7_COMPARE, ignitionSchedule7.endCompare); } //If the decoder has set the end compare value, assign it to the next compare
|
if(ignitionSchedule7.endScheduleSetByDecoder == true) { SET_COMPARE(IGN7_COMPARE, ignitionSchedule7.endCompare); } //If the decoder has set the end compare value, assign it to the next compare
|
||||||
else { SET_COMPARE(IGN7_COMPARE, IGN7_COUNTER + uS_TO_TIMER_COMPARE(ignitionSchedule7.duration) ); } //If the decoder based timing isn't set, doing this here prevents a potential overflow tha
|
else { SET_COMPARE(IGN7_COMPARE, IGN7_COUNTER + uS_TO_TIMER_COMPARE(ignitionSchedule7.duration) ); } //If the decoder based timing isn't set, doing this here prevents a potential overflow that can occur at low RPMs
|
||||||
}
|
}
|
||||||
else if (ignitionSchedule7.Status == RUNNING)
|
else if (ignitionSchedule7.Status == RUNNING)
|
||||||
{
|
{
|
||||||
|
@ -1414,7 +1414,7 @@ static inline void ignitionSchedule8Interrupt() //Most ARM chips can simply call
|
||||||
ignitionSchedule8.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
ignitionSchedule8.Status = RUNNING; //Set the status to be in progress (ie The start callback has been called, but not the end callback)
|
||||||
ignitionSchedule8.startTime = micros();
|
ignitionSchedule8.startTime = micros();
|
||||||
if(ignitionSchedule8.endScheduleSetByDecoder == true) { SET_COMPARE(IGN8_COMPARE, ignitionSchedule8.endCompare); } //If the decoder has set the end compare value, assign it to the next compare
|
if(ignitionSchedule8.endScheduleSetByDecoder == true) { SET_COMPARE(IGN8_COMPARE, ignitionSchedule8.endCompare); } //If the decoder has set the end compare value, assign it to the next compare
|
||||||
else { SET_COMPARE(IGN8_COMPARE, IGN8_COUNTER + uS_TO_TIMER_COMPARE(ignitionSchedule8.duration) ); } //If the decoder based timing isn't set, doing this here prevents a potential overflow tha
|
else { SET_COMPARE(IGN8_COMPARE, IGN8_COUNTER + uS_TO_TIMER_COMPARE(ignitionSchedule8.duration) ); } //If the decoder based timing isn't set, doing this here prevents a potential overflow that can occur at low RPMs
|
||||||
}
|
}
|
||||||
else if (ignitionSchedule8.Status == RUNNING)
|
else if (ignitionSchedule8.Status == RUNNING)
|
||||||
{
|
{
|
||||||
|
|
|
@ -96,7 +96,7 @@ void initialiseADC()
|
||||||
else if ((((configPage9.enable_secondarySerial == 1) || ((configPage9.enable_intcan == 1) && (configPage9.intcan_available == 1))) && (configPage9.caninput_sel[currentStatus.current_caninchannel]&12) == 12)
|
else if ((((configPage9.enable_secondarySerial == 1) || ((configPage9.enable_intcan == 1) && (configPage9.intcan_available == 1))) && (configPage9.caninput_sel[currentStatus.current_caninchannel]&12) == 12)
|
||||||
|| (((configPage9.enable_secondarySerial == 0) && ( (configPage9.enable_intcan == 1) && (configPage9.intcan_available == 0) )) && (configPage9.caninput_sel[currentStatus.current_caninchannel]&3) == 3)
|
|| (((configPage9.enable_secondarySerial == 0) && ( (configPage9.enable_intcan == 1) && (configPage9.intcan_available == 0) )) && (configPage9.caninput_sel[currentStatus.current_caninchannel]&3) == 3)
|
||||||
|| (((configPage9.enable_secondarySerial == 0) && (configPage9.enable_intcan == 0)) && ((configPage9.caninput_sel[currentStatus.current_caninchannel]&3) == 3)))
|
|| (((configPage9.enable_secondarySerial == 0) && (configPage9.enable_intcan == 0)) && ((configPage9.caninput_sel[currentStatus.current_caninchannel]&3) == 3)))
|
||||||
{ //if current input channel is enabled as digital local pin check caninput_selxb(bits 2:3) wih &12 and caninput_selxa(bits 0:1) with &3
|
{ //if current input channel is enabled as digital local pin check caninput_selxb(bits 2:3) with &12 and caninput_selxa(bits 0:1) with &3
|
||||||
byte pinNumber = (configPage9.Auxinpinb[currentStatus.current_caninchannel]&63) + 1;
|
byte pinNumber = (configPage9.Auxinpinb[currentStatus.current_caninchannel]&63) + 1;
|
||||||
if( pinIsUsed(pinNumber) )
|
if( pinIsUsed(pinNumber) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -101,7 +101,7 @@ inline uint16_t applyFuelTrimToPW(trimTable3d *pTrimTable, int16_t fuelLoad, int
|
||||||
|
|
||||||
/** Speeduino main loop.
|
/** Speeduino main loop.
|
||||||
*
|
*
|
||||||
* Main loop chores (roughly in order they are preformed):
|
* Main loop chores (roughly in the order that they are performed):
|
||||||
* - Check if serial comms or tooth logging are in progress (send or receive, prioritise communication)
|
* - Check if serial comms or tooth logging are in progress (send or receive, prioritise communication)
|
||||||
* - Record loop timing vars
|
* - Record loop timing vars
|
||||||
* - Check tooth time, update @ref statuses (currentStatus) variables
|
* - Check tooth time, update @ref statuses (currentStatus) variables
|
||||||
|
|
|
@ -24,7 +24,7 @@ Hence we will preload the timer with 131 cycles to leave 125 until overflow (1ms
|
||||||
volatile bool tachoAlt = false;
|
volatile bool tachoAlt = false;
|
||||||
#define TACHO_PULSE_HIGH() *tach_pin_port |= (tach_pin_mask)
|
#define TACHO_PULSE_HIGH() *tach_pin_port |= (tach_pin_mask)
|
||||||
#define TACHO_PULSE_LOW() *tach_pin_port &= ~(tach_pin_mask)
|
#define TACHO_PULSE_LOW() *tach_pin_port &= ~(tach_pin_mask)
|
||||||
enum TachoOutputStatus {DEACTIVE, READY, ACTIVE}; //The 3 statuses that the tacho output pulse can have
|
enum TachoOutputStatus {INACTIVE, READY, ACTIVE}; //The 3 statuses that the tacho output pulse can have
|
||||||
|
|
||||||
volatile uint8_t tachoEndTime; //The time (in ms) that the tacho pulse needs to end at
|
volatile uint8_t tachoEndTime; //The time (in ms) that the tacho pulse needs to end at
|
||||||
volatile TachoOutputStatus tachoOutputFlag;
|
volatile TachoOutputStatus tachoOutputFlag;
|
||||||
|
|
|
@ -32,7 +32,7 @@ void initialiseTimers()
|
||||||
loop100ms = 0;
|
loop100ms = 0;
|
||||||
loop250ms = 0;
|
loop250ms = 0;
|
||||||
loopSec = 0;
|
loopSec = 0;
|
||||||
tachoOutputFlag = DEACTIVE;
|
tachoOutputFlag = INACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ void oneMSInterval() //Most ARM chips can simply call a function
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Don't run on this pulse (Half speed tacho)
|
//Don't run on this pulse (Half speed tacho)
|
||||||
tachoOutputFlag = DEACTIVE;
|
tachoOutputFlag = INACTIVE;
|
||||||
}
|
}
|
||||||
tachoAlt = !tachoAlt; //Flip the alternating value in case half speed tacho is in use.
|
tachoAlt = !tachoAlt; //Flip the alternating value in case half speed tacho is in use.
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ void oneMSInterval() //Most ARM chips can simply call a function
|
||||||
if((uint8_t)ms_counter == tachoEndTime)
|
if((uint8_t)ms_counter == tachoEndTime)
|
||||||
{
|
{
|
||||||
TACHO_PULSE_HIGH();
|
TACHO_PULSE_HIGH();
|
||||||
tachoOutputFlag = DEACTIVE;
|
tachoOutputFlag = INACTIVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Tacho sweep
|
// Tacho sweep
|
||||||
|
@ -161,9 +161,9 @@ void oneMSInterval() //Most ARM chips can simply call a function
|
||||||
|
|
||||||
//**************************************************************************************************************************************************
|
//**************************************************************************************************************************************************
|
||||||
//This updates the runSecs variable
|
//This updates the runSecs variable
|
||||||
//If the engine is running or cranking, we need ot update the run time counter.
|
//If the engine is running or cranking, we need to update the run time counter.
|
||||||
if (BIT_CHECK(currentStatus.engine, BIT_ENGINE_RUN))
|
if (BIT_CHECK(currentStatus.engine, BIT_ENGINE_RUN))
|
||||||
{ //NOTE - There is a potential for a ~1sec gap between engine crank starting and ths runSec number being incremented. This may delay ASE!
|
{ //NOTE - There is a potential for a ~1sec gap between engine crank starting and the runSec number being incremented. This may delay ASE!
|
||||||
if (currentStatus.runSecs <= 254) //Ensure we cap out at 255 and don't overflow. (which would reset ASE and cause problems with the closed loop fuelling (Which has to wait for the O2 to warmup))
|
if (currentStatus.runSecs <= 254) //Ensure we cap out at 255 and don't overflow. (which would reset ASE and cause problems with the closed loop fuelling (Which has to wait for the O2 to warmup))
|
||||||
{ currentStatus.runSecs++; } //Increment our run counter by 1 second.
|
{ currentStatus.runSecs++; } //Increment our run counter by 1 second.
|
||||||
}
|
}
|
||||||
|
@ -271,4 +271,3 @@ void oneMSInterval() //Most ARM chips can simply call a function
|
||||||
TCNT2 = 131; //Preload timer2 with 100 cycles, leaving 156 till overflow.
|
TCNT2 = 131; //Preload timer2 with 100 cycles, leaving 156 till overflow.
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,7 @@ void doUpdates()
|
||||||
configPage4.cltAdvValues[5] = 0;
|
configPage4.cltAdvValues[5] = 0;
|
||||||
|
|
||||||
|
|
||||||
//March 19 added a tacho pulse duration that could default to stupidly high values. Check if this is the case and fix it if found. 6ms is tha maximum allowed value
|
//March 19 added a tacho pulse duration that could default to stupidly high values. Check if this is the case and fix it if found. 6ms is the maximum allowed value
|
||||||
if(configPage2.tachoDuration > 6) { configPage2.tachoDuration = 3; }
|
if(configPage2.tachoDuration > 6) { configPage2.tachoDuration = 3; }
|
||||||
|
|
||||||
//MAP based AE was introduced, force the AE mode to be TPS for all existing tunes
|
//MAP based AE was introduced, force the AE mode to be TPS for all existing tunes
|
||||||
|
|
Loading…
Reference in New Issue