FreeEMS  0.2.0-SNAPSHOT-282-g9efc524
Macros | Variables
globalConstants.c File Reference

Global constant values. More...

#include "inc/freeEMS.h"
Include dependency graph for globalConstants.c:

Go to the source code of this file.

Macros

#define GLOBAL_CONSTANTS_C
#define NO_CONST_ARRAYS

Variables

const unsigned char interfaceVersion [INTERFACE_VERSION_LENGTH] = { INTERFACE_VERSION }
 Serial interface unique identifier. TODO change spec to not have numerics and to parse from string, maybe pull from somewhere?
const unsigned char firmwareVersion [FIRMWARE_VERSION_LENGTH] = { FIRMWARE_VERSION "-" BUILD_CONFIG }
 Displayable firmware version identifier.
const unsigned char buildTimeAndDate [FIRMWARE_BUILD_DATE_LENGTH] = { FIRMWARE_BUILD_DATE }
 When and roughly where it was built.
const unsigned char compilerVersion [COMPILER_VERSION_LENGTH] = { __VERSION__ }
 GCC supplied compiler version used to build it.
const unsigned char operatingSystem [OPERATING_SYSTEM_LENGTH] = { OPERATING_SYSTEM }
 Which OS was it built on.
const unsigned char builtByName [BUILT_BY_NAME_LENGTH] = { BUILT_BY_NAME }
 Name of the person who built it.
const unsigned char supportEmail [SUPPORT_EMAIL_LENGTH] = { SUPPORT_EMAIL }
 Support email for this build.
const unsigned long masterFuelConstant = 139371764
 Divisors and untunable physical constants combined into a single master fuel constant.
const unsigned long MAFFuelConstant = 0
 MAF fuel constant.
*const unsigned short ectSwitchOnCodeTime = 250
const unsigned short ectSwitchOffCodeTime = 250
const unsigned char ectMainOnMasks [ECT_CHANNELS] = {BIT2, BIT3, BIT4, BIT5, BIT6, BIT7}
const unsigned char ectMainOffMasks [ECT_CHANNELS] = {NBIT2, NBIT3, NBIT4, NBIT5, NBIT6, NBIT7}
const unsigned char ectMainActiveMasks [ECT_CHANNELS] = {BIT5, BIT7, BIT1, BIT3, BIT5, BIT7}
const unsigned char ectMainEnableMasks [ECT_CHANNELS] = {0x30, 0xC0, 0x03, 0x0C, 0x30, 0xC0}
const unsigned char ectMainDisableMasks [ECT_CHANNELS] = {0xCF, 0x3F, 0xFC, 0xF3, 0xCF, 0x3F}
const unsigned char ectMainGoHighMasks [ECT_CHANNELS] = {BIT4, BIT6, BIT0, BIT2, BIT4, BIT6}
const unsigned char ectMainGoLowMasks [ECT_CHANNELS] = {NBIT4, NBIT6, NBIT0, NBIT2, NBIT4, NBIT6}

Detailed Description

Global constant values.

All global constants values are, and should be, defined here.

Definition in file globalConstants.c.

Macro Definition Documentation

#define GLOBAL_CONSTANTS_C

Definition at line 37 of file globalConstants.c.

#define NO_CONST_ARRAYS

Definition at line 38 of file globalConstants.c.

Variable Documentation

const unsigned char interfaceVersion[INTERFACE_VERSION_LENGTH] = { INTERFACE_VERSION }

Serial interface unique identifier. TODO change spec to not have numerics and to parse from string, maybe pull from somewhere?

This should only change when the serial interface changes (even a little)This field consists of 3 chars for a 3 part version number and a free form string. For any unique string the version number is also unique. In this way tools can easily support a range of versions for a specific unique string ID TODO change spec to not have numerics and to parse from string, maybe pull from somewhere?

Definition at line 47 of file globalConstants.c.

Referenced by decodePacketAndRespond().

const unsigned char firmwareVersion[FIRMWARE_VERSION_LENGTH] = { FIRMWARE_VERSION "-" BUILD_CONFIG }

Displayable firmware version identifier.

This changes automatically every time the code is changed at all (even a little) thanks to Git.

Definition at line 48 of file globalConstants.c.

Referenced by decodePacketAndRespond().

const unsigned char buildTimeAndDate[FIRMWARE_BUILD_DATE_LENGTH] = { FIRMWARE_BUILD_DATE }

When and roughly where it was built.

Definition at line 49 of file globalConstants.c.

Referenced by decodePacketAndRespond().

const unsigned char compilerVersion[COMPILER_VERSION_LENGTH] = { __VERSION__ }

GCC supplied compiler version used to build it.

Definition at line 50 of file globalConstants.c.

Referenced by decodePacketAndRespond().

const unsigned char operatingSystem[OPERATING_SYSTEM_LENGTH] = { OPERATING_SYSTEM }

Which OS was it built on.

Definition at line 51 of file globalConstants.c.

Referenced by decodePacketAndRespond().

const unsigned char builtByName[BUILT_BY_NAME_LENGTH] = { BUILT_BY_NAME }

Name of the person who built it.

Definition at line 52 of file globalConstants.c.

Referenced by decodePacketAndRespond().

const unsigned char supportEmail[SUPPORT_EMAIL_LENGTH] = { SUPPORT_EMAIL }

Support email for this build.

Definition at line 53 of file globalConstants.c.

Referenced by decodePacketAndRespond().

const unsigned long masterFuelConstant = 139371764

Divisors and untunable physical constants combined into a single master fuel constant.

const unsigned short molarMassOfAir = 2897; // in grams per 100 moles, so divide by 100 to get gm/mol const unsigned short msToTicks = 1250; // constant to bring ms into 0.8us chunks const unsigned short universalGasConstant = 34056; // 8.314472 * 4096, so divide by 4096 to get real number

hash define injectorFlowDivisor 1024 hash define injectorFlowUnitDivisor 1000 - to get it into litres/second hash define injectorFlowTotalDivisor 1024000 hash define stoichiometricAFRDivisor 1024 hash define universalGasConstantDivisor 4096 hash define molarMassOfAirDivisor 100 hash define perCylinderVolumeDivisor 32768

TODO hash define the fuel constant for different clock tick setups (msToTicks will vary)

master = (msToTicks * molarMassOfAir * universalGasConstantDivisor * stoichiometricAFRDivisor * injectorFlowTotalDivisor) / (universalGasConstant * molarMassOfAirDivisor * perCylinderVolumeDivisor); master = (1250 * 2897 * 4096 * 1024 * 1024000 ) / (34056 * 100 * 32768 ); http://duckduckgo.com/?q=%28%281250+*+2897+*+4096+*+1024+*+1024000%29+%2F+%2834056+*++100+*+32768%29

((1250 * 2897 * 4096 * 1024 * 1024000) / (34056 * 100 * 32768) = 139371764

Definition at line 77 of file globalConstants.c.

Referenced by initConfiguration().

const unsigned long MAFFuelConstant = 0

MAF fuel constant.

Todo:
TODO Determine what the value of MAF fuel constant should be

Definition at line 83 of file globalConstants.c.

* const unsigned short ectSwitchOnCodeTime = 250
Todo:
TODO Move these to decoder interface, and make set by each decoder where appropriate
  • ECT limits

Definition at line 88 of file globalConstants.c.

Referenced by decodePacketAndRespond(), InjectorXISR(), and scheduleOutputs().

const unsigned short ectSwitchOffCodeTime = 250

Definition at line 90 of file globalConstants.c.

Referenced by schedulePortTPin().

const unsigned char ectMainOnMasks[ECT_CHANNELS] = {BIT2, BIT3, BIT4, BIT5, BIT6, BIT7}

Definition at line 109 of file globalConstants.c.

Referenced by schedulePortTPin().

const unsigned char ectMainOffMasks[ECT_CHANNELS] = {NBIT2, NBIT3, NBIT4, NBIT5, NBIT6, NBIT7}

Definition at line 110 of file globalConstants.c.

Referenced by InjectorXISR().

const unsigned char ectMainActiveMasks[ECT_CHANNELS] = {BIT5, BIT7, BIT1, BIT3, BIT5, BIT7}

Definition at line 113 of file globalConstants.c.

Referenced by schedulePortTPin().

const unsigned char ectMainEnableMasks[ECT_CHANNELS] = {0x30, 0xC0, 0x03, 0x0C, 0x30, 0xC0}

Definition at line 114 of file globalConstants.c.

Referenced by InjectorXISR().

const unsigned char ectMainDisableMasks[ECT_CHANNELS] = {0xCF, 0x3F, 0xFC, 0xF3, 0xCF, 0x3F}

Definition at line 115 of file globalConstants.c.

Referenced by InjectorXISR().

const unsigned char ectMainGoHighMasks[ECT_CHANNELS] = {BIT4, BIT6, BIT0, BIT2, BIT4, BIT6}

Definition at line 116 of file globalConstants.c.

Referenced by InjectorXISR(), and schedulePortTPin().

const unsigned char ectMainGoLowMasks[ECT_CHANNELS] = {NBIT4, NBIT6, NBIT0, NBIT2, NBIT4, NBIT6}

Definition at line 117 of file globalConstants.c.

Referenced by InjectorXISR().