Teensy 4.1 compatibility fixes

This commit is contained in:
Josh Stewart 2020-07-23 09:39:51 +10:00
parent d5bc11e006
commit c8d07527ba
4 changed files with 16 additions and 6 deletions

View File

@ -75,6 +75,10 @@ void initialiseAuxPWM()
n2o_arming_pin_port = portInputRegister(digitalPinToPort(configPage10.n2o_arming_pin));
n2o_arming_pin_mask = digitalPinToBitMask(configPage10.n2o_arming_pin);
//This is a safety check that will be true if the board is uninitialised. This prevents hangs on a new board that could otherwise try to write to an invalid pin port/mask (Without this a new Teensy 4.x hangs on startup)
//The n2o_minTPS variable is capped at 100 by TS, so 255 indicates a new board.
if(configPage10.n2o_minTPS == 255) { configPage10.n2o_enable = 0; }
if(configPage10.n2o_enable > 0)
{
//The pin modes are only set if the if n2o is enabled to prevent them conflicting with other outputs.

View File

@ -1,5 +1,5 @@
#ifndef TEENSY40_H
#define TEENSY40_H
#ifndef TEENSY41_H
#define TEENSY41_H
#if defined(CORE_TEENSY)&& defined(__IMXRT1062__)
/*

View File

@ -310,8 +310,14 @@
#define SERIAL_BUFFER_THRESHOLD 32 // When the serial buffer is filled to greater than this threshold value, the serial processing operations will be performed more urgently in order to avoid it overflowing. Serial buffer is 64 bytes long, so the threshold is set at half this as a reasonable figure
#define FUEL_PUMP_ON() *pump_pin_port |= (pump_pin_mask)
#define FUEL_PUMP_OFF() *pump_pin_port &= ~(pump_pin_mask)
#ifndef CORE_TEENSY41
#define FUEL_PUMP_ON() *pump_pin_port |= (pump_pin_mask)
#define FUEL_PUMP_OFF() *pump_pin_port &= ~(pump_pin_mask)
#else
//Special compatibility case for TEENSY 41 (for now)
#define FUEL_PUMP_ON() digitalWrite(pinFuelPump, HIGH);
#define FUEL_PUMP_OFF() digitalWrite(pinFuelPump, LOW);
#endif
extern const char TSfirmwareVersion[] PROGMEM;

View File

@ -128,7 +128,6 @@ void loop()
}
}
#endif
#if defined(CORE_STM32)
else if (configPage9.enable_intcan == 1) // can module enabled
{
@ -198,7 +197,7 @@ void loop()
{
BIT_CLEAR(TIMER_mask, BIT_TIMER_15HZ);
readTPS(); //TPS reading to be performed every 32 loops (any faster and it can upset the TPSdot sampling time)
#if defined(CORE_TEENSY)
#if defined(CORE_TEENSY35)
if (configPage9.enable_intcan == 1) // use internal can module
{
// this is just to test the interface is sending
@ -253,6 +252,7 @@ void loop()
readBat();
nitrousControl();
idleControl(); //Perform any idle related actions. Even at higher frequencies, running 4x per second is sufficient.
currentStatus.vss = getSpeed();
currentStatus.gear = getGear();
currentStatus.fuelPressure = getFuelPressure();