diff --git a/speeduino/globals.h b/speeduino/globals.h index 27984a1c..882ca70b 100644 --- a/speeduino/globals.h +++ b/speeduino/globals.h @@ -85,7 +85,7 @@ #define BIT_STATUS1_INJ2 1 //inj2 #define BIT_STATUS1_INJ3 2 //inj3 #define BIT_STATUS1_INJ4 3 //inj4 -#define BIT_STATUS1_DFCO 4 //Decelleration fuel cutoff +#define BIT_STATUS1_DFCO 4 //Decelleration fuel cutoff #define BIT_STATUS1_BOOSTCUT 5 //Fuel component of MAP based boost cut out #define BIT_STATUS1_TOOTHLOG1READY 6 //Used to flag if tooth log 1 is ready #define BIT_STATUS1_TOOTHLOG2READY 7 //Used to flag if tooth log 2 is ready (Log is not currently used) @@ -100,8 +100,8 @@ #define BIT_SPARK_IDLE 6 // idle on #define BIT_SPARK_SYNC 7 // Whether engine has sync or not -#define BIT_SPARK2_FLATSH 0 //Flat shift hard cut -#define BIT_SPARK2_FLATSS 1 //Flat shift soft cut +#define BIT_SPARK2_FLATSH 0 //Flat shift hard cut +#define BIT_SPARK2_FLATSS 1 //Flat shift soft cut #define BIT_SPARK2_UNUSED3 2 #define BIT_SPARK2_UNUSED4 3 #define BIT_SPARK2_UNUSED5 4 @@ -298,7 +298,7 @@ int ignition4EndAngle = 0; int ignition5EndAngle = 0; //These are variables used across multiple files -bool initialisationComplete = false; //Tracks whether the setup() functino has run completely +bool initialisationComplete = false; //Tracks whether the setup() function has run completely volatile uint16_t mainLoopCount; unsigned long revolutionTime; //The time in uS that one revolution would take at current speed (The time tooth 1 was last seen, minus the time it was seen prior to that) volatile unsigned long timer5_overflow_count = 0; //Increments every time counter 5 overflows. Used for the fast version of micros() @@ -315,7 +315,7 @@ byte primaryTriggerEdge; byte secondaryTriggerEdge; int CRANK_ANGLE_MAX = 720; int CRANK_ANGLE_MAX_IGN = 360; -int CRANK_ANGLE_MAX_INJ = 360; // The number of crank degrees that the system track over. 360 for wasted / timed batch and 720 for sequential +int CRANK_ANGLE_MAX_INJ = 360; //The number of crank degrees that the system track over. 360 for wasted / timed batch and 720 for sequential //This needs to be here because using the config page directly can prevent burning the setting @@ -628,7 +628,7 @@ struct config6 { byte egoTPSMax; //TPS must be below this for closed loop to function byte vvtPin : 6; byte useExtBaro : 1; - byte boostMode : 1; //Simple of full boost contrl + byte boostMode : 1; //Simple of full boost control byte boostPin : 6; byte VVTasOnOff : 1; //Whether or not to use the VVT table as an on/off map byte useEMAP : 1; @@ -678,7 +678,7 @@ struct config6 { byte iacAlgorithm : 3; //Valid values are: "None", "On/Off", "PWM", "PWM Closed Loop", "Stepper", "Stepper Closed Loop" byte iacStepTime : 3; //How long to pulse the stepper for to ensure the step completes (ms) byte iacChannels : 1; //How many outputs to use in PWM mode (0 = 1 channel, 1 = 2 channels) - byte iacPWMdir : 1; //Directino of the PWM valve. 0 = Normal = Higher RPM with more duty. 1 = Reverse = Lower RPM with more duty + byte iacPWMdir : 1; //Direction of the PWM valve. 0 = Normal = Higher RPM with more duty. 1 = Reverse = Lower RPM with more duty byte iacFastTemp; //Fast idle temp when using a simple on/off valve diff --git a/speeduino/idle.ino b/speeduino/idle.ino index 9b66c7af..e578ddd0 100644 --- a/speeduino/idle.ino +++ b/speeduino/idle.ino @@ -83,7 +83,7 @@ void initialiseIdle() //Enable channel compare interrupt (This is currently disabled as not in use) //FTM2_C1SC |= FTM_CSC_CHIE; - // enable IRQ Interrupt + //Enable IRQ Interrupt NVIC_ENABLE_IRQ(IRQ_FTM2); } @@ -92,7 +92,8 @@ void initialiseIdle() //Initialising comprises of setting the 2D tables with the relevant values from the config pages switch(configPage6.iacAlgorithm) { - case IAC_ALGORITHM_NONE: //Case 0 is no idle control ('None') + case IAC_ALGORITHM_NONE: + //Case 0 is no idle control ('None') break; case IAC_ALGORITHM_ONOFF: @@ -309,7 +310,7 @@ void idleControl() } break; - case IAC_ALGORITHM_STEP_CL://Case 5 is closed loop stepper control + case IAC_ALGORITHM_STEP_CL: //Case 5 is closed loop stepper control //First thing to check is whether there is currently a step going on and if so, whether it needs to be turned off if( (checkForStepping() == false) && (isStepperHomed() == true) ) //Check that homing is complete and that there's not currently a step already taking place. MUST BE IN THIS ORDER! { diff --git a/speeduino/scheduler.ino b/speeduino/scheduler.ino index 9afb9b6e..4cfca7b3 100644 --- a/speeduino/scheduler.ino +++ b/speeduino/scheduler.ino @@ -14,7 +14,7 @@ void initialiseSchedulers() nullSchedule.Status = OFF; #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) //AVR chips use the ISR for this - // Much help in this from http://arduinomega.blogspot.com.au/2011/05/timer2-and-overflow-interrupt-lets-get.html + //Much help in this from http://arduinomega.blogspot.com.au/2011/05/timer2-and-overflow-interrupt-lets-get.html //Fuel Schedules, which uses timer 3 TCCR3B = 0x00; //Disable Timer3 while we set it up TCNT3 = 0; //Reset Timer Count @@ -46,24 +46,24 @@ void initialiseSchedulers() #elif defined (CORE_TEENSY) //FlexTimer 0 is used for 4 ignition and 4 injection schedules. There are 8 channels on this module, so no other timers are needed - FTM0_MODE |= FTM_MODE_WPDIS; // Write Protection Disable + FTM0_MODE |= FTM_MODE_WPDIS; //Write Protection Disable FTM0_MODE |= FTM_MODE_FTMEN; //Flex Timer module enable FTM0_MODE |= FTM_MODE_INIT; FTM0_SC = 0x00; // Set this to zero before changing the modulus FTM0_CNTIN = 0x0000; //Shouldn't be needed, but just in case - FTM0_CNT = 0x0000; // Reset the count to zero - FTM0_MOD = 0xFFFF; // max modulus = 65535 + FTM0_CNT = 0x0000; //Reset the count to zero + FTM0_MOD = 0xFFFF; //max modulus = 65535 //FlexTimer 3 is used for schedules on channel 5+. Currently only channel 5 is used, but will likely be expanded later - FTM3_MODE |= FTM_MODE_WPDIS; // Write Protection Disable + FTM3_MODE |= FTM_MODE_WPDIS; //Write Protection Disable FTM3_MODE |= FTM_MODE_FTMEN; //Flex Timer module enable FTM3_MODE |= FTM_MODE_INIT; FTM3_SC = 0x00; // Set this to zero before changing the modulus FTM3_CNTIN = 0x0000; //Shouldn't be needed, but just in case - FTM3_CNT = 0x0000; // Reset the count to zero - FTM3_MOD = 0xFFFF; // max modulus = 65535 + FTM3_CNT = 0x0000; //Reset the count to zero + FTM3_MOD = 0xFFFF; //max modulus = 65535 /* * Enable the clock for FTM0/1 diff --git a/speeduino/speeduino.ino b/speeduino/speeduino.ino index 68162d3c..31987b7e 100644 --- a/speeduino/speeduino.ino +++ b/speeduino/speeduino.ino @@ -136,7 +136,7 @@ void setup() initialiseTimers(); loadConfig(); - doUpdates(); //Check if any data items need updating (Occurs ith firmware updates) + doUpdates(); //Check if any data items need updating (Occurs with firmware updates) //Always start with a clean slate on the bootloader capabilities level //This should be 0 until we hear otherwise from the 16u2 @@ -1080,7 +1080,7 @@ void loop() 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 == 0)) && ((configPage9.caninput_sel[currentStatus.current_caninchannel]&3) == 3))) - { //if current input channel is enabled as digital local pin + { //if current input channel is enabled as digital local pin //read digital channel specified //currentStatus.canin[13] = 14; Dev test use only! currentStatus.canin[currentStatus.current_caninchannel] = readAuxdigital((configPage9.Auxinpinb[currentStatus.current_caninchannel]&127)+1); @@ -1133,7 +1133,7 @@ void loop() currentStatus.advance = getAdvance(); currentStatus.PW1 = PW(req_fuel_uS, currentStatus.VE, currentStatus.MAP, currentStatus.corrections, inj_opentime_uS); - //Manual adder for nitrous. These are not in correctionsFuel() because they are direct adders to the ms value, not % based + //Manual adder for nitrous. These are not in correctionsFuel() because they are direct adders to the ms value, not % based if(currentStatus.nitrous_status == NITROUS_STAGE1) { int16_t adderRange = (configPage10.n2o_stage1_maxRPM - configPage10.n2o_stage1_minRPM) * 100; @@ -1212,7 +1212,7 @@ void loop() else if(configPage10.stagingMode == STAGING_MODE_AUTO) { currentStatus.PW1 = tempPW1; - //If automatic mode, the primary injectors are used all the way up to their limit (COnfigured by the pulsewidth limit setting) + //If automatic mode, the primary injectors are used all the way up to their limit (Configured by the pulsewidth limit setting) //If they exceed their limit, the extra duty is passed to the secondaries if(tempPW1 > pwLimit) { @@ -1435,7 +1435,7 @@ void loop() //Set dwell - //Dwell is stored as ms * 10. ie Dwell of 4.3ms would be 43 in configPage4. This number therefore needs to be multiplied by 100 to get dwell in uS + //Dwell is stored as ms * 10. ie Dwell of 4.3ms would be 43 in configPage4. This number therefore needs to be multiplied by 100 to get dwell in uS if ( BIT_CHECK(currentStatus.engine, BIT_ENGINE_CRANK) ) { currentStatus.dwell = (configPage4.dwellCrank * 100); } else { currentStatus.dwell = (configPage4.dwellRun * 100); } currentStatus.dwell = correctionsDwell(currentStatus.dwell);