FreeEMS  0.2.0-SNAPSHOT-285-g028e24c
Todo List
File BenchTest.c
TODO setup the timer registers as required.
Global calculateFuelAndIgnition (void) FPAGE_FE

TODO figure out what the correct "temperature" is to make MAF work correctly!

accumulate errors such that we know what sort of PW WOULD have been requested and enable a "over duty cut" to protect boosted users with insufficient injector size on cold nights

FIXME part of to schedule or not to schedule should be : (masterPulseWidth > injectorMinimumPulseWidth)

Global calculateFuelAndIgnition (void) FPAGE_FE

TODO figure out what the correct "temperature" is to make MAF work correctly!

accumulate errors such that we know what sort of PW WOULD have been requested and enable a "over duty cut" to protect boosted users with insufficient injector size on cold nights

FIXME part of to schedule or not to schedule should be : (masterPulseWidth > injectorMinimumPulseWidth)

Global COMBUSTION_SYNC

Introduce the concept of sync level to schedule for if NOT synced

and a way of deciding what to do in different sync states

and proper dividers for pulsewidths

and ability to lock pulsewidht/dwell for scheduling

and generalise scheduling to all pins

and provide a way of choosing a source of pulsewidth dwell or fuel duration

and a way of allowing overly advanced scheduling instead of none, when its fuel

File commsCore.c

TODO function to setup a packet and send it fn(populateBodyFunctionPointer(), header, other, fields, here, and, use, or, not, within){}

TODO factor many things into functions and move the receive delegator to its own file

File commsISRs.c
TODO SCI0ISR() needs to be split into some hash defines and an include file that formats it to be the ISR for a specific channel.
Global cutEnabled::IgnitionRPM
document this
Global cutEnabled::IgnOverBoost
document this
Global cutEnabled::InjectionRPM
document this
Global cutEnabled::InjOverBoost
document this
Global decodePacketAndRespond (void) TEXT

factor this out into validation delegation function once the number of types increases somewhat

factor this out into validation delegation function once the number of types increases somewhat

test all things listed below:

Global decodePacketAndRespond (void) TEXT

factor this out into validation delegation function once the number of types increases somewhat

factor this out into validation delegation function once the number of types increases somewhat

test all things listed below:

Global decoderInitPreliminary ()
TODO Perhaps use some of the space freed by shrinking all timing tables for this: /unsigned long wheelEventTimeStamps[numberOfWheelEvents]; // For logging wheel patterns as observed
Global decoderInitPreliminary ()
TODO Perhaps use some of the space freed by shrinking all timing tables for this: /unsigned long wheelEventTimeStamps[numberOfWheelEvents]; // For logging wheel patterns as observed
Global doubleHighSeen
TODO why is this here, and why is it static/shared, investigate
Global ectSwitchOnCodeTime

TODO Move these to decoder interface, and make set by each decoder where appropriate

  • ECT limits

TODO Move these to decoder interface AND rename to be more generic/meaningful/accurate, and make set by each decoder where appropriate

Global enablePLL (void) FPAGE_FE
Should be limited, and have break out with error code and fall back mechanism.
Global enablePLL (void) FPAGE_FE
Should be limited, and have break out with error code and fall back mechanism.
Global eventValidForCrankSync []
TODO build this with similar hash if logic: need to reconsider how to use this or whether to even have it. A "corresponding event" table might be good instead, kinda like the mapping above, but from real to real, only when the angles are exactly 360 out.
Global eventValidForCrankSync [SIZE_OF_EVENT_ARRAYS]
TODO From 0 - totalEventAngleRange degrees, scale: x50
Global EXTERN

TODO For Sean to integrate back in

TODO we should define the register masks that we use in one place, but probably not in the main device header.

File flashGlobals.h
TODO integrate this file with the rest of the masks and other global constants and hash defines etc
Page General Strategies
TODO TBC (other strategies)
Global generateCoreVars (void) LOOKUPF
TODO average the generated values here
Global generateCoreVars (void) LOOKUPF
TODO average the generated values here
Global generateDerivedVars (void) FPAGE_FE
TODO make generic!!!!
Global generateDerivedVars (void) FPAGE_FE
TODO make generic!!!!
File globalDefines.h
TODO Some investigation as to whether it is best to use consts or defines is required
File GM-LT1-CAS-360and8.c
TODO config pulse accumulator to fire its own RPM interrupt to give the wheel more resoloution. Such as fire on every 10x.
Global ignitionCutFlags::IgnitionRPM
document this
Global ignitionCutFlags::IgnLostPLL
document this
Global ignitionCutFlags::IgnOverBoost
document this
Global ignitionCutFlags::IgnSelfClock
document this
Global initECTTimer ()
TODO Take the configuration from the decoder (as is) and mask it such that it does not affect the 6 other channels. Take the the number of output channels required from configuration and configure that many as outputs Configure the balance in whatever way is specified in the GPIO configuration - allow second input to be reused as GPI only.
Global injectionCutFlags::InjectionRPM
document this
Global injectionCutFlags::InjLostPLL
document this
Global injectionCutFlags::InjOverBoost
document this
Global injectionCutFlags::InjSelfClock
document this
Global InjectorXISR ()
TODO *maybe* instead of checking min and increasing pulse, just force it straight off if diff between start and now+const is greater than desired pulsewidth
Class inputOutputSetting
TODO document this better
Global IT (10)
this is all wrongly laid out now, due to Dave's whinging, so needs fixing...
Global lastEventTimeStamp
TODO sync loss/gain semantics - how paranoid? under what circumstances? should we make it configurable whether a decoder that is in a situation where it would find sync if not synced, resets sync, or loses sync. Likewise, at initial sync gain time, should it go "prelim sync found" and only verify sync on the second lap around, or start firing events straight off the bat. Starting will suck if paranoid, but if there is noise at high load/rpm and events get mis-scheduled before sync is lost, that is serious. This is philosophical, and the reality is that you must assume that your signal is clean to some level and verified clean under lower risk conditions.
Global MAFFuelConstant
TODO Determine what the value of MAF fuel constant should be
Global main ()

TODO maybe move this to paged flash ?

TODO Add verification reporting code here that disables the timer interrupts such that no events ever get scheduled, and then sits looping sending error packets out about what is wrong. set a whole bunch of flags and check them here sending a packet for each with a unique errorID for each and thus a unique easy to understand message for each on the PC side. BEFORE the priming code such that no fuel gets injected. Will need to modularise the comms stuff to process packets based on calls from this section too, avoid excess duplication if possible.

Global MASS_ERASE
TODO add mass erase function and replace ?? with the real value
Global NO_PROBLEMO
TODO Introduce some structure to the numbering such that they can be interpreted somewhat without a chart
Global outputEventInputEventNumbers [MAX_NUMBER_OF_OUTPUT_EVENTS]

TODO two unsigned chars, and two unsigned shorts, which is the MAP ADC value, the MAP value is sampled on every event in a cycle, and if less than the previous stored value, which is reset at every zeroth event, with the old value and old event number stored globally.

TODO the same thing could be done, but with a median filter or similar, perhaps map sampling could be done dymanically like this, though it could yield unpredictable results, it could also yield the best running engines, just a thought...

Global populateBasicDatalog (void) FPAGE_FE

TODO this is pulling in the system string.h not the m68hc1x version, and functions other than memcpy do not work because they are not in crt1.o or other included-by-default libs

TODO setup proper sequence and clock with some sort of differential measurement log to log. insert in front of actual data because these are part of the log itself.

Global populateBasicDatalog (void) FPAGE_FE

TODO this is pulling in the system string.h not the m68hc1x version, and functions other than memcpy do not work because they are not in crt1.o or other included-by-default libs

TODO setup proper sequence and clock with some sort of differential measurement log to log. insert in front of actual data because these are part of the log itself.

Global resetReceiveState (unsigned char sourceIDState)

TODO this is in the wrong file!! Either move the header declaration or move the function!

TODO CAN0CTL1 &= CANCTL1_RX_DISABLE;

TODO CAN0CTL1 &= CANCTL1_RX_ISR_DISABLE;

TODO CAN0CTL1 |= CANCTL1_RX_ENABLE;

TODO CAN0CTL1 |= CANCTL1_RX_ISR_ENABLE;

Global resetReceiveState (unsigned char sourceIDState)

TODO this is in the wrong file!! Either move the header declaration or move the function!

TODO CAN0CTL1 &= CANCTL1_RX_DISABLE;

TODO CAN0CTL1 &= CANCTL1_RX_ISR_DISABLE;

TODO CAN0CTL1 |= CANCTL1_RX_ENABLE;

TODO CAN0CTL1 |= CANCTL1_RX_ISR_ENABLE;

Global resetToNonRunningState (unsigned char uniqueLossID)
TODO bring this up to date and/or find a better way to do it.
Global RTIISR ()

TODO refactor this entire file, especially to remove apparently expensive modulus operations which could be replaced with >= instead. Maybe much more.

TODO This is too quick to turn off, average 0.5 seconds, which is OK, but fastest = 0seconds which is difficult to understand, needs a flag and to be 1 - 2 with average 1.5.

Global RTIISR ()

TODO refactor this entire file, especially to remove apparently expensive modulus operations which could be replaced with >= instead. Maybe much more.

TODO This is too quick to turn off, average 0.5 seconds, which is OK, but fastest = 0seconds which is difficult to understand, needs a flag and to be 1 - 2 with average 1.5.

Global RXHeaderPayloadLength
why global?
Global sampleLoopADC (ADCBuffer *) FPAGE_F8
TODO this needs to be split into two loops one for the small block and one for the big one for the future chips.
Global sampleLoopADC (ADCBuffer *) FPAGE_F8
TODO this needs to be split into two loops one for the small block and one for the big one for the future chips.
Global scheduleOutputs (void) FPAGE_FE

FIXME part of to schedule or not to schedule should be : (masterPulseWidth > injectorMinimumPulseWidth)

don't bother doing anything, settings don't make sense... TODO move this to init time to prevent bad config

don't bother doing anything, settings don't make sense... TODO move this to init time to prevent bad config

TODO create this check:

TODO Schedule injection with real timing, requires some tweaks to work right.

TODO move this loop variable to fixedConfig and make a subset of the remainder of channels configured for fuel with a start time/tooth directly set for now, ie, make the 6 channels usable as fuel or ignition from reasonable configuration and write a guide on how to set it up for any engine.

TODO move sched code to a function or functions (inline?) that can be unit tested such that we KNOW it performs as anticipated rather than just trying it out on a 400hp turbo truck engine.

TODO refactor this partly into init.c as per more detailed TD above

TODO keep an eye on overflow here when increasing resolution by scaling angles

TODO, do this ^ at init time from fixed config as an array of angles and a single engine offset combined into this runtime array.

TODO rather than look for the nearest tooth and then step through till you find the right one that can work, instead figure out the dwell in angle and subtract that too, and find the correct tooth first time, will save cpu cycles, and get same answer and be less complex...

Global scheduleOutputs (void) FPAGE_FE

FIXME part of to schedule or not to schedule should be : (masterPulseWidth > injectorMinimumPulseWidth)

don't bother doing anything, settings don't make sense... TODO move this to init time to prevent bad config

don't bother doing anything, settings don't make sense... TODO move this to init time to prevent bad config

TODO create this check:

TODO Schedule injection with real timing, requires some tweaks to work right.

TODO move this loop variable to fixedConfig and make a subset of the remainder of channels configured for fuel with a start time/tooth directly set for now, ie, make the 6 channels usable as fuel or ignition from reasonable configuration and write a guide on how to set it up for any engine.

TODO move sched code to a function or functions (inline?) that can be unit tested such that we KNOW it performs as anticipated rather than just trying it out on a 400hp turbo truck engine.

TODO refactor this partly into init.c as per more detailed TD above

TODO keep an eye on overflow here when increasing resolution by scaling angles

TODO, do this ^ at init time from fixed config as an array of angles and a single engine offset combined into this runtime array.

TODO rather than look for the nearest tooth and then step through till you find the right one that can work, instead figure out the dwell in angle and subtract that too, and find the correct tooth first time, will save cpu cycles, and get same answer and be less complex...

Global schedulePortTPin (unsigned char pin, LongTime timeStamp)
TODO Make this more understandable as right now it is difficult to grok.
Global schedulePortTPin (unsigned char pin, LongTime timeStamp)
TODO Make this more understandable as right now it is difficult to grok.
Global SCI0ISR (void) INT TEXT1

TODO Move this code into an include file much like the fuel interrupts such that it can be used for multiple UART SCI devices without duplication.

TODO Fix the init code such that this doesn't run at boot without a serail device attached. Clear buffer maybe? or flag clearing/isr enabling ordering?

Global SCI0ISR (void) INT TEXT1

TODO Move this code into an include file much like the fuel interrupts such that it can be used for multiple UART SCI devices without duplication.

TODO Fix the init code such that this doesn't run at boot without a serail device attached. Clear buffer maybe? or flag clearing/isr enabling ordering?

Global selfSetTimer
TODO make this ^ scaling better x10 yields 64rpm minimum functional engine speed.
Global setupPagedRAM (unsigned char) FPAGE_F8
TODO change parameter style to be a pointer to a register and a mask?
Global setupPagedRAM (unsigned char) FPAGE_F8
TODO change parameter style to be a pointer to a register and a mask?
Global SmallTables1::primingVolumeTable
TODO define units. perhaps micro litres (cubic milli meters) would be good, 5 - 100 seem to be the norm 327.68 = 65535/200
Global SmallTablesALocationID
Claim some RAM back for XGATE use?
Global StagedOffISR (void) INT TEXT1
TODO This will be handled by XGATE, somehow, in the mean time, move to UISR file along with others.
Global StagedOffISR (void) INT TEXT1
TODO This will be handled by XGATE, somehow, in the mean time, move to UISR file along with others.
Global StagedOnISR (void) INT TEXT1
TODO This will be handled by XGATE, somehow, in the mean time, move to UISR file along with others.
Global StagedOnISR (void) INT TEXT1
TODO This will be handled by XGATE, somehow, in the mean time, move to UISR file along with others.
Global syncConfirmationsRunningCounter
TODO remove DEBUG
Global timeStamp

TODO why is this here, and why is it static/shared, investigate

TODO why is this here, and why is it static/shared, investigate

Page Tune Switching
TODO insert discussion about various uses of tune switching here.
Global UISR (void)

TODO Split this into its own file, create one for each, and clear flags for all, and increment shared counter as is.

TODO Currently not a problem, but as indirectly pointed out by johntramp, if no flag clearing is being done, then this code will run continuously, which is not a good idea...

Global UISR (void)

TODO Split this into its own file, create one for each, and clear flags for all, and increment shared counter as is.

TODO Currently not a problem, but as indirectly pointed out by johntramp, if no flag clearing is being done, then this code will run continuously, which is not a good idea...

Global unknownLeadingEdges
TODO why is this here, and why is it static/shared, investigate
Page Unlisted Files
TODO add a description for each item with an anchor above it. Reference the anchor from the above list.
Global validateMainTable (mainTable *) TEXT
more detail here....
Global validateMainTable (mainTable *) TEXT
more detail here....
Global writeSector (unsigned char, unsigned short *, unsigned char, unsigned short *) TEXT
TODO Decide if we need to disable interrupts since we are manually setting Flash/RAM pages.
Global writeSector (unsigned char, unsigned short *, unsigned char, unsigned short *) TEXT
TODO Decide if we need to disable interrupts since we are manually setting Flash/RAM pages.
Global writeWord (unsigned short *, unsigned short) TEXT
TODO CBEIF mask hash define - is this still needed?
Global writeWord (unsigned short *, unsigned short) TEXT
TODO CBEIF mask hash define - is this still needed?