Send through channel and squirt info to TS

This commit is contained in:
Josh Stewart 2018-04-23 15:27:57 +10:00
parent 1f998a2764
commit 1d5a79757a
6 changed files with 23 additions and 12 deletions

View File

@ -2299,7 +2299,7 @@ cmdtestspk450dc = "E\x03\x0C"
; you change it.
ochGetCommand = "r\$tsCanId\x30%2o%2c"
ochBlockSize = 84
ochBlockSize = 85
secl = scalar, U08, 0, "sec", 1.000, 0.000
status1 = scalar, U08, 1, "bits", 1.000, 0.000
@ -2387,9 +2387,14 @@ cmdtestspk450dc = "E\x03\x0C"
pulseWidth3 = scalar, U16, 77, "ms", 0.001, 0.000
pulseWidth4 = scalar, U16, 79, "ms", 0.001, 0.000
status3 = scalar, U08, 81, "bits", 1.000, 0.000
resetLockOn = bits, U08, 81, [0:0]
unused81_1-7 = bits, U08, 81, [1:7]
flexBoostCor = scalar, S16, 81, "kPa", 1.000, 0.000
resetLockOn = bits, U08, 81, [0:0]
unused81_1-4 = bits, U08, 81, [1:4]
nSquirts = bits, U08, 81, [5:7]
flexBoostCor = scalar, S16, 82, "kPa", 1.000, 0.000
nChannels = scalar, U08, 84, "bits", 1.000, 0.000
nIgnChannels = bits, U08, 84, [0:3]
nFuelChannels = bits, U08, 84, [4:7]
#if CELSIUS
coolant = { coolantRaw - 40 } ; Temperature readings are offset by 40 to allow for negatives
iat = { iatRaw - 40 } ; Temperature readings are offset by 40 to allow for negatives
@ -2414,7 +2419,7 @@ cmdtestspk450dc = "E\x03\x0C"
inj_open = { injOpen }
ase_enrich = { ase ? (100 + asePct ) : 100 } ; If ASE is active then equal the ASE + 100
map_multiply_amt = { multiplyMAP ? map : 100 } ; If multiply MAP is enabled, use the current MAP value, otherwise 100%
nSquirts = { nCylinders / divider }
;nSquirts = { nCylinders / divider }
;Manifold pressure in weirdo units
map_bar = { (map - baro) / 101.33 }

View File

@ -12,7 +12,7 @@
#define canbusPage 9//Config Page 9
#define warmupPage 10 //Config Page 10
#define SERIAL_PACKET_SIZE 84
#define SERIAL_PACKET_SIZE 85 //Must match ochBlockSize in ini file
byte currentPage = 1;//Not the same as the speeduino config page numbers
bool isMap = true;

View File

@ -490,6 +490,8 @@ void sendValues(uint16_t offset, uint16_t packetLength, byte cmd, byte portNum)
fullStatus[82] = lowByte(currentStatus.flexBoostCorrection);
fullStatus[83] = highByte(currentStatus.flexBoostCorrection);
fullStatus[84] = currentStatus.nChannels;
for(byte x=0; x<packetLength; x++)
{
if (portNum == 0) { Serial.write(fullStatus[offset+x]); }

View File

@ -114,12 +114,13 @@
#define BIT_TIMER_30HZ 4
#define BIT_STATUS3_RESET_PREVENT 0 //Indicates whether reset prevention is enabled
#define BIT_STATUS3_UNUSED2 1
#define BIT_STATUS3_UNUSED3 2
#define BIT_STATUS3_UNUSED4 3
#define BIT_STATUS3_UNUSED5 4
#define BIT_STATUS3_UNUSED6 5
#define BIT_STATUS3_UNUSED7 6
#define BIT_STATUS3_UNUSED1 1
#define BIT_STATUS3_UNUSED2 2
#define BIT_STATUS3_UNUSED3 3
#define BIT_STATUS3_UNUSED4 4
#define BIT_STATUS3_NSQUIRTS1 5
#define BIT_STATUS3_NSQUIRTS2 6
#define BIT_STATUS3_NSQUIRTS3 7
#define VALID_MAP_MAX 1022 //The largest ADC value that is valid for the MAP sensor
#define VALID_MAP_MIN 2 //The smallest ADC value that is valid for the MAP sensor
@ -361,6 +362,7 @@ struct statuses {
volatile byte status3;
int16_t flexBoostCorrection; //Amount of boost added based on flex
byte nSquirts;
byte nChannels; //Number of fuel and ignition channels
//Helpful bitwise operations:
//Useful reference: http://playground.arduino.cc/Code/BitMath

View File

@ -344,6 +344,7 @@ void setup()
currentStatus.crankRPM = ((unsigned int)configPage4.crankRPM * 100); //Crank RPM limit (Saves us calculating this over and over again. It's updated once per second in timers.ino)
triggerFilterTime = 0; //Trigger filter time is the shortest possible time (in uS) that there can be between crank teeth (ie at max RPM). Any pulses that occur faster than this time will be disgarded as noise. This is simply a default value, the actual values are set in the setup() functinos of each decoder
dwellLimit_uS = (1000 * configPage4.dwellLimit);
currentStatus.nChannels = (INJ_CHANNELS << 4) + IGN_CHANNELS; //First 4 bits store the number of injection channels, 2nd 4 store the number of ignition channels
noInterrupts();
initialiseTriggers();
@ -674,6 +675,7 @@ void setup()
if(CRANK_ANGLE_MAX_IGN == CRANK_ANGLE_MAX_INJ) { CRANK_ANGLE_MAX = CRANK_ANGLE_MAX_IGN; } //If both the injector max and ignition max angles are the same, make the overall system max this value
else if (CRANK_ANGLE_MAX_IGN > CRANK_ANGLE_MAX_INJ) { CRANK_ANGLE_MAX = CRANK_ANGLE_MAX_IGN; }
else { CRANK_ANGLE_MAX = CRANK_ANGLE_MAX_INJ; }
currentStatus.status3 = currentStatus.nSquirts << BIT_STATUS3_NSQUIRTS1; //Top 3 bits of the status3 variable are the number of squirts. This must be done after the above section due to nSquirts being forced to 1 for sequential
switch(configPage4.sparkMode)
{