Code: Select all
String[] coreStatusAFlagNames = {
"CS-FuelPumpPrime",
"CS-unused1",
"CS-unused2",
"CS-unused3",
"CS-unused4",
"CS-unused5",
"CS-unused6",
"CS-unused7"
};
String[] decoderFlagsFlagNames = {
"DF-CombustionSync",
"DF-CrankSync",
"DF-CamSync",
"DF-LAST_TIMESTAMP_VALID",
"DF-LAST_PERIOD_VALID",
"DF-LAST_MATCH_VALID",
"DF-Spare-6",
"DF-Spare-7"
};
String[] flaggableFlagsNames = {
"FF-callsToUISRs", // to ensure we aren't accidentally triggering unused ISRs.
"FF-lowVoltageConditions", // low voltage conditions.
"FF-decoderSyncLosses", // Number of times cam, crank or combustion sync is lost.
"FF-decoderSyncCorrections", // Definite decoder syncs found while already synced in a different position.
"FF-decoderSyncStateClears", // Sync loss called when not synced yet, thus discarding data and preventing sync.
"FF-serialNoiseErrors", // Incremented when noise is detected
"FF-serialFramingErrors", // Incremented when a framing error occurs
"FF-serialParityErrors", // Incremented when a parity error occurs
"FF-serialOverrunErrors", // Incremented when overrun occurs (duplicated in KeyUserDebug below)
"FF-serialEscapePairMismatches", // Incremented when an escape is found but not followed by an escapee
"FF-serialStartsInsideAPacket", // Incremented when a start byte is found inside a packet
"FF-serialPacketsOverLength", // Incremented when the buffer fills up before the end
"FF-serialChecksumMismatches", // Incremented when calculated checksum did not match the received one
"FF-serialPacketsUnderLength", // Incremented when a packet is found that is too short
"FF-commsDebugMessagesNotSent", // Incremented when a debug message can't be sent due to the TX buffer
"FF-commsErrorMessagesNotSent" // Incremented when an error message can't be sent due to the TX buffer
};
private LogField[] fields = { // This should be read from a file at some point, as it's going to be flexible. See FreeEMS/src/inc/structs.h for definitive answers.
// CoreVars struct contents:
new LogField("IAT", 100), // Inlet Air Temperature : 0.0 - 655.35 (0.01 Kelvin (/100))
new LogField("CHT", 100), // Coolant / Head Temperature : 0.0 - 655.35 (0.01 Kelvin (/100))
new LogField("TPS", 640), // Throttle Position Sensor : 0.0 - 102.398438 (0.0015625 % (/640))
new LogField("EGO", 32768), // Exhaust Gas Oxygen : 0.0 - 1.99996948 (0.0000305175781 lambda (/32768))
new LogField("MAP", 100), // Manifold Absolute Pressure : 0.0 - 655.35 (0.01 kPa (/100))
new LogField("AAP", 100), // Atmospheric Absolute Pressure : 0.0 - 655.35 (0.01 kPa (/100))
new LogField("BRV", 1000), // Battery Reference Voltage : 0.0 - 65.535 (0.001 Volts (/1000))
new LogField("MAT", 100), // Manifold Air Temperature : 0.0 - 655.35 (0.01 Kelvin (/100))
new LogField("EGO2", 32768), // Exhaust Gas Oxygen : 0.0 - 1.99996948 (0.0000305175781 lambda (/32768))
new LogField("IAP", 100), // Intercooler Absolute Pressure : 0.0 - 655.35 (0.01 kPa (/100))
new LogField("MAF"), // Mass Air Flow : 0.0 - 65535.0 (raw units from lookup)
new LogField("DMAP"), // Delta MAP kPa/second or similar : 0.0 - 65535.0 (raw units from lookup)
new LogField("DTPS"), // Delta TPS %/second or similar : 0.0 - 65535.0 (raw units from lookup)
new LogField("RPM", 2), // Revolutions Per Minute (Calced) : 0.0 - 32767.5 (0.5 RPM (/2))
new LogField("DRPM"), // Delta RPM (Calced) : 0.0 - 65535.0 (raw units from lookup)
new LogField("DDRPM"), // Delta Delta RPM (Calced) : 0.0 - 65535.0 (raw units from lookup)
// DerivedVars struct contents:
new LogField("LoadMain", 512), // Configurable unit of load, scale same as map by default
new LogField("VEMain", 512), // Volumetric Efficiency in 0 - 128%
new LogField("Lambda", 32768), // Integral Lambda 0 - 2.0
new LogField("AirFlow"), // raw intermediate, remove
new LogField("densityAndFuel"), // raw intermediate, remove
new LogField("BasePW", 1250), // Raw PW before corrections 0 - ~52ms
new LogField("ETE", (100.0/32768.0)), // Engine Temperature Enrichment percentage correction 0 - 200%
new LogField("TFCTotal", 1250), // Transient fuel correction PW (+/-) 0 - ~52ms
new LogField("EffectivePW", 1250), // Actual PW of fuel delivery 0 - ~52ms
new LogField("IDT", 1250), // PW duration before fuel flow begins 0 - ~52ms
new LogField("RefPW", 1250), // Reference electrical PW 0 - ~52ms
new LogField("Advance", 50), // Ignition advance (scaled degrees / oneDegree(currently 50) = degrees) 0 - ~64*
new LogField("Dwell", 1250), // Dwell period, s 0 - ~52ms
// KeyUserDebugs struct contents
new LogField("tempClock", types.UINT8), // Incremented once per log sent, to be moved to a char TODO
new LogField("spareChar", types.UINT8), // Spare
new LogField("coreStatusA", types.BITS8, coreStatusAFlagNames), // Duplicated, migrate here, remove global var
new LogField("decoderFlags", types.BITS8, decoderFlagsFlagNames), // Various decoder state flags
new LogField("flaggableFlags", types.BITS16, flaggableFlagsNames),///< Flags to go with our flaggables struct.
new LogField("currentEvent", types.UINT8), // Which input event was last to come in
new LogField("syncLostWithThisID", types.UINT8), // A unique identifier for the reason behind a loss of sync
new LogField("syncLostOnThisEvent", types.UINT8), // Where in the input pattern it all went very badly wrong
new LogField("syncCaughtOnThisEvent", types.UINT8), // Where in the input pattern that things started making sense
new LogField("syncResetCalls", types.UINT8), // Sum of losses, corrections and state clears
new LogField("primaryTeethSeen", types.UINT8), // Free running counters for number of input events, useful at lower RPM
new LogField("secondaryTeethSeen", types.UINT8), // Free running counters for number of input events, useful at lower RPM
new LogField("serialOverrunErrors", types.UINT8), // Incremented when an overrun occurs due to high interrupt load, not a fault, just a fact of life at high RPM
new LogField("serialHardwareErrors", types.UINT8), // Sum of noise, parity, and framing errors
new LogField("serialAndCommsCodeErrors", types.UINT8), // Sum of checksum, escape mismatches, starts inside, and over/under length
new LogField("inputEventTimeTolerance"), // Required to tune noise rejection over RPM TODO add to LT1 and MissingTeeth
new LogField("zsp10"), // Spare US variable
new LogField("zsp9"), // Spare US variable
new LogField("zsp8"), // Spare US variable
new LogField("zsp7"), // Spare US variable
new LogField("zsp6"), // Spare US variable
new LogField("zsp5"), // Spare US variable
new LogField("zsp4"), // Spare US variable
new LogField("zsp3"), // Spare US variable
new LogField("clockInMilliSeconds"), // Migrate to start of all large datalogs once analysed
new LogField("clock8thMSsInMillis", 8) // Migrate to start of all large datalogs once analysed