Begin some work on warnings cleanup

This commit is contained in:
Josh Stewart 2018-07-19 17:35:35 +10:00
parent dc784deaef
commit 9e2d649f61
10 changed files with 29 additions and 6 deletions

View File

@ -88,6 +88,9 @@ long boost_pwm_target_value;
long boost_cl_target_boost; long boost_cl_target_boost;
byte boostCounter; byte boostCounter;
byte fanHIGH = HIGH; // Used to invert the cooling fan output
byte fanLOW = LOW; // Used to invert the cooling fan output
volatile bool vvt_pwm_state; volatile bool vvt_pwm_state;
unsigned int vvt_pwm_max_count; //Used for variable PWM frequency unsigned int vvt_pwm_max_count; //Used for variable PWM frequency
volatile unsigned int vvt_pwm_cur_value; volatile unsigned int vvt_pwm_cur_value;

View File

@ -3,6 +3,10 @@ Speeduino - Simple engine management for the Arduino Mega 2560 platform
Copyright (C) Josh Stewart Copyright (C) Josh Stewart
A full copy of the license may be found in the projects root directory A full copy of the license may be found in the projects root directory
*/ */
#include "auxiliaries.h"
#include "globals.h"
#include "src/PID_v1/PID_v1.h"
//Old PID method. Retained incase the new one has issues //Old PID method. Retained incase the new one has issues
//integerPID boostPID(&MAPx100, &boost_pwm_target_value, &boostTargetx100, configPage6.boostKP, configPage6.boostKI, configPage6.boostKD, DIRECT); //integerPID boostPID(&MAPx100, &boost_pwm_target_value, &boostTargetx100, configPage6.boostKP, configPage6.boostKI, configPage6.boostKD, DIRECT);
integerPID_ideal boostPID(&currentStatus.MAP, &currentStatus.boostDuty , &currentStatus.boostTarget, &configPage10.boostSens, &configPage10.boostIntv, configPage6.boostKP, configPage6.boostKI, configPage6.boostKD, DIRECT); //This is the PID object if that algorithm is used. Needs to be global as it maintains state outside of each function call integerPID_ideal boostPID(&currentStatus.MAP, &currentStatus.boostDuty , &currentStatus.boostTarget, &configPage10.boostSens, &configPage10.boostIntv, configPage6.boostKP, configPage6.boostKI, configPage6.boostKD, DIRECT); //This is the PID object if that algorithm is used. Needs to be global as it maintains state outside of each function call

View File

@ -334,7 +334,7 @@ struct statuses {
byte iatCorrection; //The amount of inlet air temperature adjustment currently being applied byte iatCorrection; //The amount of inlet air temperature adjustment currently being applied
byte launchCorrection; //The amount of correction being applied if launch control is active byte launchCorrection; //The amount of correction being applied if launch control is active
byte flexCorrection; //Amount of correction being applied to compensate for ethanol content byte flexCorrection; //Amount of correction being applied to compensate for ethanol content
byte flexIgnCorrection; //Amount of additional advance being applied based on flex int8_t flexIgnCorrection; //Amount of additional advance being applied based on flex. Note the type as this allows for negative values
byte afrTarget; byte afrTarget;
byte idleDuty; byte idleDuty;
bool idleUpActive; bool idleUpActive;
@ -732,7 +732,7 @@ struct config10 {
uint8_t flexFuelBins[6]; uint8_t flexFuelBins[6];
uint8_t flexFuelAdj[6]; //Fuel % @ current ethanol (typically 100% @ 0%, 163% @ 100%) uint8_t flexFuelAdj[6]; //Fuel % @ current ethanol (typically 100% @ 0%, 163% @ 100%)
uint8_t flexAdvBins[6]; uint8_t flexAdvBins[6];
uint8_t flexAdvAdj[6]; //Additional advance (in degrees) @ current ethanol (typically 0 @ 0%, 10-20 @ 100%) uint8_t flexAdvAdj[6]; //Additional advance (in degrees) @ current ethanol (typically 0 @ 0%, 10-20 @ 100%). NOTE: THIS IS A SIGNED VALUE!
//And another three corn rows die. //And another three corn rows die.
byte n2o_enable : 2; byte n2o_enable : 2;

View File

@ -3,6 +3,8 @@
int fastMap1023toX(int, int); int fastMap1023toX(int, int);
unsigned long percentage(byte, unsigned long); unsigned long percentage(byte, unsigned long);
inline long powint(int, unsigned int);
int divs100(long);
#define DIV_ROUND_CLOSEST(n, d) ((((n) < 0) ^ ((d) < 0)) ? (((n) - (d)/2)/(d)) : (((n) + (d)/2)/(d))) #define DIV_ROUND_CLOSEST(n, d) ((((n) < 0) ^ ((d) < 0)) ? (((n) - (d)/2)/(d)) : (((n) + (d)/2)/(d)))

View File

@ -40,9 +40,15 @@ uint16_t MAPcurRev; //Tracks which revolution we're sampling on
static inline void instanteneousMAPReading() __attribute__((always_inline)); static inline void instanteneousMAPReading() __attribute__((always_inline));
static inline void readMAP() __attribute__((always_inline)); static inline void readMAP() __attribute__((always_inline));
void initialiseADC();
void readTPS(); void readTPS();
void readO2_2(); void readO2_2();
void flexPulse(); void flexPulse();
void readCLT();
void readIAT();
void readO2();
void readBat();
void readBaro();
#if defined(ANALOG_ISR) #if defined(ANALOG_ISR)

View File

@ -4,6 +4,8 @@ Copyright (C) Josh Stewart
A full copy of the license may be found in the projects root directory A full copy of the license may be found in the projects root directory
*/ */
#include "sensors.h" #include "sensors.h"
#include "globals.h"
#include "maths.h"
void initialiseADC() void initialiseADC()
{ {

View File

@ -36,12 +36,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "idle.h" #include "idle.h"
#include "auxiliaries.h" #include "auxiliaries.h"
#include "sensors.h" #include "sensors.h"
#include "src/PID_v1/PID_v1.h"
//#include "src/DigitalWriteFast/digitalWriteFast.h" //#include "src/DigitalWriteFast/digitalWriteFast.h"
#include "errors.h" #include "errors.h"
#include "storage.h" #include "storage.h"
#include "scheduledIO.h" #include "scheduledIO.h"
#include "crankMaths.h" #include "crankMaths.h"
#include "updates.h"
#include <EEPROM.h> #include <EEPROM.h>
#if defined (CORE_TEENSY) #if defined (CORE_TEENSY)
#include <FlexCAN.h> #include <FlexCAN.h>
@ -92,8 +92,6 @@ int CRANK_ANGLE_MAX_INJ = 360; // The number of crank degrees that the system tr
static byte coilHIGH = HIGH; static byte coilHIGH = HIGH;
static byte coilLOW = LOW; static byte coilLOW = LOW;
static byte fanHIGH = HIGH; // Used to invert the cooling fan output
static byte fanLOW = LOW; // Used to invert the cooling fan output
volatile uint16_t mainLoopCount; volatile uint16_t mainLoopCount;
byte deltaToothCount = 0; //The last tooth that was used with the deltaV calc byte deltaToothCount = 0; //The last tooth that was used with the deltaV calc

6
speeduino/updates.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef UPDATES_H
#define UPDATES_H
void doUpdates();
#endif

View File

@ -8,6 +8,7 @@ These are some utility functions and variables used through the main code
uint16_t freeRam (); uint16_t freeRam ();
void setPinMapping(byte boardID); void setPinMapping(byte boardID);
void initialiseTriggers();
//This is dumb, but it'll do for now to get things compiling //This is dumb, but it'll do for now to get things compiling
#if defined(CORE_STM32) #if defined(CORE_STM32)

View File

@ -10,6 +10,7 @@
This function is one big MISRA violation. MISRA advisories forbid directly poking at memory addresses, however there is no other way of determining heap size on embedded systems. This function is one big MISRA violation. MISRA advisories forbid directly poking at memory addresses, however there is no other way of determining heap size on embedded systems.
*/ */
#include "utils.h" #include "utils.h"
#include "globals.h"
uint16_t freeRam () uint16_t freeRam ()
{ {
@ -1110,4 +1111,4 @@ void initialiseTriggers()
else { attachInterrupt(triggerInterrupt, trigger, FALLING); } else { attachInterrupt(triggerInterrupt, trigger, FALLING); }
break; break;
} }
} }