Comment typos correction (#1189)

* basic spelling fixes

* basic spelling fixes, external libs
This commit is contained in:
Daniel Tobias 2024-03-21 11:37:45 +11:00 committed by GitHub
parent 98cf514bcf
commit 3a712baf23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 99 additions and 99 deletions

View File

@ -485,7 +485,7 @@ void initialiseAuxPWM(void)
#elif defined(CORE_TEENSY35)
vvt_pwm_max_count = (uint16_t)(MICROS_PER_SEC / (32U * configPage6.vvtFreq * 2U)); //Converts the frequency in Hz to the number of ticks (at 16uS) it takes to complete 1 cycle. Note that the frequency is divided by 2 coming from TS to allow for up to 512hz
#elif defined(CORE_TEENSY41)
vvt_pwm_max_count = (uint16_t)(MICROS_PER_SEC / (2U * configPage6.vvtFreq * 2U)); //Converts the frequency in Hz to the number of ticks (at 2uS) it takes to complete 1 cycle. Note that the frequency is divided by 2 coming fro TS to allow for up to 512hz
vvt_pwm_max_count = (uint16_t)(MICROS_PER_SEC / (2U * configPage6.vvtFreq * 2U)); //Converts the frequency in Hz to the number of ticks (at 2uS) it takes to complete 1 cycle. Note that the frequency is divided by 2 coming from TS to allow for up to 512hz
#endif
if(configPage6.vvtMode == VVT_MODE_CLOSED_LOOP)

View File

@ -31,7 +31,7 @@ A full copy of the license may be found in the projects root directory
// Forward declarations
/** @brief Processes a message once it has been fully recieved */
/** @brief Processes a message once it has been fully received */
void processSerialCommand(void);
/** @brief Should be called when ::serialStatusFlag == SERIAL_TRANSMIT_TOOTH_INPROGRESS, */
@ -104,7 +104,7 @@ static inline bool isTimeout(void) {
return (millis() - serialReceiveStartTime) > SERIAL_TIMEOUT;
}
// ====================================== Endianess Support =============================
// ====================================== Endianness Support =============================
/**
* @brief Flush all remaining bytes from the rx serial buffer
@ -392,7 +392,7 @@ static void loadO2CalibrationChunk(uint16_t offset, uint16_t chunkSize)
}
/**
* @brief Convert 2 bytes into an offset temperature in degrees Celcius
* @brief Convert 2 bytes into an offset temperature in degrees Celsius
* @attention Returned value will be offset CALIBRATION_TEMPERATURE_OFFSET
*/
static uint16_t toTemperature(byte lo, byte hi)
@ -438,7 +438,7 @@ static void processTemperatureCalibrationTableUpdate(uint16_t calibrationLength,
/** Processes the incoming data on the serial buffer based on the command sent.
Can be either data for a new command or a continuation of data for command that is already in progress:
Comands are single byte (letter symbol) commands.
Commands are single byte (letter symbol) commands.
*/
void serialReceive(void)
{

View File

@ -606,7 +606,7 @@ byte correctionAFRClosedLoop(void)
if( (currentStatus.runSecs > configPage6.ego_sdelay) || (configPage2.incorporateAFR == true) ) { currentStatus.afrTarget = get3DTableValue(&afrTable, currentStatus.fuelLoad, currentStatus.RPM); } //Perform the target lookup
}
if((configPage6.egoType > 0) && (BIT_CHECK(currentStatus.status1, BIT_STATUS1_DFCO) != 1 ) ) //egoType of 0 means no O2 sensor. If DFCO is active do not run the ego controllers to prevent interator wind-up.
if((configPage6.egoType > 0) && (BIT_CHECK(currentStatus.status1, BIT_STATUS1_DFCO) != 1 ) ) //egoType of 0 means no O2 sensor. If DFCO is active do not run the ego controllers to prevent iterator wind-up.
{
AFRValue = currentStatus.egoCorrection; //Need to record this here, just to make sure the correction stays 'on' even if the nextCycle count isn't ready

View File

@ -628,7 +628,7 @@ void triggerSec_missingTooth(void)
{
secondaryToothCount = 1;
revolutionOne = 1; //Sequential revolution reset
triggerSecFilterTime = 0; //This is used to prevent a condition where serious intermitent signals (Eg someone furiously plugging the sensor wire in and out) can leave the filter in an unrecoverable state
triggerSecFilterTime = 0; //This is used to prevent a condition where serious intermittent signals (Eg someone furiously plugging the sensor wire in and out) can leave the filter in an unrecoverable state
triggerRecordVVT1Angle ();
}
else
@ -3001,7 +3001,7 @@ void triggerPri_Subaru67(void)
{
currentStatus.hasSync = false;
currentStatus.syncLossCounter++;
toothCurrentCount = 5; // we don't know if its 5 or 11, but we'll be right 50% of the time and speed up geting sync 50%
toothCurrentCount = 5; // we don't know if its 5 or 11, but we'll be right 50% of the time and speed up getting sync 50%
}
secondaryToothCount = 0;
break;
@ -4519,7 +4519,7 @@ void triggerSec_NGC4(void)
else if (secondaryToothCount > 0) { secondaryToothCount = 0; }
}
triggerSecFilterTime = 0; //This is used to prevent a condition where serious intermitent signals (Eg someone furiously plugging the sensor wire in and out) can leave the filter in an unrecoverable state
triggerSecFilterTime = 0; //This is used to prevent a condition where serious intermittent signals (Eg someone furiously plugging the sensor wire in and out) can leave the filter in an unrecoverable state
}
else if (secondaryToothCount > 0) {
triggerSecFilterTime = curGap2 >> 2; //Set filter at 25% of the current speed. Filter can only be recalc'd for the regular teeth, not the missing one.
@ -4575,7 +4575,7 @@ void triggerSec_NGC68(void)
//This is the first tooth in this group
secondaryToothCount = 1;
triggerSecFilterTime = 0; //This is used to prevent a condition where serious intermitent signals (Eg someone furiously plugging the sensor wire in and out) can leave the filter in an unrecoverable state
triggerSecFilterTime = 0; //This is used to prevent a condition where serious intermittent signals (Eg someone furiously plugging the sensor wire in and out) can leave the filter in an unrecoverable state
}
else if (secondaryToothCount > 0) {
@ -4859,7 +4859,7 @@ void triggerSetup_Renix(void)
configPage4.triggerTeeth = 4; // wheel has 44 teeth but we use these to work out which tooth angle to use, therefore speeduino thinks we only have 8 teeth.
configPage4.triggerMissingTeeth = 0;
triggerActualTeeth = 4; //The number of teeth we're pretending physically existing on the wheel.
triggerFilterTime = (MICROS_PER_SEC / (MAX_RPM / 60U * 44U)); //Trigger filter time is the shortest possible time (in uS) that there can be between crank teeth (ie at max RPM). Any pulses that occur faster than this time will be disgarded as noise
triggerFilterTime = (MICROS_PER_SEC / (MAX_RPM / 60U * 44U)); //Trigger filter time is the shortest possible time (in uS) that there can be between crank teeth (ie at max RPM). Any pulses that occur faster than this time will be discarded as noise
}
else if (configPage2.nCylinders == 6)
{
@ -4867,7 +4867,7 @@ void triggerSetup_Renix(void)
configPage4.triggerTeeth = 6; // wheel has 44 teeth but we use these to work out which tooth angle to use, therefore speeduino thinks we only have 6 teeth.
configPage4.triggerMissingTeeth = 0;
triggerActualTeeth = 6; //The number of teeth we're pretending physically existing on the wheel.
triggerFilterTime = (MICROS_PER_SEC / (MAX_RPM / 60U * 66U)); //Trigger filter time is the shortest possible time (in uS) that there can be between crank teeth (ie at max RPM). Any pulses that occur faster than this time will be disgarded as noise
triggerFilterTime = (MICROS_PER_SEC / (MAX_RPM / 60U * 66U)); //Trigger filter time is the shortest possible time (in uS) that there can be between crank teeth (ie at max RPM). Any pulses that occur faster than this time will be discarded as noise
}
MAX_STALL_TIME = ((MICROS_PER_DEG_1_RPM/50U) * triggerToothAngle); //Minimum 50rpm. (3333uS is the time per degree at 50rpm). Largest gap between teeth is 90 or 60 degrees depending on decoder.
@ -5022,7 +5022,7 @@ void triggerSetup_RoverMEMS()
for(toothOneTime = 0; toothOneTime < 10; toothOneTime++) // repurpose variable temporarily to help clear ToothAngles.
{ toothAngles[toothOneTime] = 0; }// Repurpose ToothAngles to store data needed for this implementation.
triggerFilterTime = (MICROS_PER_SEC / (MAX_RPM / 60U * 36U)); //Trigger filter time is the shortest possible time (in uS) that there can be between crank teeth (ie at max RPM). Any pulses that occur faster than this time will be disgarded as noise
triggerFilterTime = (MICROS_PER_SEC / (MAX_RPM / 60U * 36U)); //Trigger filter time is the shortest possible time (in uS) that there can be between crank teeth (ie at max RPM). Any pulses that occur faster than this time will be discarded as noise
triggerSecFilterTime = (MICROS_PER_SEC / (MAX_RPM / 60U)); // only 1 tooth on the wheel not 36
configPage4.triggerTeeth = 36;
@ -5227,7 +5227,7 @@ int getCrankAngle_RoverMEMS()
int crankAngle = ((tempToothCurrentCount - 1) * triggerToothAngle) + configPage4.triggerAngle; //Number of teeth that have passed since tooth 1, multiplied by the angle each tooth represents, plus the angle that tooth 1 is ATDC. This gives accuracy only to the nearest tooth.
//Sequential check (simply sets whether we're on the first or 2nd revoltuion of the cycle)
//Sequential check (simply sets whether we're on the first or 2nd revolution of the cycle)
if ( (tempRevolutionOne == true) && (configPage4.TrigSpeed == CRANK_SPEED) ) { crankAngle += 360; }
lastCrankAngleCalc = micros();
@ -5429,9 +5429,9 @@ void triggerSetup_SuzukiK6A(void)
// assume this is constant for all similar sized gaps and teeth
// sync tooth is 35 degrees - eyeball looks like the tooth is 50% tooth and 50% gap so guess its 17 degrees and 18 degrees.
// coded every tooth here in case you want to try "change" setting on the trigger setup (this is defineed in init.ino and what i've set it to, otherwise you need code to selet rising or falling in init.ino (steal it from another trigger)).
// coded every tooth here in case you want to try "change" setting on the trigger setup (this is defined in init.ino and what i've set it to, otherwise you need code to select rising or falling in init.ino (steal it from another trigger)).
// If you don't want change then drop the 'falling' edges listed below and half the number of edges + reduce the triggerActualTeeth
// nb as you can edit the trigger offset using rising or falling edge setup below is irrelevant as you can adjust via the trigger ofset to cover the difference.
// nb as you can edit the trigger offset using rising or falling edge setup below is irrelevant as you can adjust via the trigger offset to cover the difference.
// not using toothAngles[0] as i'm hoping it makes logic easier
@ -5503,7 +5503,7 @@ void triggerPri_SuzukiK6A(void)
}
// check gaps match with tooth to check we have sync
// so if we *think* we've seen tooth 3 whos gap should be smaller than the previous tooth & it isn't,
// so if we *think* we've seen tooth 3 whose gap should be smaller than the previous tooth & it isn't,
// then we've lost sync
switch (toothCurrentCount)
{
@ -5537,12 +5537,12 @@ void triggerPri_SuzukiK6A(void)
break;
}
// Setup data to allow other areas of the system to work due to odd sized teeth - this could be merged with sync checking above, left seperate to keep code clearer as its doing only one function at once
// Setup data to allow other areas of the system to work due to odd sized teeth - this could be merged with sync checking above, left separate to keep code clearer as its doing only one function at once
// % of filter are not based on previous tooth size but expected next tooth size
// triggerToothAngle is the size of the prevous tooth not the future tooth
// triggerToothAngle is the size of the previous tooth not the future tooth
if (currentStatus.hasSync == true )
{
switch (toothCurrentCount) // Set tooth angle based on previous gap and triggerFilterTime based on prevoius gap and next gap
switch (toothCurrentCount) // Set tooth angle based on previous gap and triggerFilterTime based on previous gap and next gap
{
case 2:
case 4:
@ -5733,7 +5733,7 @@ int getCrankAngle_SuzukiK6A(void)
return crankAngle;
}
// Assumes no advance greater than 48 degrees. Trigers on the tooth before the ignition event
// Assumes no advance greater than 48 degrees. Triggers on the tooth before the ignition event
void triggerSetEndTeeth_SuzukiK6A(void)
{
byte nCount, bExit;

View File

@ -307,7 +307,7 @@ bool pinIsOutput(byte pin)
{
used = true;
}
//Forbiden or hardware reserved? (Defined at board_xyz.h file)
//Forbidden or hardware reserved? (Defined at board_xyz.h file)
if ( pinIsReserved(pin) ) { used = true; }
return used;

View File

@ -219,7 +219,7 @@
#define IAT_CALIBRATION_PAGE 1U
#define CLT_CALIBRATION_PAGE 0U
// note the sequence of these defines which refernce the bits used in a byte has moved when the third trigger & engine cycle was incorporated
// note the sequence of these defines which reference the bits used in a byte has moved when the third trigger & engine cycle was incorporated
#define COMPOSITE_LOG_PRI 0
#define COMPOSITE_LOG_SEC 1
#define COMPOSITE_LOG_THIRD 2
@ -1145,7 +1145,7 @@ struct config9 {
byte afrProtectEnabled : 2; /* < AFR protection enabled status. 0 = disabled, 1 = fixed mode, 2 = table mode */
byte afrProtectMinMAP; /* < Minimum MAP. Stored value is divided by 2. Increments of 2 kPa, maximum 511 (?) kPa */
byte afrProtectMinRPM; /* < Minimum RPM. Stored value is divded by 100. Increments of 100 RPM, maximum 25500 RPM */
byte afrProtectMinRPM; /* < Minimum RPM. Stored value is divided by 100. Increments of 100 RPM, maximum 25500 RPM */
byte afrProtectMinTPS; /* < Minimum TPS. */
byte afrProtectDeviation; /* < Maximum deviation from AFR target table. Stored value is multiplied by 10 */
byte afrProtectCutTime; /* < Time in ms before cut. Stored value is divided by 100. Maximum of 2550 ms */

View File

@ -727,7 +727,7 @@ void initialiseAll(void)
channel8InjDegrees = channel4InjDegrees;
#else
//This is an invalid config as there are not enough outputs to support sequential + staging
//Put the staging output to the non-existant channel 5
//Put the staging output to the non-existent channel 5
#if (INJ_CHANNELS >= 5)
maxInjOutputs = 5;
channel5InjDegrees = channel1InjDegrees;
@ -2373,7 +2373,7 @@ void setPinMapping(byte boardID)
pinInjector5 = 9; //CS for MC33810 2
pinInjector6 = 9; //CS for MC33810 3
//Dummy pins, without thes pin 0 (Serial1 RX) gets overwritten
//Dummy pins, without these pin 0 (Serial1 RX) gets overwritten
pinCoil1 = 40;
pinCoil2 = 41;
/*
@ -2385,7 +2385,7 @@ void setPinMapping(byte boardID)
pinTrigger = 19; //The CAS pin
pinTrigger2 = 18; //The Cam Sensor pin
pinTrigger3 = 22; //Uses one of the protected spare digitial inputs. This must be set or Serial1 (Pin 0) gets broken
pinTrigger3 = 22; //Uses one of the protected spare digital inputs. This must be set or Serial1 (Pin 0) gets broken
pinFlex = A16; // Flex sensor
pinMAP = A1; //MAP sensor pin
pinBaro = A0; //Baro sensor pin

View File

@ -80,7 +80,7 @@ extern uint8_t random1to100(void);
/**
* @brief Rounded \em unsigned integer division
*
* This is slighty faster than the signed version (DIV_ROUND_CLOSEST(n, d, t))
* This is slightly faster than the signed version (DIV_ROUND_CLOSEST(n, d, t))
*
* @warning For performance reasons, this macro does not promote integers.
* So it will overflow if n>MAX(t)-(d/2).
@ -95,7 +95,7 @@ extern uint8_t random1to100(void);
* @brief Rounded arithmetic right shift
*
* Right shifting throws away bits. When use for fixed point division, this
* effecitvely rounds down (towards zero). To round-to-the-nearest-integer
* effectively rounds down (towards zero). To round-to-the-nearest-integer
* when right-shifting by S, just add in 2 power S1 (which is the
* fixed-point equivalent of 0.5) first
*
@ -109,7 +109,7 @@ extern uint8_t random1to100(void);
#define IS_INTEGER(d) ((d) == (int32_t)(d))
/**
* @defgroup group-div100 Optimised integer divison by 100
* @defgroup group-div100 Optimised integer division by 100
* @{
*/
static inline uint16_t div100(uint16_t n) {

View File

@ -17,7 +17,7 @@ static inline uint16_t calculateInjectorStartAngle(uint16_t pwDegrees, int16_t i
uint16_t startAngle = (uint16_t)injAngle + (uint16_t)injChannelDegrees;
// Avoid underflow
while (startAngle<pwDegrees) { startAngle = startAngle + (uint16_t)CRANK_ANGLE_MAX_INJ; }
// Guarenteed to be >=0.
// Guaranteed to be >=0.
startAngle = startAngle - pwDegrees;
// Clamp to 0<=startAngle<=CRANK_ANGLE_MAX_INJ
while (startAngle>(uint16_t)CRANK_ANGLE_MAX_INJ) { startAngle = startAngle - (uint16_t)CRANK_ANGLE_MAX_INJ; }
@ -31,7 +31,7 @@ static inline uint32_t _calculateInjectorTimeout(const FuelSchedule &schedule, u
{
if ((schedule.Status == RUNNING) && (delta>-CRANK_ANGLE_MAX_INJ))
{
// Guarenteed to be >0
// Guaranteed to be >0
delta = delta + CRANK_ANGLE_MAX_INJ;
}
else

View File

@ -743,7 +743,7 @@ void loop(void)
//***********************************************************************************************
//| BEGIN FUEL SCHEDULES
//Finally calculate the time (uS) until we reach the firing angles and set the schedules
//We only need to set the shcedule if we're BEFORE the open angle
//We only need to set the schedule if we're BEFORE the open angle
//This may potentially be called a number of times as we get closer and closer to the opening time
//Determine the current crank angle
@ -1558,7 +1558,7 @@ void calculateStaging(uint32_t pwLimit)
currentStatus.PW4 = currentStatus.PW1;
#else
//This is an invalid config as there are not enough outputs to support sequential + staging
//Put the staging output to the non-existant channel 5
//Put the staging output to the non-existent channel 5
currentStatus.PW5 = currentStatus.PW2;
#endif
}

View File

@ -2,10 +2,10 @@
* PID Adaptive Tuning Example
* One of the benefits of the PID library is that you can
* change the tuning parameters at any time. this can be
* helpful if we want the controller to be agressive at some
* helpful if we want the controller to be aggressive at some
* times, and conservative at others. in the example below
* we set the controller to use Conservative Tuning Parameters
* when we're near setpoint and more agressive Tuning
* when we're near setpoint and more aggressive Tuning
* Parameters when we're farther away.
********************************************************/

View File

@ -186,7 +186,7 @@ void PID::SetControllerDirection(byte Direction)
controllerDirection = Direction;
}
/* Status Funcions*************************************************************
/* Status Functions*************************************************************
* Just because you set the Kp=-1 doesn't mean it actually happened. these
* functions query the internal state of the PID. they're here for display
* purposes. this are the functions the PID Front-end uses for example
@ -512,7 +512,7 @@ void integerPID::SetControllerDirection(byte Direction)
controllerDirection = Direction;
}
/* Status Funcions*************************************************************
/* Status Functions*************************************************************
* Just because you set the Kp=-1 doesn't mean it actually happened. these
* functions query the internal state of the PID. they're here for display
* purposes. this are the functions the PID Front-end uses for example
@ -554,7 +554,7 @@ integerPID_ideal::integerPID_ideal(long* Input, uint16_t* Output, uint16_t* Setp
**********************************************************************************/
bool integerPID_ideal::Compute()
{
//This is the orginal PID with 50% Base target DC
//This is the original PID with 50% Base target DC
return Compute(50*limitMultiplier);
}
@ -599,7 +599,7 @@ bool integerPID_ideal::Compute(uint16_t FeedForward)
/*Compute PID Output*/
output = (kp * error) + (ki * ITerm) + (kd * (error - lastError));
output = FeedForward + (output / 10); //output is % multipled by 1000. To get % with 2 decimal places, divide it by 10. Likewise, bias is % in whole numbers. Multiply it by 100 to get it with 2 places.
output = FeedForward + (output / 10); //output is % multiplied by 1000. To get % with 2 decimal places, divide it by 10. Likewise, bias is % in whole numbers. Multiply it by 100 to get it with 2 places.
//if(output > (outMax * limitMultiplier)) { output = (outMax * limitMultiplier); }
//if(output < (outMin * limitMultiplier)) { output = (outMin * limitMultiplier); }
@ -694,7 +694,7 @@ void integerPID_ideal::SetControllerDirection(byte Direction)
controllerDirection = Direction;
}
/* Status Funcions*************************************************************
/* Status Functions*************************************************************
* Just because you set the Kp=-1 doesn't mean it actually happened. these
* functions query the internal state of the PID. they're here for display
* purposes. this are the functions the PID Front-end uses for example

View File

@ -45,7 +45,7 @@ class PID
//Display functions ****************************************************************
int16_t GetKp(); // These functions query the pid for interal values.
int16_t GetKp(); // These functions query the pid for internal values.
int16_t GetKi(); // they were created mainly for the pid front-end,
int16_t GetKd(); // where it's important to know what is actually
int GetMode(); // inside the PID.
@ -216,7 +216,7 @@ class integerPID_ideal
int controllerDirection;
long *myInput; //
uint16_t *myOutput; // This is a percentage figure multipled by 100 (To give 2 points of precision)
uint16_t *myOutput; // This is a percentage figure multiplied by 100 (To give 2 points of precision)
uint16_t *mySetpoint; //
uint16_t *mySensitivity;
byte *mySampleTime;

View File

@ -8,8 +8,8 @@
* Winbond SPI flash memory modules. As of version 2.0 it also works with internal
* flash memory of the STM32F407. In its current form it enables reading
* and writing individual bytes as if it where an AVR EEPROM. When the begin()
* fuction is called for the first time it will "format" the flash chip.
* !!!!THIS DISTROYS ANY EXISTING DATA ON THE FLASH!!!!
* function is called for the first time it will "format" the flash chip.
* !!!!THIS DESTROYS ANY EXISTING DATA ON THE FLASH!!!!
*
* This Library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -33,7 +33,7 @@ FLASH_EEPROM_BaseClass::FLASH_EEPROM_BaseClass(EEPROM_Emulation_Config config)
//Class indicating if the emulated EEPROM flash is initialized
_EmulatedEEPROMAvailable=false;
//Class variable storing number of ones counted in adres translation block
//Class variable storing number of ones counted in address translation block
_nrOfOnes = 0;
//Class variable storing what sector we are working in.
@ -99,7 +99,7 @@ byte FLASH_EEPROM_BaseClass::read(uint16_t addressEEPROM){
//read address translation part
readFlashBytes(_addressFLASH, _ReadWriteBuffer, _Addres_Translation_Size);
//calculate address of the valid data by couting the bits in the Address translation section
//calculate address of the valid data by counting the bits in the Address translation section
_nrOfOnes = count(_ReadWriteBuffer, _Addres_Translation_Size);
//Bring number of ones within specification of buffer size.
@ -134,7 +134,7 @@ int8_t FLASH_EEPROM_BaseClass::write(uint16_t addressEEPROM, byte val){
//Check if section is full and an erase must be performed.
if (_nrOfOnes < _Addres_Translation_Size + 1){
//First read all the values in this sector that will get distroyed when erasing
//First read all the values in this sector that will get destroyed when erasing
byte tempBuf[_config.EEPROM_Bytes_Per_Sector];
for(uint16_t i = 0; i<_config.EEPROM_Bytes_Per_Sector; i++){
uint16_t TempEEPROMaddress = (_sectorFlash*_config.EEPROM_Bytes_Per_Sector) + i;
@ -155,22 +155,22 @@ int8_t FLASH_EEPROM_BaseClass::write(uint16_t addressEEPROM, byte val){
//Do not forget to write the new value!
write(addressEEPROM, val);
//Return we have writen a whole sector.
//Return we have written a whole sector.
return 0xFF;
}
//determine the adress of the byte in the address translation section where one bit must be reset when writing new values
//determine the address of the byte in the address translation section where one bit must be reset when writing new values
uint8_t AdressInAddressTranslation = (_nrOfOnes - 1)/8;
//write the new adress translation value at the new location in buffer
//write the new address translation value at the new location in buffer
_ReadWriteBuffer[AdressInAddressTranslation] <<= 1;
//Write the new EEPROM value at the new location in the buffer.
_nrOfOnes--;
_ReadWriteBuffer[_nrOfOnes] = val;
//Write the buffer to the undelying flash storage.
//Write the buffer to the underlying flash storage.
// writeFlashBytes(_addressFLASH, _ReadWriteBuffer, _Flash_Size_Per_EEPROM_Byte);
//Write actual value part of the buffer to flash
@ -293,7 +293,7 @@ int8_t SPI_EEPROM_Class::eraseFlashSector(uint32_t address, uint32_t length){
#endif
//THIS IS NOT WORKING! FOR STM32F103 YOU CAN ONLY WRITE IN JUST ERASED HALFWORDS(UINT16_T). THE PHILISOPHY IS FLAWWED THERE.
//THIS IS NOT WORKING! FOR STM32F103 YOU CAN ONLY WRITE IN JUST ERASED HALFWORDS(UINT16_T). THE PHILOSOPHY IS FLAWWED THERE.
//#if defined(STM32F103xB)
// InternalSTM32F1_EEPROM_Class::InternalSTM32F1_EEPROM_Class(EEPROM_Emulation_Config config):FLASH_EEPROM_BaseClass(config)

View File

@ -8,8 +8,8 @@
* Winbond SPI flash memory modules. As of version 2.0 it also works with internal
* flash memory of the STM32F407. In its current form it enables reading
* and writing individual bytes as if it where an AVR EEPROM. When the begin()
* fuction is called for the first time it will "format" the flash chip.
* !!!!THIS DISTROYS ANY EXISTING DATA ON THE FLASH!!!!
* function is called for the first time it will "format" the flash chip.
* !!!!THIS DESTROYS ANY EXISTING DATA ON THE FLASH!!!!
*
* This Library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -27,11 +27,11 @@
*
* ----------------- Explanation of the EEPROM emulation -------------------
* This explanation is written for novice flash users. If you already know
* about the details of programming flash memmory and EEPROM emulation in
* about the details of programming flash memory and EEPROM emulation in
* flash skip this part.
*
* The important thing to rember for prgramming flash
* 1. It has a limitted number of ERASE cycles. usually ~10k
* The important thing to remember for programming flash
* 1. It has a limited number of ERASE cycles. usually ~10k
* 2. When erased all bits in flash are set so all flash is 0xFF
* 3. An erase can only be done per flash sector of size X (X=4k or 128k or...)
* 4. Writing to flash can be done unlimited amounts of times, but
@ -56,7 +56,7 @@
* address translation part in flash. The number of ones tells the read function where
* it can find the current byte of that emulated EEPROM address.
*
* Each flash memmory is devided into erasable sectors. This is a property of the flash
* Each flash memory is divided into erasable sectors. This is a property of the flash
* used. You can find the value in the datasheet of the chip. It is FLASH_SECTOR_SIZE macro
* See table 1. The first sector used is offset by the EEPROM_FLASH_BASEADRESS. The last sector
* is determiend by the FLASH_SECTORS_USED macro.
@ -72,7 +72,7 @@
* | 0000XXXXX | Flash Sector[X] | FLASH_SECTOR_SIZE | "Last Flash sector[FLASH_SECTORS_USED -1] |
* +-------------------------+----------------------+-------------------+-------------------------------------------------------------+
*
* Each sector is devided into equaly sized sections of FLASH_SECTOR_SIZE/(EEPROM_BYTES_PER_SECTOR+1)
* Each sector is divided into equally sized sections of FLASH_SECTOR_SIZE/(EEPROM_BYTES_PER_SECTOR+1)
* The first section is used to store some identifiable numbers to show the sector is used
* for EEPROM emulation. Every following section is used to store emulated EEPROM data per address.
* See table 2
@ -140,7 +140,7 @@ typedef struct {
SPIClass SPIport;
} Flash_SPI_Config;
//Base class for flash read and write. SPI and internal flash inherrit from this class.
//Base class for flash read and write. SPI and internal flash inherit from this class.
class FLASH_EEPROM_BaseClass
{
@ -150,7 +150,7 @@ class FLASH_EEPROM_BaseClass
/**
* Initialize emulated EEPROM in flash
* @param flashavailable
* @return succes
* @return success
*/
int8_t initialize(bool);
@ -216,7 +216,7 @@ class FLASH_EEPROM_BaseClass
//Class variable indicating if the emulated EEPROM flash is initialized
bool _EmulatedEEPROMAvailable=false;
//Class variable storing number of ones counted in adres translation block
//Class variable storing number of ones counted in address translation block
uint32_t _nrOfOnes = 0;
//Class variable storing what sector we are working in.
@ -241,19 +241,19 @@ class FLASH_EEPROM_BaseClass
/**
* Checking for magic numbers on flash if numbers are there no erase is needed else do erase. True if magic numbers are there.
* @return Succes.
* @return Success.
*/
bool checkForMagicNumbers();
/**
* After an erase of a flash sector. New magic numbers must be written to that sector for use.
* @param Sector
* @return Succes.
* @return Success.
*/
int8_t writeMagicNumbers(uint32_t);
/**
* For adress translation we need to know the first non 1 bit in the address translation block.
* For address translation we need to know the first non 1 bit in the address translation block.
* Read the buffer until length and count the numbers of ones in that buffer part. return the count
* @param Buffer
* @param Length
@ -267,7 +267,7 @@ class FLASH_EEPROM_BaseClass
* @param address
* @param buffer
* @param length
* @return succes
* @return success
*/
virtual int8_t readFlashBytes(uint32_t , byte*, uint32_t);
@ -276,23 +276,23 @@ class FLASH_EEPROM_BaseClass
* @param address
* @param buffer
* @param length
* @return succes
* @return success
*/
virtual int8_t writeFlashBytes(uint32_t, byte*, uint32_t);
/**
* Erase a flash sector. Adress determines the flash sector to erase.
* Erase a flash sector. Address determines the flash sector to erase.
* length is specified in number of bytes. if number of bytes > sector size, more than one sector is erased
* @param address
* @param length
* @return succes
* @return success
*/
virtual int8_t eraseFlashSector(uint32_t, uint32_t);
//************************************************* END Implement for actual flash used ****************************************
};
//SPI flash class for SPI flash EEPROM emulation. Inherrit most from the base class.
//SPI flash class for SPI flash EEPROM emulation. Inherit most from the base class.
class SPI_EEPROM_Class : public FLASH_EEPROM_BaseClass
{
@ -303,7 +303,7 @@ class SPI_EEPROM_Class : public FLASH_EEPROM_BaseClass
* begin emulated EEPROM in flash
* @param Chip_select_pin
* @param SPI_object
* @return succes
* @return success
*/
int8_t begin(SPIClass&, uint8_t);
@ -321,7 +321,7 @@ class SPI_EEPROM_Class : public FLASH_EEPROM_BaseClass
* @param address
* @param buffer
* @param length
* @return succes
* @return success
*/
int8_t readFlashBytes(uint32_t , byte*, uint32_t);
@ -330,16 +330,16 @@ class SPI_EEPROM_Class : public FLASH_EEPROM_BaseClass
* @param address
* @param buffer
* @param length
* @return succes
* @return success
*/
int8_t writeFlashBytes(uint32_t, byte*, uint32_t);
/**
* Erase a flash sector. Adress determines the flash sector to erase.
* Erase a flash sector. Address determines the flash sector to erase.
* length is specified in number of bytes. if number of bytes > sector size, more than one sector is erased
* @param address
* @param length
* @return succes
* @return success
*/
int8_t eraseFlashSector(uint32_t, uint32_t);
@ -350,7 +350,7 @@ class SPI_EEPROM_Class : public FLASH_EEPROM_BaseClass
Flash_SPI_Config _configSPI;
};
//Internal flash class for flash EEPROM emulation. Inherrit most from the base class.
//Internal flash class for flash EEPROM emulation. Inherit most from the base class.
//Internal flash of the STM32F407VE6 is listed as 512kb total. But in reality is 1024kb
//The last 512kb flash is used for the EEPROM emulation
class InternalSTM32F4_EEPROM_Class : public FLASH_EEPROM_BaseClass
@ -372,7 +372,7 @@ class InternalSTM32F4_EEPROM_Class : public FLASH_EEPROM_BaseClass
* @param address
* @param buffer
* @param length
* @return succes
* @return success
*/
int8_t readFlashBytes(uint32_t , byte*, uint32_t);
@ -381,16 +381,16 @@ class InternalSTM32F4_EEPROM_Class : public FLASH_EEPROM_BaseClass
* @param address
* @param buffer
* @param length
* @return succes
* @return success
*/
int8_t writeFlashBytes(uint32_t, byte*, uint32_t);
/**
* Erase a flash sector. Adress determines the flash sector to erase.
* Erase a flash sector. Address determines the flash sector to erase.
* length is specified in number of bytes. if number of bytes > sector size, more than one sector is erased
* @param address
* @param length
* @return succes
* @return success
*/
int8_t eraseFlashSector(uint32_t, uint32_t);
};
@ -415,7 +415,7 @@ class InternalSTM32F4_EEPROM_Class : public FLASH_EEPROM_BaseClass
// * @param address
// * @param buffer
// * @param length
// * @return succes
// * @return success
// */
// int8_t readFlashBytes(uint32_t , byte*, uint32_t);
@ -424,16 +424,16 @@ class InternalSTM32F4_EEPROM_Class : public FLASH_EEPROM_BaseClass
// * @param address
// * @param buffer
// * @param length
// * @return succes
// * @return success
// */
// int8_t writeFlashBytes(uint32_t, byte*, uint32_t);
// /**
// * Erase a flash sector. Adress determines the flash sector to erase.
// * Erase a flash sector. Address determines the flash sector to erase.
// * length is specified in number of bytes. if number of bytes > sector size, more than one sector is erased
// * @param address
// * @param length
// * @return succes
// * @return success
// */
// int8_t eraseFlashSector(uint32_t, uint32_t);
// };
@ -456,7 +456,7 @@ class InternalSTM32F7_EEPROM_Class : public FLASH_EEPROM_BaseClass
* @param address
* @param buffer
* @param length
* @return succes
* @return success
*/
int8_t readFlashBytes(uint32_t , byte*, uint32_t);
@ -465,16 +465,16 @@ class InternalSTM32F7_EEPROM_Class : public FLASH_EEPROM_BaseClass
* @param address
* @param buffer
* @param length
* @return succes
* @return success
*/
int8_t writeFlashBytes(uint32_t, byte*, uint32_t);
/**
* Erase a flash sector. Adress determines the flash sector to erase.
* Erase a flash sector. Address determines the flash sector to erase.
* length is specified in number of bytes. if number of bytes > sector size, more than one sector is erased
* @param address
* @param length
* @return succes
* @return success
*/
int8_t eraseFlashSector(uint32_t, uint32_t);
};

View File

@ -404,7 +404,7 @@
return true;
}
// Checks to see if chip is powered down. If it is, retrns true. If not, returns false.
// Checks to see if chip is powered down. If it is, returns true. If not, returns false.
bool SPIFlash::_isChipPoweredDown(void) {
if (chipPoweredDown) {
_troubleshoot(CHIPISPOWEREDDOWN);

View File

@ -754,7 +754,7 @@ void STM32_CAN::enableFIFO(bool status)
//Nothing to do here. The FIFO is on by default. This is just to work with code made for Teensy FlexCan.
}
/* Interupt functions
/* Interrupt functions
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
*/

View File

@ -1,6 +1,6 @@
/*
This is universal CAN library for STM32 that was made to be used with Speeduino EFI.
It should support all STM32 MCUs that are also supported in stm32duino Arduino_Core_STM32 and supports up to 3x CAN busses.
It should support all STM32 MCUs that are also supported in stm32duino Arduino_Core_STM32 and supports up to 3x CAN buses.
The library is created because at least currently (year 2021) there is no official CAN library in the STM32 core.
This library is based on several STM32 CAN example libraries linked below and it has been combined with few
things from Teensy FlexCAN library to make it compatible with the CAN features that exist in speeduino for Teensy.
@ -130,7 +130,7 @@ class STM32_CAN {
void enableMBInterrupts();
void disableMBInterrupts();
// These are public because these are also used from interupts.
// These are public because these are also used from interrupts.
typedef struct RingbufferTypeDef {
volatile uint16_t head;
volatile uint16_t tail;

View File

@ -81,8 +81,8 @@
* Wrapper for *signed* 16-bit DIVISION by a *POSITIVE* compile time constant.
* E.g. FAST_DIV16(-value, 777)
*
* This only works for positive parmeters :-(
* A negative number results in a hypen in the macro name, which is not allowed
* This only works for positive parameters :-(
* A negative number results in a hyphen in the macro name, which is not allowed
*/
#define S16_MAGIC(d) CONCAT(CONCAT(S16LD_DENOM_, d), _MAGIC)
#define S16_MORE(d) CONCAT(CONCAT(S16LD_DENOM_, d), _MORE)
@ -92,8 +92,8 @@
* Wrapper for *signed* 16-bit DIVISION by a *NEGATIVE* compile time constant.
* E.g. FAST_DIV16_NEG(-value, 777) // <-- It's converted to negative. Really.
*
* This only works for positive parmeters :-(
* A negative number results in a hypen in the macro name, which is not allowed
* This only works for positive parameters :-(
* A negative number results in a hyphen in the macro name, which is not allowed
*/
#define S16_MAGIC_NEG(d) CONCAT(CONCAT(S16LD_DENOM_MINUS_, d), _MAGIC)
#define S16_MORE_NEG(d) CONCAT(CONCAT(S16LD_DENOM_MINUS_, d), _MORE)

View File

@ -665,7 +665,7 @@ void doUpdates(void)
//AFR Protection added, add default values
configPage9.afrProtectEnabled = 0; //Disable by default
configPage9.afrProtectMinMAP = 90; //Is divided by 2, vlue represents 180kPa
configPage9.afrProtectMinMAP = 90; //Is divided by 2, value represents 180kPa
configPage9.afrProtectMinRPM = 40; //4000 RPM min
configPage9.afrProtectMinTPS = 160; //80% TPS min
configPage9.afrProtectDeviation = 14; //1.4 AFR deviation
@ -718,7 +718,7 @@ void doUpdates(void)
configPage15.rollingProtCutPercent[2] = 80;
configPage15.rollingProtCutPercent[3] = 95;
//DFCO Hyster was multipled by 2 to allow a range of 0-500. Existing values must be halved
//DFCO Hyster was multiplied by 2 to allow a range of 0-500. Existing values must be halved
configPage4.dfcoHyster = configPage4.dfcoHyster / 2;
writeAllConfig();