Reenable LED indicator on the calibration routing

This commit is contained in:
Josh Stewart 2019-10-15 16:56:41 +11:00
parent be7e8359bc
commit 73f4058f6b
4 changed files with 25 additions and 17 deletions

View File

@ -93,8 +93,9 @@ upload_protocol = sam-ba
[platformio]
src_dir=speeduino
default_envs = black_F407VE
default_envs = megaatmega2560
;The following lines are for testing / experimentation only. Comment the line above to try them out
;default_envs = black_F407VE
;env_default = teensy35
;env_default = LaunchPad_tm4c1294ncpdt
;env_default = genericSTM32F103RB

View File

@ -1641,10 +1641,14 @@ void receiveCalibration(byte tableID)
bool every2nd = true;
int x;
int counter = 0;
// stm32 board has buildin led used as fuel pump
// pinMode(LED_BUILTIN, OUTPUT); //pinMode(13, OUTPUT);
bool useLEDIndicator = false;
if (pinIsOutput(LED_BUILTIN) == false)
{
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
useLEDIndicator = true;
}
// digitalWrite(LED_BUILTIN, LOW); //digitalWrite(13, LOW);
for (x = 0; x < 1024; x++)
{
//UNlike what is listed in the protocol documentation, the O2 sensor values are sent as bytes rather than ints
@ -1681,13 +1685,14 @@ void receiveCalibration(byte tableID)
storeCalibrationValue(y, (byte)tempValue);
every2nd = false;
#if defined(CORE_STM32)
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
#elif defined(CORE_STM32_OFFICIAL)
//Of core offical do nothing. led is reserved for fuel pump
#else
analogWrite(LED_BUILTIN, (counter % 50) ); //analogWrite(13, (counter % 50) );
#endif
if(useLEDIndicator == true)
{
#if defined(CORE_STM32)
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
#else
analogWrite(LED_BUILTIN, (counter % 50) );
#endif
}
counter++;
}
else {

View File

@ -379,6 +379,13 @@ byte resetControl = RESET_CONTROL_DISABLED;
volatile byte TIMER_mask;
volatile byte LOOP_TIMER;
//These functions all do checks on a pin to determine if it is already in use by another (higher importance) function
#define pinIsInjector(pin) ( ((pin) == pinInjector1) || ((pin) == pinInjector2) || ((pin) == pinInjector3) || ((pin) == pinInjector4) )
#define pinIsIgnition(pin) ( ((pin) == pinCoil1) || ((pin) == pinCoil2) || ((pin) == pinCoil3) || ((pin) == pinCoil4) )
#define pinIsSensor(pin) ( ((pin) == pinCLT) || ((pin) == pinIAT) || ((pin) == pinMAP) || ((pin) == pinTPS) || ((pin) == pinO2) || ((pin) == pinBat) )
#define pinIsUsed(pin) ( pinIsInjector((pin)) || pinIsIgnition((pin)) || pinIsSensor((pin)) )
#define pinIsOutput(pin) ( ((pin) == pinFuelPump) || ((pin) == pinFan) || ((pin) == pinVVT_1) || ((pin) == pinVVT_2) || ((pin) == pinBoost) || ((pin) == pinIdle1) || ((pin) == pinIdle2) || ((pin) == pinTachOut) )
//The status struct contains the current values for all 'live' variables
//In current version this is 64 bytes
struct statuses {
@ -1022,7 +1029,7 @@ byte pinSpareLOut4;
byte pinSpareLOut5;
byte pinBoost;
byte pinVVT_1; // vvt output 1
byte pinVVt_2; // vvt output 2
byte pinVVT_2; // vvt output 2
byte pinFan; // Cooling fan output
byte pinStepperDir; //Direction pin for the stepper motor driver
byte pinStepperStep; //Step pin for the stepper motor driver

View File

@ -54,11 +54,6 @@ byte cltErrorCount = 0;
* But removes the use of floats and uses 8 bits of fixed precision.
*/
#define ADC_FILTER(input, alpha, prior) (((long)input * (256 - alpha) + ((long)prior * alpha))) >> 8
//These functions all do checks on a pin to determine if it is already in use by another (higher importance) function
#define pinIsInjector(pin) ( ((pin) == pinInjector1) || ((pin) == pinInjector2) || ((pin) == pinInjector3) || ((pin) == pinInjector4) )
#define pinIsIgnition(pin) ( ((pin) == pinCoil1) || ((pin) == pinCoil2) || ((pin) == pinCoil3) || ((pin) == pinCoil4) )
#define pinIsSensor(pin) ( ((pin) == pinCLT) || ((pin) == pinIAT) || ((pin) == pinMAP) || ((pin) == pinTPS) || ((pin) == pinO2) || ((pin) == pinBat) )
#define pinIsUsed(pin) ( pinIsInjector((pin)) || pinIsIgnition((pin)) || pinIsSensor((pin)) )
static inline void instanteneousMAPReading() __attribute__((always_inline));
static inline void readMAP() __attribute__((always_inline));