Just so I'm understanding, you're saying you can build precompiler directives that will perform the function of the populate routines so users can edit the following macro definitions / constants and end up with a custom dwell table?
Code:
#define DWELL_TGT 4.5 // dwell target in milliseconds - edit to your liking (using 4.5ms for standard ls2 coils)
#define CRANK_DWELL_TGT 3.2 // dwell target for cranking / startup
#define VOLT_COMP_8 2.4 // adds / subtracts from dwell target at given input voltage
#define VOLT_COMP_9 1.5
#define VOLT_COMP_10 0.9
#define VOLT_COMP_11 0.4
#define VOLT_COMP_13 -0.2
#define VOLT_COMP_14 -0.4
#define VOLT_COMP_15 -0.7
#define VOLT_COMP_16 -0.9
#define VOLT_COMP_17 -1.0
Or are you talking about making the tables statically initialized variables like the RPM table?
Code:
int rpmReference[RPM_DIVS] = { 25, 50, 75, 100, 125, 150, 175, 200, // the rpm reference
400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600, 2800,
3000, 3200, 3400, 3600, 3800, 4000, 4400, 4800, 5200, 5600, 6000, 6400, 6800 };
Also, I'm always a proponent of optimizing code but flash and memory resources aren't in short supply at this point.
Code:
Sketch uses 9816 bytes (31%) of program storage space. Maximum is 30720 bytes.
Global variables use 1013 bytes (49%) of dynamic memory, leaving 1035 bytes for local variables. Maximum is 2048 bytes.
Lastly, I don't see a point in trying to run this on a lesser mcu. This isn't a project focused on profitability, so saving a dollar or two on the mcu only to limit what can be added in the future seems counter productive. One of the reasons I developed a fondness for the adafruit clones is because they developed a bootloader mod that allows no-wait program startup while maintaining the ability to flash the chip over uart hands-off. This is important - I want the user to be able to update the firmware easily in the same way they can tune flash based PCMs. I also want it to be easily customizable, even if that means something as trivial as the end user printing their name or VIN # to uart on startup.
Latest changes tested and uploaded. Link to github repo is in my signature.
Bookmarks