Small fixes
This commit is contained in:
parent
8af08a7209
commit
44a0da5a62
|
@ -154,7 +154,7 @@ void vvtControl()
|
|||
static inline void boostInterrupt() //Most ARM chips can simply call a function
|
||||
#endif
|
||||
{
|
||||
if ((boost_pwm_state) && (boost_pwm_target_value<=2))
|
||||
if (boost_pwm_state == true)
|
||||
{
|
||||
BOOST_PIN_LOW(); // Switch pin to low
|
||||
BOOST_TIMER_COMPARE = BOOST_TIMER_COUNTER + (boost_pwm_max_count - boost_pwm_cur_value);
|
||||
|
@ -176,7 +176,7 @@ void vvtControl()
|
|||
static inline void vvtInterrupt() //Most ARM chips can simply call a function
|
||||
#endif
|
||||
{
|
||||
if ((vvt_pwm_state) && (vvt_pwm_target_value<=2))
|
||||
if (vvt_pwm_state == true)
|
||||
{
|
||||
VVT_PIN_LOW(); // Switch pin to low
|
||||
VVT_TIMER_COMPARE = VVT_TIMER_COUNTER + (vvt_pwm_max_count - vvt_pwm_cur_value);
|
||||
|
|
|
@ -176,7 +176,7 @@ void initialiseSchedulers()
|
|||
Timer3.setPrescaleFactor((36 * 2U)-1); //2us resolution
|
||||
#elif defined(STM32F4)
|
||||
//(CYCLES_PER_MICROSECOND == 168, APB2 at 84MHz, APB1 at 42MHz).
|
||||
//Timer2 to 4 is on APB1, Timer1 on APB2. http://www.st.com/resource/en/datasheet/stm32f103cb.pdf sheet 12
|
||||
//Timer2 to 14 is on APB1, Timers 1, 8, 9 and 10 on APB2. http://www.st.com/resource/en/datasheet/stm32f407vg.pdf sheet 120
|
||||
Timer1.setPrescaleFactor((84 * 2U)-1); //2us resolution
|
||||
Timer2.setPrescaleFactor((42 * 2U)-1); //2us resolution
|
||||
Timer3.setPrescaleFactor((42 * 2U)-1); //2us resolution
|
||||
|
|
|
@ -649,32 +649,17 @@ void loop()
|
|||
//Check for any requets from serial. Serial operations are checked under 2 scenarios:
|
||||
// 1) Every 64 loops (64 Is more than fast enough for TunerStudio). This function is equivalent to ((loopCount % 64) == 1) but is considerably faster due to not using the mod or division operations
|
||||
// 2) If the amount of data in the serial buffer is greater than a set threhold (See globals.h). This is to avoid serial buffer overflow when large amounts of data is being sent
|
||||
if ( (BIT_CHECK(LOOP_TIMER, BIT_TIMER_15HZ)) or (Serial.available() > SERIAL_BUFFER_THRESHOLD) )
|
||||
if ( ((mainLoopCount & 31) == 1) or (Serial.available() > SERIAL_BUFFER_THRESHOLD) )
|
||||
{
|
||||
if (Serial.available() > 0)
|
||||
{
|
||||
command();
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) //ATmega2561 does not have Serial3
|
||||
//if serial3 interface is enabled then check for serial3 requests.
|
||||
if (configPage10.enable_canbus == 1)
|
||||
{
|
||||
if ( (BIT_CHECK(LOOP_TIMER, BIT_TIMER_15HZ)) or (CANSerial.available() > SERIAL_BUFFER_THRESHOLD) )
|
||||
{
|
||||
if (CANSerial.available() > 0)
|
||||
{
|
||||
canCommand();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(CORE_TEENSY) || defined(CORE_STM32)
|
||||
//if can or secondary serial interface is enabled then check for requests.
|
||||
if (configPage10.enable_canbus == 1) //secondary serial interface enabled
|
||||
{
|
||||
if ( (BIT_CHECK(LOOP_TIMER, BIT_TIMER_15HZ)) or (CANSerial.available() > SERIAL_BUFFER_THRESHOLD) )
|
||||
if ( ((mainLoopCount & 31) == 1) or (CANSerial.available() > SERIAL_BUFFER_THRESHOLD) )
|
||||
{
|
||||
if (CANSerial.available() > 0)
|
||||
{
|
||||
|
@ -682,15 +667,16 @@ void loop()
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (configPage10.enable_canbus == 2) // can module enabled
|
||||
#if defined(CORE_TEENSY) || defined(CORE_STM32)
|
||||
else if (configPage10.enable_canbus == 2) // can module enabled
|
||||
{
|
||||
//check local can module
|
||||
// if ( (BIT_CHECK(LOOP_TIMER, BIT_TIMER_15HZ)) or (CANbus0.available())
|
||||
// if ( BIT_CHECK(LOOP_TIMER, BIT_TIMER_15HZ) or (CANbus0.available())
|
||||
// {
|
||||
// CANbus0.read(rx_msg);
|
||||
// }
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Displays currently disabled
|
||||
// if (configPage1.displayType && (mainLoopCount & 255) == 1) { updateDisplay();}
|
||||
|
|
|
@ -28,8 +28,8 @@ void writeConfig()
|
|||
| Fuel table (See storage.h for data layout) - Page 1
|
||||
| 16x16 table itself + the 16 values along each of the axis
|
||||
-----------------------------------------------------*/
|
||||
EEPROM.update(EEPROM_CONFIG1_XSIZE, fuelTable.xSize); //Write the VE Tables Table RPM dimension size
|
||||
EEPROM.update(EEPROM_CONFIG1_YSIZE, fuelTable.ySize); //Write the VE Tables Table MAP/TPS dimension size
|
||||
EEPROM.update(EEPROM_CONFIG1_XSIZE, fuelTable.xSize); //Write the VE Table RPM dimension size
|
||||
EEPROM.update(EEPROM_CONFIG1_YSIZE, fuelTable.ySize); //Write the VE Table MAP/TPS dimension size
|
||||
for(int x=EEPROM_CONFIG1_MAP; x<EEPROM_CONFIG1_XBINS; x++)
|
||||
{
|
||||
offset = x - EEPROM_CONFIG1_MAP;
|
||||
|
|
|
@ -196,23 +196,27 @@ void setPinMapping(byte boardID)
|
|||
pinO2 = A22;
|
||||
#elif defined(STM32F4)
|
||||
//Black F407VE http://wiki.stm32duino.com/index.php?title=STM32F407
|
||||
//PC8~PC12 SDio
|
||||
//PA13~PA15 & PB4 SWD(debug) pins
|
||||
//PB0 EEPROM CS pin
|
||||
//PD5 & PD6 Serial2
|
||||
pinInjector1 = PE7; //Output pin injector 1 is on
|
||||
pinInjector2 = PE8; //Output pin injector 2 is on
|
||||
pinInjector3 = PE9; //Output pin injector 3 is on
|
||||
pinInjector4 = PE10; //Output pin injector 4 is on
|
||||
pinInjector5 = PE11; //Output pin injector 5 is on
|
||||
pinCoil1 = PB10; //Pin for coil 1
|
||||
pinCoil2 = PB11; //Pin for coil 2
|
||||
pinCoil3 = PB12; //Pin for coil 3
|
||||
pinCoil4 = PB13; //Pin for coil 4
|
||||
pinCoil5 = PB14; //Pin for coil 5
|
||||
pinCoil1 = PB5; //Pin for coil 1
|
||||
pinCoil2 = PB6; //Pin for coil 2
|
||||
pinCoil3 = PB7; //Pin for coil 3
|
||||
pinCoil4 = PB8; //Pin for coil 4
|
||||
pinCoil5 = PB9; //Pin for coil 5
|
||||
pinTPS = A0; //TPS input pin
|
||||
pinMAP = A1; //MAP sensor pin
|
||||
pinIAT = A2; //IAT sensor pin
|
||||
pinCLT = A3; //CLS sensor pin
|
||||
pinCLT = A3; //CLT sensor pin
|
||||
pinO2 = A4; //O2 Sensor pin
|
||||
pinBat = A5; //Battery reference voltage pin
|
||||
pinBaro = A6;
|
||||
pinBaro = A10;
|
||||
pinIdle1 = PB8; //Single wire idle control
|
||||
pinIdle2 = PB9; //2 wire idle control
|
||||
pinBoost = PE0; //Boost control
|
||||
|
@ -225,9 +229,10 @@ void setPinMapping(byte boardID)
|
|||
pinFuelPump = PA6; //Fuel pump output
|
||||
pinTachOut = PA7; //Tacho output pin
|
||||
//external interrupt enabled pins
|
||||
pinFlex = PC4; // Flex sensor (Must be external interrupt enabled)
|
||||
pinTrigger = PC5; //The CAS pin
|
||||
pinTrigger2 = PC6; //The Cam Sensor pin
|
||||
//external interrupts could be enalbed in any pin, except same port numbers (PA4,PE4)
|
||||
pinFlex = PE2; // Flex sensor (Must be external interrupt enabled)
|
||||
pinTrigger = PE3; //The CAS pin
|
||||
pinTrigger2 = PE4; //The Cam Sensor pin
|
||||
#elif defined(CORE_STM32)
|
||||
//blue pill http://wiki.stm32duino.com/index.php?title=Blue_Pill
|
||||
//Maple mini http://wiki.stm32duino.com/index.php?title=Maple_Mini
|
||||
|
|
Loading…
Reference in New Issue